Passed
Branch master (95796a)
by Andreas
38:22
created
lib/org/openpsa/invoices/handler/action.php 1 patch
Spacing   +8 added lines, -13 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     {
30 30
         midcom::get()->auth->require_valid_user();
31 31
 
32
-        if (   empty($_POST['id'])
32
+        if (empty($_POST['id'])
33 33
             || empty($_POST['action']))
34 34
         {
35 35
             throw new midcom_error('Incomplete POST data');
@@ -40,8 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
         midcom::get()->skip_page_style = true;
42 42
 
43
-        $data['message'] = array
44
-        (
43
+        $data['message'] = array(
45 44
             'title' => $this->_l10n->get($this->_component),
46 45
             'type' => 'error'
47 46
         );
@@ -199,8 +198,7 @@  discard block
 block discarded – undo
199 198
         $mail = new org_openpsa_mail();
200 199
 
201 200
         // define replacements for subject / body
202
-        $mail->parameters = array
203
-        (
201
+        $mail->parameters = array(
204 202
             "INVOICE_LABEL" => $invoice_label,
205 203
             "INVOICE_DATE" => $invoice_date,
206 204
             "FIRSTNAME" => $contactDetails["firstname"],
@@ -327,7 +325,7 @@  discard block
 block discarded – undo
327 325
         $invoice_sum = 0;
328 326
         foreach ($this->_request_data['invoice_items'] as $item)
329 327
         {
330
-            $entry =  array();
328
+            $entry = array();
331 329
             $entry['id'] = $item->id;
332 330
             try
333 331
             {
@@ -419,8 +417,7 @@  discard block
 block discarded – undo
419 417
             default:
420 418
                 throw new midcom_error('Invalid operation "' . $_POST['oper'] . '"');
421 419
         }
422
-        $data['saved_values'] = array
423
-        (
420
+        $data['saved_values'] = array(
424 421
             'id' => $item->id,
425 422
             'quantity' => $item->units,
426 423
             'price' => $item->pricePerUnit,
@@ -432,7 +429,7 @@  discard block
 block discarded – undo
432 429
 
433 430
     private function _verify_post_data()
434 431
     {
435
-        if (   empty($_POST['oper'])
432
+        if (empty($_POST['oper'])
436 433
             || !isset($_POST['id'])
437 434
             || !isset($_POST['description'])
438 435
             || !isset($_POST['price'])
@@ -490,10 +487,8 @@  discard block
 block discarded – undo
490 487
         $this->add_breadcrumb("invoice/" . $this->_object->guid . "/", $this->_l10n->get('edit invoice items') . ': ' . $title);
491 488
 
492 489
         midcom::get()->head->set_pagetitle($this->_l10n->get('edit invoice items') . ': ' . $title);
493
-        $this->_view_toolbar->add_item
494
-        (
495
-            array
496
-            (
490
+        $this->_view_toolbar->add_item(
491
+            array(
497 492
                 MIDCOM_TOOLBAR_URL => "invoice/recalculation/{$this->_object->guid}/",
498 493
                 MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('recalculate_by_reports'),
499 494
                 MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png',
Please login to merge, or discard this patch.
lib/org/openpsa/invoices/invoice/item.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
     public function _on_creating()
20 20
     {
21
-        if (   $this->invoice
21
+        if ($this->invoice
22 22
             && $this->position == 0)
23 23
         {
24 24
             $invoice = org_openpsa_invoices_invoice_dba::get_cached($this->invoice);
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
                 $task = org_openpsa_projects_task_dba::get_cached($this->task);
72 72
                 $url = $projects_url . 'task/' . $task->guid . '/';
73 73
             }
74
-            catch (midcom_error $e){}
74
+            catch (midcom_error $e) {}
75 75
         }
76
-        if (   $url == ''
76
+        if ($url == ''
77 77
             && $sales_url)
78 78
         {
79 79
             try
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
                 $deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($this->deliverable);
82 82
                 $url = $sales_url . 'deliverable/' . $deliverable->guid . '/';
83 83
             }
84
-            catch (midcom_error $e){}
84
+            catch (midcom_error $e) {}
85 85
         }
86 86
         if ($url != '')
87 87
         {
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
                 $invoice = new org_openpsa_invoices_invoice_dba($this->invoice);
101 101
                 $old_sum = $invoice->sum;
102 102
                 self::update_invoice($invoice);
103
-                if (   $old_sum != $invoice->sum
103
+                if ($old_sum != $invoice->sum
104 104
                     && !empty($this->deliverable))
105 105
                 {
106 106
                     $deliverable = new org_openpsa_sales_salesproject_deliverable_dba($this->deliverable);
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         if ($invoiced != $deliverable->invoiced)
153 153
         {
154 154
             $deliverable->invoiced = $invoiced;
155
-            if (   $deliverable->orgOpenpsaObtype !== org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION
155
+            if ($deliverable->orgOpenpsaObtype !== org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION
156 156
                 && $deliverable->state < org_openpsa_sales_salesproject_deliverable_dba::STATE_INVOICED)
157 157
             {
158 158
                 $deliverable->state = org_openpsa_sales_salesproject_deliverable_dba::STATE_INVOICED;
Please login to merge, or discard this patch.
lib/org/openpsa/mypage/viewer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,8 +69,8 @@
 block discarded – undo
69 69
         $query = '__TOPIC_URL:"' . midcom::get()->get_host_name() . '*"';
70 70
         $filter = new midcom_services_indexer_filter_date('__EDITED', $start, 0);
71 71
         $this->_request_data['today'] = $indexer->query($query, $filter);
72
-        $start = mktime(0, 0, 0, date('m'), date('d')-1, date('Y'));
73
-        $end = mktime(23, 59, 59, date('m'), date('d')-1, date('Y'));
72
+        $start = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'));
73
+        $end = mktime(23, 59, 59, date('m'), date('d') - 1, date('Y'));
74 74
         $query = '__TOPIC_URL:"' . midcom::get()->get_host_name() . '*"';
75 75
         $filter = new midcom_services_indexer_filter_date('__EDITED', $start, $end);
76 76
         $this->_request_data['yesterday'] = $indexer->query($query, $filter);
Please login to merge, or discard this patch.
lib/org/openpsa/mypage/workingon.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -125,8 +125,7 @@
 block discarded – undo
125 125
         }
126 126
 
127 127
         // Mark the new task work session as started
128
-        $workingon = array
129
-        (
128
+        $workingon = array(
130 129
             'task' => $task_guid,
131 130
             'description' => $description,
132 131
             'invoiceable' => $invoiceable,
Please login to merge, or discard this patch.
lib/org/openpsa/mypage/handler/today.php 1 patch
Spacing   +6 added lines, -11 removed lines patch added patch discarded remove patch
@@ -15,22 +15,18 @@  discard block
 block discarded – undo
15 15
 {
16 16
     private function _populate_toolbar()
17 17
     {
18
-        $buttons = array
19
-        (
20
-            array
21
-            (
18
+        $buttons = array(
19
+            array(
22 20
                 MIDCOM_TOOLBAR_URL => 'weekreview/' . $this->_request_data['this_day'] . '/',
23 21
                 MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('week review'),
24 22
                 MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/properties.png',
25 23
             ),
26
-            array
27
-            (
24
+            array(
28 25
                 MIDCOM_TOOLBAR_URL => 'day/' . $this->_request_data['prev_day'] . '/',
29 26
                 MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('previous'),
30 27
                 MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/back.png',
31 28
             ),
32
-            array
33
-            (
29
+            array(
34 30
                 MIDCOM_TOOLBAR_URL => 'day/' . $this->_request_data['next_day'] . '/',
35 31
                 MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('next'),
36 32
                 MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/next.png',
@@ -77,10 +73,9 @@  discard block
 block discarded – undo
77 73
         org_openpsa_widgets_calendar::add_head_elements();
78 74
 
79 75
         //set the start-constraints for journal-entries
80
-        $time_span = 7 * 24 * 60 * 60 ; //7 days
76
+        $time_span = 7 * 24 * 60 * 60; //7 days
81 77
 
82
-        $this->_request_data['journal_constraints'] = array
83
-        (
78
+        $this->_request_data['journal_constraints'] = array(
84 79
             //just show entries of current_user
85 80
             array(
86 81
                 'property' => 'metadata.creator',
Please login to merge, or discard this patch.
lib/org/openpsa/mypage/handler/workingon.php 1 patch
Spacing   +4 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@  discard block
 block discarded – undo
30 30
         $task_conf = midcom_helper_datamanager2_widget_autocomplete::get_widget_config('task');
31 31
         $task_conf['id_field'] = 'guid';
32 32
 
33
-        $task_conf['constraints'][] = array
34
-        (
33
+        $task_conf['constraints'][] = array(
35 34
             'field' => 'status',
36 35
             'op'    => '<',
37 36
             'value' => org_openpsa_projects_task_status_dba::COMPLETED,
@@ -65,8 +64,7 @@  discard block
 block discarded – undo
65 64
         $hours = $hours_mc->list_keys();
66 65
 
67 66
         $this->_request_data['customers'] = array();
68
-        $this->_request_data['hours'] = array
69
-        (
67
+        $this->_request_data['hours'] = array(
70 68
             'invoiceable' => array(),
71 69
             'uninvoiceable' => array(),
72 70
             'total_invoiceable' => 0,
@@ -106,7 +104,7 @@  discard block
 block discarded – undo
106 104
                         $customer_label = $customer->official;
107 105
                         $customer = $customer_id;
108 106
                     }
109
-                    catch (midcom_error $e){}
107
+                    catch (midcom_error $e) {}
110 108
                }
111 109
             }
112 110
             $customer_cache[$array['task']] = $customer;
@@ -173,7 +171,7 @@  discard block
 block discarded – undo
173 171
         $workingon = new org_openpsa_mypage_workingon();
174 172
         if (!$workingon->set($_POST['task']))
175 173
         {
176
-            midcom::get()->uimessages->add($this->_l10n->get('org.openpsa.mypage'),  'Failed to set "working on" parameter to "' . $_POST['task'] . '", reason ' . midcom_connection::get_error_string(), 'error');
174
+            midcom::get()->uimessages->add($this->_l10n->get('org.openpsa.mypage'), 'Failed to set "working on" parameter to "' . $_POST['task'] . '", reason ' . midcom_connection::get_error_string(), 'error');
177 175
         }
178 176
 
179 177
         return new midcom_response_relocate($relocate . "workingon/");
Please login to merge, or discard this patch.
lib/org/openpsa/documents/elFinderVolumeOpenpsa.php 1 patch
Spacing   +8 added lines, -9 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
         // elfinder tmp detection doesn't work on OS X
19 19
         $this->tmpPath = midcom::get()->config->get('midcom_tempdir');
20 20
         // elfinder calls exit(), so we need to make sure we write caches
21
-        register_shutdown_function(function(){midcom::get()->finish();});
21
+        register_shutdown_function(function() {midcom::get()->finish(); });
22 22
     }
23 23
 
24 24
 	/**
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 		}
41 41
 
42 42
 		if (($dir = $this->dir($dst)) == false) {
43
-			return $this->setError(elFinder::ERROR_TRGDIR_NOT_FOUND, '#'.$dst);
43
+			return $this->setError(elFinder::ERROR_TRGDIR_NOT_FOUND, '#' . $dst);
44 44
 		}
45 45
 
46 46
 		if (!$dir['write']) {
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
 		if ($file && $file['name'] === $name) { // file exists and check filename for item ID based filesystem
83 83
 			// check POST data `overwrite` for 3rd party uploader
84
-			$overwrite = isset($_POST['overwrite'])? (bool)$_POST['overwrite'] : $this->options['uploadOverwrite'];
84
+			$overwrite = isset($_POST['overwrite']) ? (bool) $_POST['overwrite'] : $this->options['uploadOverwrite'];
85 85
 			if ($overwrite) {
86 86
 				if (!$file['write']) {
87 87
 					return $this->setError(elFinder::ERROR_PERM_DENIED);
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
             $output[] = $object->extra;
281 281
         }
282 282
         $parent = $object->get_parent();
283
-        while (   $parent
283
+        while ($parent
284 284
                && $parent->component == 'org.openpsa.documents')
285 285
         {
286 286
             $output[] = $parent->extra;
@@ -354,8 +354,7 @@  discard block
 block discarded – undo
354 354
         }
355 355
         $object = midcom::get()->dbfactory->get_object_by_guid($path);
356 356
 
357
-        $data = array
358
-        (
357
+        $data = array(
359 358
             'ts' => $object->metadata->revised,
360 359
             'read' => true,
361 360
             'write' => $object->can_do('midgard:update'),
@@ -465,7 +464,7 @@  discard block
 block discarded – undo
465 464
      * @param  string $mode open mode
466 465
      * @return resource|false
467 466
      */
468
-    protected function _fopen($path, $mode="rb")
467
+    protected function _fopen($path, $mode = "rb")
469 468
     {
470 469
         $document = new org_openpsa_documents_document_dba($path);
471 470
         $attachments = org_openpsa_helpers::get_dm2_attachments($document, 'document');
@@ -484,7 +483,7 @@  discard block
 block discarded – undo
484 483
      * @param  string    $path  file path
485 484
      * @return bool
486 485
      */
487
-    protected function _fclose($fp, $path='')
486
+    protected function _fclose($fp, $path = '')
488 487
     {
489 488
         fclose($fp);
490 489
         return true;
@@ -688,7 +687,7 @@  discard block
 block discarded – undo
688 687
     {
689 688
         $filename = midcom_db_attachment::safe_filename($name, true);
690 689
         $att = $doc->create_attachment($filename, $name, $mimetype);
691
-        if (   !$att
690
+        if (!$att
692 691
             || !$att->copy_from_handle($fp))
693 692
         {
694 693
             return false;
Please login to merge, or discard this patch.
lib/org/openpsa/documents/document.php 1 patch
Spacing   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,8 +18,7 @@  discard block
 block discarded – undo
18 18
     public $__midcom_class_name__ = __CLASS__;
19 19
     public $__mgdschema_class_name__ = 'org_openpsa_document';
20 20
 
21
-    public $autodelete_dependents = array
22
-    (
21
+    public $autodelete_dependents = array(
23 22
         'org_openpsa_documents_document_dba' => 'nextVersion'
24 23
     );
25 24
 
@@ -79,7 +78,7 @@  discard block
 block discarded – undo
79 78
             return;
80 79
         }
81 80
         $parent = $this->get_parent();
82
-        if (   $parent
81
+        if ($parent
83 82
             && $parent->component == 'org.openpsa.documents')
84 83
         {
85 84
             midcom::get()->auth->request_sudo('org.openpsa.documents');
@@ -95,7 +94,7 @@  discard block
 block discarded – undo
95 94
 
96 95
     public function get_class()
97 96
     {
98
-        if (   !midcom::get()->auth->user
97
+        if (!midcom::get()->auth->user
99 98
             || empty($this->guid))
100 99
         {
101 100
             return '';
@@ -103,7 +102,7 @@  discard block
 block discarded – undo
103 102
         $person = midcom::get()->auth->user->get_storage();
104 103
         $lastvisited = $person->get_parameter('org.openpsa.documents_visited', $this->guid);
105 104
 
106
-        if (   $lastvisited
105
+        if ($lastvisited
107 106
             && $lastvisited > $this->metadata->revised)
108 107
         {
109 108
             return 'visited';
@@ -201,7 +200,7 @@  discard block
 block discarded – undo
201 200
          * if nothing matched so far and the subtype is alphanumeric, uppercase it on the theory
202 201
          * that it's probably a file extension
203 202
          */
204
-        if (   $parts[1] == $subtype
203
+        if ($parts[1] == $subtype
205 204
             && preg_match('/^[a-z0-9]+$/', $subtype))
206 205
         {
207 206
             $subtype = strtoupper($subtype);
@@ -218,7 +217,7 @@  discard block
 block discarded – undo
218 217
         // Copy current properties
219 218
         foreach ($properties as $key)
220 219
         {
221
-            if (   $key != 'guid'
220
+            if ($key != 'guid'
222 221
                 && $key != 'id'
223 222
                 && $key != 'metadata')
224 223
             {
@@ -263,7 +262,7 @@  discard block
 block discarded – undo
263 262
             $backup_attachment = $backup->create_attachment($original_attachment->name, $original_attachment->title, $original_attachment->mimetype);
264 263
 
265 264
             $original_handle = $original_attachment->open('r');
266
-            if (   !$backup_attachment
265
+            if (!$backup_attachment
267 266
                 || !$original_handle)
268 267
             {
269 268
                 // Failed to copy the attachment, abort
Please login to merge, or discard this patch.
lib/org/openpsa/documents/handler/document/view.php 1 patch
Spacing   +6 added lines, -11 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             $entry['mimetype'] = org_openpsa_documents_document_dba::get_file_type($att->mimetype);
99 99
         }
100 100
 
101
-        $title = '<a class="tab_escape" href="' .$prefix . 'document/' . $document->guid .'/"><img src="' . $icon . '"';
101
+        $title = '<a class="tab_escape" href="' . $prefix . 'document/' . $document->guid . '/"><img src="' . $icon . '"';
102 102
         $title .= 'alt="' . $alt . '" style="border: 0px; height: 16px; vertical-align: middle" /> ' . $document->title . '</a>';
103 103
 
104 104
         $entry['title'] = $title;
@@ -226,8 +226,7 @@  discard block
 block discarded – undo
226 226
         if ($this->_document->can_do('midgard:update'))
227 227
         {
228 228
             $workflow = $this->get_workflow('datamanager2');
229
-            $this->_view_toolbar->add_item($workflow->get_button("document/edit/{$this->_document->guid}/", array
230
-            (
229
+            $this->_view_toolbar->add_item($workflow->get_button("document/edit/{$this->_document->guid}/", array(
231 230
                 MIDCOM_TOOLBAR_ACCESSKEY => 'e',
232 231
             )));
233 232
         }
@@ -291,10 +290,8 @@  discard block
 block discarded – undo
291 290
 
292 291
         if ($next_version)
293 292
         {
294
-            $this->_view_toolbar->add_item
295
-            (
296
-                array
297
-                (
293
+            $this->_view_toolbar->add_item(
294
+                array(
298 295
                     MIDCOM_TOOLBAR_URL => "document/{$next_version->guid}/",
299 296
                     MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('next version'),
300 297
                     MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/up.png',
@@ -303,10 +300,8 @@  discard block
 block discarded – undo
303 300
         }
304 301
         if ($previous_version)
305 302
         {
306
-            $this->_view_toolbar->add_item
307
-            (
308
-                array
309
-                (
303
+            $this->_view_toolbar->add_item(
304
+                array(
310 305
                     MIDCOM_TOOLBAR_URL => "document/{$previous_version->guid}/",
311 306
                     MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('previous version'),
312 307
                     MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/down.png',
Please login to merge, or discard this patch.