@@ -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 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | private function read_object($person) |
| 134 | 134 | { |
| 135 | - if ( !is_object($person) |
|
| 135 | + if (!is_object($person) |
|
| 136 | 136 | || !$person instanceof midcom_db_person) { |
| 137 | 137 | // Given $person is not one |
| 138 | 138 | return false; |
@@ -156,12 +156,12 @@ discard block |
||
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - if ( $this->_config->get('jabber_enable_presence') |
|
| 159 | + if ($this->_config->get('jabber_enable_presence') |
|
| 160 | 160 | && $person->get_parameter('org.openpsa.jabber', 'jid')) { |
| 161 | 161 | $this->contact_details['jid'] = $person->get_parameter('org.openpsa.jabber', 'jid'); |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - if ( $this->_config->get('skype_enable_presence') |
|
| 164 | + if ($this->_config->get('skype_enable_presence') |
|
| 165 | 165 | && $person->get_parameter('org.openpsa.skype', 'name')) { |
| 166 | 166 | $this->contact_details['skype'] = $person->get_parameter('org.openpsa.skype', 'name'); |
| 167 | 167 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | // Show picture |
| 238 | 238 | // TODO: Implement photo also in local way |
| 239 | - if ( $this->_config->get('gravatar_enable') |
|
| 239 | + if ($this->_config->get('gravatar_enable') |
|
| 240 | 240 | && !empty($this->contact_details['email'])) { |
| 241 | 241 | $size = $this->_config->get('gravatar_size'); |
| 242 | 242 | $gravatar_url = "http://www.gravatar.com/avatar.php?gravatar_id=" . md5($this->contact_details['email']) . "&size=" . $size; |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | |
| 311 | 311 | private function _show_groups() |
| 312 | 312 | { |
| 313 | - if ( !$this->show_groups |
|
| 313 | + if (!$this->show_groups |
|
| 314 | 314 | || empty($this->contact_details['id'])) { |
| 315 | 315 | return; |
| 316 | 316 | } |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | $cards_to_show[] = $cardname; |
| 377 | 377 | } |
| 378 | 378 | } else { |
| 379 | - if ( $customer->$property |
|
| 379 | + if ($customer->$property |
|
| 380 | 380 | || ($customer->street && !$inherited_cards_only && !$default_shown)) { |
| 381 | 381 | $inherited_cards_only = false; |
| 382 | 382 | $multiple_addresses = true; |
@@ -398,8 +398,8 @@ discard block |
||
| 398 | 398 | |
| 399 | 399 | foreach ($cards_to_show as $cardname) { |
| 400 | 400 | echo '<div class="vcard">'; |
| 401 | - if ( $multiple_addresses |
|
| 402 | - || ( $cardname != 'visiting' |
|
| 401 | + if ($multiple_addresses |
|
| 402 | + || ($cardname != 'visiting' |
|
| 403 | 403 | && !$inherited_cards_only)) { |
| 404 | 404 | echo '<div style="text-align:center"><em>' . midcom::get()->i18n->get_string($cardname . ' address', 'org.openpsa.contacts') . "</em></div>\n"; |
| 405 | 405 | } |
@@ -163,7 +163,8 @@ |
||
| 163 | 163 | try { |
| 164 | 164 | $task = org_openpsa_projects_task_dba::get_cached($hour_report->task); |
| 165 | 165 | $options['success_url'] = 'hours/task/' . $task->guid . '/'; |
| 166 | - } catch (midcom_error $e) { |
|
| 166 | + } |
|
| 167 | + catch (midcom_error $e) { |
|
| 167 | 168 | $e->log(); |
| 168 | 169 | } |
| 169 | 170 | return $this->get_workflow('delete', $options)->run(); |
@@ -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 | } |
@@ -132,7 +132,8 @@ |
||
| 132 | 132 | } elseif ((int) $args[0] > 0) { |
| 133 | 133 | try { |
| 134 | 134 | $this->parent = new org_openpsa_products_product_group_dba((int) $args[0]); |
| 135 | - } catch (midcom_error $e) { |
|
| 135 | + } |
|
| 136 | + catch (midcom_error $e) { |
|
| 136 | 137 | $e->log(); |
| 137 | 138 | } |
| 138 | 139 | } |
@@ -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, $class, $person_property) |
| 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'] == '<>') { |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | $ret = []; |
| 391 | 391 | |
| 392 | 392 | foreach ($object->get_properties() as $property) { |
| 393 | - if ( preg_match('/^_/', $property) |
|
| 393 | + if (preg_match('/^_/', $property) |
|
| 394 | 394 | || in_array($property, $skip_properties) |
| 395 | 395 | || property_exists($object, $property)) { |
| 396 | 396 | // 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 |
@@ -59,7 +59,8 @@ discard block |
||
| 59 | 59 | { |
| 60 | 60 | try { |
| 61 | 61 | $person = new org_openpsa_contacts_person_dba($member->person); |
| 62 | - } catch (midcom_error $e) { |
|
| 62 | + } |
|
| 63 | + catch (midcom_error $e) { |
|
| 63 | 64 | $e->log(); |
| 64 | 65 | return; |
| 65 | 66 | } |
@@ -82,7 +83,8 @@ discard block |
||
| 82 | 83 | $row['organization_member'] = $membership; |
| 83 | 84 | try { |
| 84 | 85 | $row['organization'] = org_openpsa_contacts_group_dba::get_cached($membership->gid); |
| 85 | - } catch (midcom_error $e) { |
|
| 86 | + } |
|
| 87 | + catch (midcom_error $e) { |
|
| 86 | 88 | debug_add("Error fetching org_openpsa_contacts_group_dba #{$membership->gid}, skipping", MIDCOM_LOG_WARN); |
| 87 | 89 | continue; |
| 88 | 90 | } |