@@ -113,7 +113,8 @@ |
||
| 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 | } |
@@ -159,7 +159,8 @@ |
||
| 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 | } |
@@ -79,11 +79,11 @@ discard block |
||
| 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 |
||
| 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']; |
@@ -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($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 |
||
| 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; |
@@ -415,7 +415,7 @@ discard block |
||
| 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 | |
@@ -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()); |
@@ -48,7 +48,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -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; |
@@ -69,7 +69,8 @@ |
||
| 69 | 69 | if (empty(self::$_seen[$company_id])) { |
| 70 | 70 | try { |
| 71 | 71 | $company = new org_openpsa_contacts_group_dba($company_id); |
| 72 | - } catch (midcom_error $e) { |
|
| 72 | + } |
|
| 73 | + catch (midcom_error $e) { |
|
| 73 | 74 | return; |
| 74 | 75 | } |
| 75 | 76 | self::$_seen[$company->id] = true; |
@@ -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 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | private function read_object($person) |
| 138 | 138 | { |
| 139 | - if ( !is_object($person) |
|
| 139 | + if (!is_object($person) |
|
| 140 | 140 | || !$person instanceof midcom_db_person) { |
| 141 | 141 | // Given $person is not one |
| 142 | 142 | return false; |
@@ -160,12 +160,12 @@ discard block |
||
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - if ( $this->_config->get('jabber_enable_presence') |
|
| 163 | + if ($this->_config->get('jabber_enable_presence') |
|
| 164 | 164 | && $person->get_parameter('org.openpsa.jabber', 'jid')) { |
| 165 | 165 | $this->contact_details['jid'] = $person->get_parameter('org.openpsa.jabber', 'jid'); |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - if ( $this->_config->get('skype_enable_presence') |
|
| 168 | + if ($this->_config->get('skype_enable_presence') |
|
| 169 | 169 | && $person->get_parameter('org.openpsa.skype', 'name')) { |
| 170 | 170 | $this->contact_details['skype'] = $person->get_parameter('org.openpsa.skype', 'name'); |
| 171 | 171 | } |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | if (!empty($attachments[$type])) { |
| 205 | 205 | return '<img class="photo" src="' . midcom_db_attachment::get_url($attachments[$type]) . '">'; |
| 206 | 206 | } |
| 207 | - if ( $this->_config->get('gravatar_enable') |
|
| 207 | + if ($this->_config->get('gravatar_enable') |
|
| 208 | 208 | && !empty($this->contact_details['email'])) { |
| 209 | 209 | $size = ($type == 'view') ? 500 : 32; |
| 210 | 210 | $gravatar_url = "https://www.gravatar.com/avatar/" . md5(strtolower(trim($this->contact_details['email']))) . "?s=" . $size . '&d=identicon'; |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | |
| 315 | 315 | private function _show_groups() |
| 316 | 316 | { |
| 317 | - if ( !$this->show_groups |
|
| 317 | + if (!$this->show_groups |
|
| 318 | 318 | || empty($this->contact_details['id'])) { |
| 319 | 319 | return; |
| 320 | 320 | } |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | $default_shown = true; |
| 380 | 380 | $cards_to_show[] = $cardname; |
| 381 | 381 | } |
| 382 | - } elseif ( $customer->$property |
|
| 382 | + } elseif ($customer->$property |
|
| 383 | 383 | || ($customer->street && !$inherited_cards_only && !$default_shown)) { |
| 384 | 384 | $inherited_cards_only = false; |
| 385 | 385 | $multiple_addresses = true; |
@@ -400,8 +400,8 @@ discard block |
||
| 400 | 400 | |
| 401 | 401 | foreach ($cards_to_show as $cardname) { |
| 402 | 402 | echo '<div class="vcard">'; |
| 403 | - if ( $multiple_addresses |
|
| 404 | - || ( $cardname != 'visiting' |
|
| 403 | + if ($multiple_addresses |
|
| 404 | + || ($cardname != 'visiting' |
|
| 405 | 405 | && !$inherited_cards_only)) { |
| 406 | 406 | echo '<div style="text-align:center"><em>' . midcom::get()->i18n->get_string($cardname . ' address', 'org.openpsa.contacts') . "</em></div>\n"; |
| 407 | 407 | } |
@@ -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 | } |