@@ -216,7 +216,8 @@ |
||
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 | } |
@@ -117,7 +117,7 @@ discard block |
||
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 |
||
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}/", |
@@ -382,7 +382,8 @@ |
||
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 | } |
@@ -128,7 +128,7 @@ discard block |
||
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 |
||
174 | 174 | |
175 | 175 | private function match(string $property, array $data1, array $data2) : bool |
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 |
||
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 |
||
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; |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | |
415 | 415 | $groups = $this->get_group_candidates(); |
416 | 416 | $params = []; |
417 | - $params['objects'] =& $groups; |
|
417 | + $params['objects'] = & $groups; |
|
418 | 418 | $params['mode'] = 'group'; |
419 | 419 | array_walk($groups, [$this, 'check_all_arraywalk'], $params); |
420 | 420 |
@@ -114,7 +114,8 @@ |
||
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()); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | private function _get_invoices_for_subscription(org_openpsa_sales_salesproject_deliverable_dba $deliverable, midcom_services_at_entry_dba $at_entry) : array |
66 | 66 | { |
67 | - if ( $deliverable->invoiceByActualUnits |
|
67 | + if ($deliverable->invoiceByActualUnits |
|
68 | 68 | && $at_entry->arguments['cycle'] > 1) { |
69 | 69 | $invoice_sum = $deliverable->invoiced / ($at_entry->arguments['cycle'] - 1); |
70 | 70 | if ($invoice_sum == 0) { |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | $time = $at_entry->start; |
81 | 81 | $scheduler = new org_openpsa_invoices_scheduler($deliverable); |
82 | 82 | |
83 | - while ( $time < $this->_request_data['end'] |
|
84 | - && ( $time < $deliverable->end |
|
83 | + while ($time < $this->_request_data['end'] |
|
84 | + && ($time < $deliverable->end |
|
85 | 85 | || $deliverable->continuous)) { |
86 | 86 | $invoices[] = $this->get_invoice_for_deliverable($deliverable, $invoice_sum, $time, $calculation_base); |
87 | 87 | |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | foreach ($qb->execute() as $at_entry) { |
124 | 124 | try { |
125 | 125 | $deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($at_entry->arguments['deliverable']); |
126 | - if ( $deliverable->continuous |
|
127 | - || ( $deliverable->start < $this->_request_data['end'] |
|
126 | + if ($deliverable->continuous |
|
127 | + || ($deliverable->start < $this->_request_data['end'] |
|
128 | 128 | && $deliverable->end > $this->_request_data['start'])) { |
129 | 129 | $invoices = array_merge($invoices, $this->_get_invoices_for_subscription($deliverable, $at_entry)); |
130 | 130 | } |
@@ -71,7 +71,8 @@ |
||
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; |
@@ -114,7 +114,8 @@ discard block |
||
114 | 114 | |
115 | 115 | try { |
116 | 116 | $person = org_openpsa_contacts_person_dba::get_cached($src); |
117 | - } catch (midcom_error $e) { |
|
117 | + } |
|
118 | + catch (midcom_error $e) { |
|
118 | 119 | $widget = new self(); |
119 | 120 | $cache[$src] = $widget; |
120 | 121 | return $widget; |
@@ -323,7 +324,8 @@ discard block |
||
323 | 324 | foreach ($memberships as $data) { |
324 | 325 | try { |
325 | 326 | $group = org_openpsa_contacts_group_dba::get_cached($data['gid']); |
326 | - } catch (midcom_error $e) { |
|
327 | + } |
|
328 | + catch (midcom_error $e) { |
|
327 | 329 | $e->log(); |
328 | 330 | continue; |
329 | 331 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | private function read_object($person) : bool |
142 | 142 | { |
143 | - if ( !is_object($person) |
|
143 | + if (!is_object($person) |
|
144 | 144 | || !$person instanceof midcom_db_person) { |
145 | 145 | // Given $person is not one |
146 | 146 | return false; |
@@ -164,12 +164,12 @@ discard block |
||
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
167 | - if ( $this->_config->get('jabber_enable_presence') |
|
167 | + if ($this->_config->get('jabber_enable_presence') |
|
168 | 168 | && $person->get_parameter('org.openpsa.jabber', 'jid')) { |
169 | 169 | $this->contact_details['jid'] = $person->get_parameter('org.openpsa.jabber', 'jid'); |
170 | 170 | } |
171 | 171 | |
172 | - if ( $this->_config->get('skype_enable_presence') |
|
172 | + if ($this->_config->get('skype_enable_presence') |
|
173 | 173 | && $person->get_parameter('org.openpsa.skype', 'name')) { |
174 | 174 | $this->contact_details['skype'] = $person->get_parameter('org.openpsa.skype', 'name'); |
175 | 175 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | if (!empty($attachments[$type])) { |
209 | 209 | return '<img class="photo" src="' . midcom_db_attachment::get_url($attachments[$type]) . '">'; |
210 | 210 | } |
211 | - if ( $this->_config->get('gravatar_enable') |
|
211 | + if ($this->_config->get('gravatar_enable') |
|
212 | 212 | && !empty($this->contact_details['email'])) { |
213 | 213 | $size = ($type == 'view') ? 500 : 32; |
214 | 214 | $gravatar_url = "https://www.gravatar.com/avatar/" . md5(strtolower(trim($this->contact_details['email']))) . "?s=" . $size . '&d=identicon'; |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | |
321 | 321 | private function _show_groups() |
322 | 322 | { |
323 | - if ( !$this->show_groups |
|
323 | + if (!$this->show_groups |
|
324 | 324 | || empty($this->contact_details['id'])) { |
325 | 325 | return; |
326 | 326 | } |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | $default_shown = true; |
386 | 386 | $cards_to_show[] = $cardname; |
387 | 387 | } |
388 | - } elseif ( $customer->$property |
|
388 | + } elseif ($customer->$property |
|
389 | 389 | || ($customer->street && !$inherited_cards_only && !$default_shown)) { |
390 | 390 | $inherited_cards_only = false; |
391 | 391 | $multiple_addresses = true; |
@@ -406,8 +406,8 @@ discard block |
||
406 | 406 | |
407 | 407 | foreach ($cards_to_show as $cardname) { |
408 | 408 | echo '<div class="vcard">'; |
409 | - if ( $multiple_addresses |
|
410 | - || ( $cardname != 'visiting' |
|
409 | + if ($multiple_addresses |
|
410 | + || ($cardname != 'visiting' |
|
411 | 411 | && !$inherited_cards_only)) { |
412 | 412 | echo '<div style="text-align:center"><em>' . midcom::get()->i18n->get_string($cardname . ' address', 'org.openpsa.contacts') . "</em></div>\n"; |
413 | 413 | } |
@@ -50,7 +50,7 @@ |
||
50 | 50 | */ |
51 | 51 | public function _on_reindex($topic, $config, &$indexer) |
52 | 52 | { |
53 | - if ( !$config->get('index_products') |
|
53 | + if (!$config->get('index_products') |
|
54 | 54 | && !$config->get('index_groups')) { |
55 | 55 | debug_add("No indexing to groups and products, skipping", MIDCOM_LOG_WARN); |
56 | 56 | return true; |
@@ -83,7 +83,8 @@ discard block |
||
83 | 83 | try { |
84 | 84 | $dms['group']->set_storage($group); |
85 | 85 | org_openpsa_products_viewer::index($dms['group'], $indexer, $topic, $config); |
86 | - } catch (midcom_error $e) { |
|
86 | + } |
|
87 | + catch (midcom_error $e) { |
|
87 | 88 | $e->log(MIDCOM_LOG_WARN); |
88 | 89 | } |
89 | 90 | } |
@@ -96,7 +97,8 @@ discard block |
||
96 | 97 | try { |
97 | 98 | $dms['product']->set_storage($product); |
98 | 99 | org_openpsa_products_viewer::index($dms['product'], $indexer, $topic, $config); |
99 | - } catch (midcom_error $e) { |
|
100 | + } |
|
101 | + catch (midcom_error $e) { |
|
100 | 102 | $e->log(MIDCOM_LOG_WARN); |
101 | 103 | } |
102 | 104 | } |
@@ -57,7 +57,8 @@ discard block |
||
57 | 57 | try { |
58 | 58 | midcom::get()->dynamic_load($batch_url); |
59 | 59 | $ret = true; |
60 | - } catch (midcom_error $e) { |
|
60 | + } |
|
61 | + catch (midcom_error $e) { |
|
61 | 62 | $ret = $e->getMessage(); |
62 | 63 | } |
63 | 64 | ob_end_clean(); |
@@ -83,7 +84,8 @@ discard block |
||
83 | 84 | midcom::get()->auth->request_sudo($this->_component); |
84 | 85 | try { |
85 | 86 | $campaign = new org_openpsa_directmarketing_campaign_dba($args['campaign_guid']); |
86 | - } catch (midcom_error $e) { |
|
87 | + } |
|
88 | + catch (midcom_error $e) { |
|
87 | 89 | $handler->print_error("{$args['campaign_guid']} is not a valid campaign GUID"); |
88 | 90 | return false; |
89 | 91 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | public function _on_watched_dba_delete(midcom_core_dbaobject $object) |
18 | 18 | { |
19 | 19 | $qb = org_openpsa_directmarketing_campaign_member_dba::new_query_builder(); |
20 | - if ( $object instanceof midcom_db_person |
|
20 | + if ($object instanceof midcom_db_person |
|
21 | 21 | || $object instanceof org_openpsa_contacts_person_dba) { |
22 | 22 | $qb->add_constraint('person', '=', $object->id); |
23 | 23 | } elseif ($object instanceof org_openpsa_directmarketing_campaign_dba) { |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function background_send_message(array $args, midcom_baseclasses_components_cron_handler $handler) |
44 | 44 | { |
45 | - if ( !isset($args['url_base']) |
|
45 | + if (!isset($args['url_base']) |
|
46 | 46 | || !isset($args['batch'])) { |
47 | 47 | $handler->print_error('url_base or batch number not set, aborting'); |
48 | 48 | return false; |
@@ -269,7 +269,8 @@ |
||
269 | 269 | $guid = $mc_parameter->get_subkey($parameter_key, 'parentguid'); |
270 | 270 | try { |
271 | 271 | $parent = midcom::get()->dbfactory->get_object_by_guid($guid); |
272 | - } catch (midcom_error $e) { |
|
272 | + } |
|
273 | + catch (midcom_error $e) { |
|
273 | 274 | $e->log(); |
274 | 275 | continue; |
275 | 276 | } |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | */ |
314 | 314 | private function add_misc_rule(array $rule, string $class, string $person_property) : bool |
315 | 315 | { |
316 | - $persons = [ 0 => -1]; |
|
316 | + $persons = [0 => -1]; |
|
317 | 317 | $match = $rule['match']; |
318 | 318 | $constraint_match = "IN"; |
319 | 319 | if ($rule['match'] == '<>') { |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | $ret = []; |
390 | 390 | |
391 | 391 | foreach ($object->get_properties() as $property) { |
392 | - if ( preg_match('/^_/', $property) |
|
392 | + if (preg_match('/^_/', $property) |
|
393 | 393 | || in_array($property, $skip_properties) |
394 | 394 | || property_exists($object, $property)) { |
395 | 395 | // Skip private or otherwise invalid properties |
@@ -151,7 +151,7 @@ |
||
151 | 151 | return; |
152 | 152 | } |
153 | 153 | foreach ($parameters as $param_data) { |
154 | - if ( empty($param_data['domain']) |
|
154 | + if (empty($param_data['domain']) |
|
155 | 155 | || empty($param_data['name']) |
156 | 156 | || empty($param_data['value'])) { |
157 | 157 | // TODO: Log warning |