Completed
Pull Request — master (#194)
by
unknown
15:06
created
lib/org/openpsa/invoices/scheduler.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -126,7 +126,8 @@
 block discarded – undo
126 126
         $salesproject = org_openpsa_sales_salesproject_dba::get_cached($this->_deliverable->salesproject);
127 127
         try {
128 128
             $owner = midcom_db_person::get_cached($salesproject->owner);
129
-        } catch (midcom_error $e) {
129
+        }
130
+        catch (midcom_error $e) {
130 131
             $e->log();
131 132
             return;
132 133
         }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         }
95 95
 
96 96
         // TODO: Warehouse management: create new order
97
-        if (   $this->_deliverable->end < $next_cycle_start
97
+        if ($this->_deliverable->end < $next_cycle_start
98 98
             && $this->_deliverable->end != 0) {
99 99
             debug_add('Do not register next cycle, the contract ends before');
100 100
             return $this->_deliverable->end_subscription();
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 
314 314
         //If previous cycle was run at the end of the month, the new one should be at the end of the month as well
315 315
         $date = new DateTime(gmdate('Y-m-d', $time), new DateTimeZone('GMT'));
316
-        if (   $date->format('t') == $date->format('j')
316
+        if ($date->format('t') == $date->format('j')
317 317
             && $new_date->format('t') != $new_date->format('j')) {
318 318
             $new_date->setDate((int) $new_date->format('Y'), (int) $new_date->format('m'), (int) $new_date->format('t'));
319 319
         }
@@ -373,11 +373,11 @@  discard block
 block discarded – undo
373 373
                 break;
374 374
             case 'q':
375 375
                 // Quarterly recurring subscription
376
-                $identifier = ceil(((int)$date->format('n')) / 4) . 'Q' . $date->format('y');
376
+                $identifier = ceil(((int) $date->format('n')) / 4) . 'Q' . $date->format('y');
377 377
                 break;
378 378
             case 'hy':
379 379
                 // Half-yearly recurring subscription
380
-                $identifier = ceil(((int)$date->format('n')) / 6) . '/' . $date->format('Y');
380
+                $identifier = ceil(((int) $date->format('n')) / 6) . '/' . $date->format('Y');
381 381
                 break;
382 382
             case 'y':
383 383
                 // Yearly recurring subscription
Please login to merge, or discard this patch.
lib/org/openpsa/sales/midcom/interfaces.php 2 patches
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -134,7 +134,8 @@  discard block
 block discarded – undo
134 134
 
135 135
         try {
136 136
             $deliverable = new org_openpsa_sales_salesproject_deliverable_dba($args['deliverable']);
137
-        } catch (midcom_error $e) {
137
+        }
138
+        catch (midcom_error $e) {
138 139
             $handler->print_error("Deliverable {$args['deliverable']} not found: " . midcom_connection::get_error_string());
139 140
             return false;
140 141
         }
@@ -158,7 +159,8 @@  discard block
 block discarded – undo
158 159
         }
159 160
         try {
160 161
             $deliverable = new org_openpsa_sales_salesproject_deliverable_dba($args['deliverable']);
161
-        } catch (midcom_error $e) {
162
+        }
163
+        catch (midcom_error $e) {
162 164
             $handler->print_error('no deliverable with passed GUID: ' . $args['deliverable'] . ', aborting');
163 165
             return false;
164 166
         }
@@ -166,7 +168,8 @@  discard block
 block discarded – undo
166 168
         //get the owner of the salesproject the deliverable belongs to
167 169
         try {
168 170
             $project = new org_openpsa_sales_salesproject_dba($deliverable->salesproject);
169
-        } catch (midcom_error $e) {
171
+        }
172
+        catch (midcom_error $e) {
170 173
             $handler->print_error('Failed to load salesproject: ' . $e->getMessage());
171 174
             return false;
172 175
         }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      */
53 53
     private function _find_suspects_event(midcom_core_dbaobject $object, org_openpsa_relatedto_dba $defaults, array &$links_array)
54 54
     {
55
-        if (   !is_array($object->participants)
55
+        if (!is_array($object->participants)
56 56
             || count($object->participants) < 2) {
57 57
             //We have invalid list or less than two participants, abort
58 58
             return;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      */
125 125
     public function new_subscription_cycle(array $args, midcom_baseclasses_components_cron_handler $handler)
126 126
     {
127
-        if (   !isset($args['deliverable'])
127
+        if (!isset($args['deliverable'])
128 128
             || !isset($args['cycle'])) {
129 129
             $handler->print_error('deliverable GUID or cycle number not set, aborting');
130 130
             return false;
Please login to merge, or discard this patch.
lib/org/openpsa/sales/handler/deliverable/view.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,8 @@
 block discarded – undo
51 51
         }
52 52
         try {
53 53
             $this->_request_data['product'] = org_openpsa_products_product_dba::get_cached($this->_deliverable->product);
54
-        } catch (midcom_error $e) {
54
+        }
55
+        catch (midcom_error $e) {
55 56
             $this->_request_data['product'] = false;
56 57
         }
57 58
     }
Please login to merge, or discard this patch.
lib/org/openpsa/sales/handler/list.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,8 @@
 block discarded – undo
113 113
         try {
114 114
             $this->_request_data['customer'] = new org_openpsa_contacts_group_dba($guid);
115 115
             $qb->add_constraint('customer', '=', $this->_request_data['customer']->id);
116
-        } catch (midcom_error $e) {
116
+        }
117
+        catch (midcom_error $e) {
117 118
             $this->_request_data['customer'] = new org_openpsa_contacts_person_dba($guid);
118 119
             $qb->add_constraint('customerContact', '=', $this->_request_data['customer']->id);
119 120
         }
Please login to merge, or discard this patch.
lib/org/openpsa/contacts/midcom/interfaces.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -159,7 +159,8 @@
 block discarded – undo
159 159
 
160 160
         try {
161 161
             $object = new $classname($guid);
162
-        } catch (midcom_error $e) {
162
+        }
163
+        catch (midcom_error $e) {
163 164
             $handler->print_error($type . " {$guid} not found, error " . $e->getMessage());
164 165
             return false;
165 166
         }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -79,11 +79,11 @@  discard block
 block discarded – undo
79 79
 
80 80
     public function resolve_object_link(midcom_db_topic $topic, midcom_core_dbaobject $object)
81 81
     {
82
-        if (   $object instanceof org_openpsa_contacts_group_dba
82
+        if ($object instanceof org_openpsa_contacts_group_dba
83 83
             || $object instanceof midcom_db_group) {
84 84
             return "group/{$object->guid}/";
85 85
         }
86
-        if (   $object instanceof org_openpsa_contacts_person_dba
86
+        if ($object instanceof org_openpsa_contacts_person_dba
87 87
             || $object instanceof midcom_db_person) {
88 88
             return "person/{$object->guid}/";
89 89
         }
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
             // We have a feed URL, but we should check if it is GeoRSS as well
113 113
             $items = net_nemein_rss_fetch::raw_fetch($data['rss_url'])->get_items();
114 114
 
115
-            if (   !empty($items)
116
-                && (   $items[0]->get_latitude()
115
+            if (!empty($items)
116
+                && ($items[0]->get_latitude()
117 117
                     || $items[0]->get_longitude())) {
118 118
                 // This is a GeoRSS feed
119 119
                 $data['georss_url'] = $data['rss_url'];
Please login to merge, or discard this patch.
lib/org/openpsa/contacts/handler/person/view.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -216,7 +216,8 @@
 block discarded – undo
216 216
         foreach ($this->_request_data[$identifier] as $member) {
217 217
             try {
218 218
                 $this->_request_data['group'] = org_openpsa_contacts_group_dba::get_cached($member->gid);
219
-            } catch (midcom_error $e) {
219
+            }
220
+            catch (midcom_error $e) {
220 221
                 $e->log();
221 222
                 continue;
222 223
             }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         $invoices_url = $siteconfig->get_node_full_url('org.openpsa.invoices');
118 118
         $user_url = $siteconfig->get_node_full_url('org.openpsa.user');
119 119
 
120
-        if (   $invoices_url
120
+        if ($invoices_url
121 121
             && midcom::get()->auth->can_user_do('midgard:create', null, org_openpsa_invoices_invoice_dba::class)
122 122
             && $this->_contact->can_do('midgard:update')) {
123 123
             $buttons[] = $workflow->get_button($invoices_url . "billingdata/" . $this->_contact->guid . '/', [
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
             ]);
127 127
         }
128 128
 
129
-        if (   $user_url
130
-            && (   midcom_connection::get_user() == $this->_contact->id
129
+        if ($user_url
130
+            && (midcom_connection::get_user() == $this->_contact->id
131 131
                 || midcom::get()->auth->can_user_do('org.openpsa.user:access', null, org_openpsa_user_interface::class))) {
132 132
             $buttons[] = [
133 133
                 MIDCOM_TOOLBAR_URL => $user_url . "view/{$this->_contact->guid}/",
Please login to merge, or discard this patch.
lib/org/openpsa/contacts/duplicates/check.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -382,7 +382,8 @@
 block discarded – undo
382 382
             try {
383 383
                 $obj1 = $class::get_cached($arr1['guid']);
384 384
                 $obj2 = $class::get_cached($arr2['guid']);
385
-            } catch (midcom_error $e) {
385
+            }
386
+            catch (midcom_error $e) {
386 387
                 $e->log();
387 388
                 continue;
388 389
             }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
             // if user's lastname is part of the email address, check to see if the difference is only in the domain part
129 129
             $email1 = preg_replace('/@.+/', '', $person1['email']);
130 130
             $email2 = preg_replace('/@.+/', '', $person2['email']);
131
-            if (   strpos($email1, $person1['lastname']) !== false
131
+            if (strpos($email1, $person1['lastname']) !== false
132 132
                 && $email1 == $email2) {
133 133
                 $ret['email_match'] = true;
134 134
                 $ret['p'] += 0.5;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 
175 175
     private function match($property, array $data1, array $data2)
176 176
     {
177
-        if (   !empty($data1[$property])
177
+        if (!empty($data1[$property])
178 178
             && $data1[$property] == $data2[$property]) {
179 179
             return true;
180 180
         }
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
         $persons = $this->get_person_candidates();
326 326
 
327 327
         $params = [];
328
-        $params['objects'] =& $persons;
328
+        $params['objects'] = & $persons;
329 329
         $params['mode'] = 'person';
330 330
 
331 331
         array_walk($persons, [$this, 'check_all_arraywalk'], $params);
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
                 continue;
388 388
             }
389 389
 
390
-            if (   $obj1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $obj2->guid)
390
+            if ($obj1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $obj2->guid)
391 391
                 || $obj2->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $obj1->guid)) {
392 392
                 // Not-duplicate parameter found, returning zero probability
393 393
                 continue;
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 
416 416
         $groups = $this->get_group_candidates();
417 417
         $params = [];
418
-        $params['objects'] =& $groups;
418
+        $params['objects'] = & $groups;
419 419
         $params['mode'] = 'group';
420 420
         array_walk($groups, [$this, 'check_all_arraywalk'], $params);
421 421
 
Please login to merge, or discard this patch.
lib/org/openpsa/reports/handler/invoices/report.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -114,7 +114,8 @@
 block discarded – undo
114 114
                         && $deliverable->end > $this->_request_data['start'])) {
115 115
                     $invoices = array_merge($invoices, $this->_get_invoices_for_subscription($deliverable, $at_entry));
116 116
                 }
117
-            } catch (midcom_error $e) {
117
+            }
118
+            catch (midcom_error $e) {
118 119
             }
119 120
         }
120 121
         $invoices = array_merge($invoices, $this->_get_deliverable_invoices());
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
     private function _get_invoices_for_subscription($deliverable, $at_entry)
50 50
     {
51
-        if (   $deliverable->invoiceByActualUnits
51
+        if ($deliverable->invoiceByActualUnits
52 52
             && $at_entry->arguments['cycle'] > 1) {
53 53
             $invoice_sum = $deliverable->invoiced / ($at_entry->arguments['cycle'] - 1);
54 54
             if ($invoice_sum == 0) {
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
         $time = $at_entry->start;
65 65
         $scheduler = new org_openpsa_invoices_scheduler($deliverable);
66 66
 
67
-        while (   $time < $this->_request_data['end']
68
-               && (   $time < $deliverable->end
67
+        while ($time < $this->_request_data['end']
68
+               && ($time < $deliverable->end
69 69
                    || $deliverable->continuous)) {
70 70
             $invoices[] = $this->get_invoice_for_deliverable($deliverable, $invoice_sum, $time, $calculation_base);
71 71
 
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
         foreach ($qb->execute() as $at_entry) {
108 108
             try {
109 109
                 $deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($at_entry->arguments['deliverable']);
110
-                if (   $deliverable->continuous
111
-                    || (   $deliverable->start < $this->_request_data['end']
110
+                if ($deliverable->continuous
111
+                    || ($deliverable->start < $this->_request_data['end']
112 112
                         && $deliverable->end > $this->_request_data['start'])) {
113 113
                     $invoices = array_merge($invoices, $this->_get_invoices_for_subscription($deliverable, $at_entry));
114 114
                 }
Please login to merge, or discard this patch.
lib/org/openpsa/reports/handler/sales/report.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,8 @@
 block discarded – undo
71 71
             $owner = org_openpsa_contacts_person_dba::get_cached($salesproject->owner);
72 72
             $row['index_owner'] = $owner->name;
73 73
             $row['owner'] = org_openpsa_widgets_contact::get($owner->guid)->show_inline();
74
-        } catch (midcom_error $e) {
74
+        }
75
+        catch (midcom_error $e) {
75 76
             $e->log();
76 77
         }
77 78
         $row['amount'] = $object->pricePerUnit * $object->units;
Please login to merge, or discard this patch.