@@ -51,7 +51,8 @@ discard block |
||
| 51 | 51 | try { |
| 52 | 52 | $deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($task->get_agreement()); |
| 53 | 53 | $item->deliverable = $deliverable->id; |
| 54 | - } catch (midcom_error $e) { |
|
| 54 | + } |
|
| 55 | + catch (midcom_error $e) { |
|
| 55 | 56 | $e->log(); |
| 56 | 57 | } |
| 57 | 58 | $item->invoice = $invoice->id; |
@@ -133,7 +134,8 @@ discard block |
||
| 133 | 134 | $customer = org_openpsa_contacts_group_dba::get_cached($customer_id); |
| 134 | 135 | $data['customer_label'] = $customer->official; |
| 135 | 136 | $data['disabled'] = ''; |
| 136 | - } catch (midcom_error $e) { |
|
| 137 | + } |
|
| 138 | + catch (midcom_error $e) { |
|
| 137 | 139 | $data['customer_label'] = $this->_l10n->get('no customer'); |
| 138 | 140 | $data['disabled'] = ' disabled="disabled"'; |
| 139 | 141 | } |
@@ -156,7 +158,8 @@ discard block |
||
| 156 | 158 | } else { |
| 157 | 159 | $data['invoiceable_units'] = $task->plannedHours; |
| 158 | 160 | } |
| 159 | - } catch (midcom_error $e) { |
|
| 161 | + } |
|
| 162 | + catch (midcom_error $e) { |
|
| 160 | 163 | $e->log(); |
| 161 | 164 | if ($this->_config->get('default_hourly_price')) { |
| 162 | 165 | $data['default_price'] = $this->_config->get('default_hourly_price'); |
@@ -237,7 +237,7 @@ |
||
| 237 | 237 | $invoice_item->pricePerUnit = $deliverable->pricePerUnit; |
| 238 | 238 | $invoice_item->deliverable = $deliverable->id; |
| 239 | 239 | //calculate price |
| 240 | - if ( $deliverable->invoiceByActualUnits |
|
| 240 | + if ($deliverable->invoiceByActualUnits |
|
| 241 | 241 | || $deliverable->plannedUnits == 0) { |
| 242 | 242 | $invoice_item->units = $hours; |
| 243 | 243 | } else { |
@@ -128,7 +128,8 @@ discard block |
||
| 128 | 128 | try { |
| 129 | 129 | $task = new org_openpsa_projects_task_dba($id); |
| 130 | 130 | $task->update_cache(); |
| 131 | - } catch (midcom_error $e) { |
|
| 131 | + } |
|
| 132 | + catch (midcom_error $e) { |
|
| 132 | 133 | } |
| 133 | 134 | } |
| 134 | 135 | |
@@ -293,14 +294,16 @@ discard block |
||
| 293 | 294 | if (!empty($this->customer)) { |
| 294 | 295 | try { |
| 295 | 296 | return org_openpsa_contacts_group_dba::get_cached($this->customer); |
| 296 | - } catch (midcom_error $e) { |
|
| 297 | + } |
|
| 298 | + catch (midcom_error $e) { |
|
| 297 | 299 | $e->log(); |
| 298 | 300 | } |
| 299 | 301 | } |
| 300 | 302 | if (!empty($this->customerContact)) { |
| 301 | 303 | try { |
| 302 | 304 | return org_openpsa_contacts_person_dba::get_cached($this->customerContact); |
| 303 | - } catch (midcom_error $e) { |
|
| 305 | + } |
|
| 306 | + catch (midcom_error $e) { |
|
| 304 | 307 | $e->log(); |
| 305 | 308 | } |
| 306 | 309 | } |
@@ -132,7 +132,8 @@ |
||
| 132 | 132 | |
| 133 | 133 | try { |
| 134 | 134 | $user = new midgard_user($login_tokens); |
| 135 | - } catch (mgd_exception $e) { |
|
| 135 | + } |
|
| 136 | + catch (mgd_exception $e) { |
|
| 136 | 137 | return false; |
| 137 | 138 | } |
| 138 | 139 | if (!$trusted && !self::verify_password($password, $user->password)) { |
@@ -261,7 +261,7 @@ |
||
| 261 | 261 | if ($part === '') { |
| 262 | 262 | continue; |
| 263 | 263 | } |
| 264 | - if ( midcom::get()->config->get('theme') |
|
| 264 | + if (midcom::get()->config->get('theme') |
|
| 265 | 265 | && !$args_started |
| 266 | 266 | && self::check_page_exists($part)) { |
| 267 | 267 | $page_style .= '/' . $part; |
@@ -93,7 +93,8 @@ |
||
| 93 | 93 | try { |
| 94 | 94 | $mgdschemaclass = $this->__mgdschema_class_name__; |
| 95 | 95 | $this->__object = new $mgdschemaclass($id); |
| 96 | - } catch (mgd_exception $e) { |
|
| 96 | + } |
|
| 97 | + catch (mgd_exception $e) { |
|
| 97 | 98 | debug_add('Constructing ' . $this->__mgdschema_class_name__ . ' object ' . $id . ' failed, reason: ' . $e->getMessage(), MIDCOM_LOG_WARN); |
| 98 | 99 | throw new midcom_error_midgard($e, $id); |
| 99 | 100 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | if (is_object($id)) { |
| 107 | 107 | $this->__object = midcom::get()->dbfactory->convert_midcom_to_midgard($id); |
| 108 | 108 | } else { |
| 109 | - if ( is_int($id) |
|
| 109 | + if (is_int($id) |
|
| 110 | 110 | && $id < 1) { |
| 111 | 111 | throw new midcom_error($id . ' is not a valid database ID'); |
| 112 | 112 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | //Some useful information for performance tuning |
| 123 | - if ( midcom::get()->config->get('log_level') >= MIDCOM_LOG_DEBUG |
|
| 123 | + if (midcom::get()->config->get('log_level') >= MIDCOM_LOG_DEBUG |
|
| 124 | 124 | && $this->__object->guid) { |
| 125 | 125 | static $guids = []; |
| 126 | 126 | static $total = 0; |
@@ -44,7 +44,8 @@ discard block |
||
| 44 | 44 | { |
| 45 | 45 | try { |
| 46 | 46 | $tmp = midgard_object_class::get_object_by_guid($guid); |
| 47 | - } catch (mgd_exception $e) { |
|
| 47 | + } |
|
| 48 | + catch (mgd_exception $e) { |
|
| 48 | 49 | debug_add('Loading object by GUID ' . $guid . ' failed, reason: ' . $e->getMessage(), MIDCOM_LOG_INFO); |
| 49 | 50 | |
| 50 | 51 | throw new midcom_error_midgard($e, $guid); |
@@ -237,7 +238,8 @@ discard block |
||
| 237 | 238 | $parent_data = [ |
| 238 | 239 | $parent->__midcom_class_name__ => $parent_guid |
| 239 | 240 | ]; |
| 240 | - } catch (midcom_error $e) { |
|
| 241 | + } |
|
| 242 | + catch (midcom_error $e) { |
|
| 241 | 243 | $parent_data = [ |
| 242 | 244 | '' => null |
| 243 | 245 | ]; |
@@ -251,7 +253,8 @@ discard block |
||
| 251 | 253 | |
| 252 | 254 | try { |
| 253 | 255 | return $this->get_cached($classname, $parent_guid); |
| 254 | - } catch (midcom_error $e) { |
|
| 256 | + } |
|
| 257 | + catch (midcom_error $e) { |
|
| 255 | 258 | return null; |
| 256 | 259 | } |
| 257 | 260 | } |
@@ -310,7 +313,8 @@ discard block |
||
| 310 | 313 | if ($the_object === null) { |
| 311 | 314 | try { |
| 312 | 315 | $the_object = $this->get_object_by_guid($object_guid); |
| 313 | - } catch (midcom_error $e) { |
|
| 316 | + } |
|
| 317 | + catch (midcom_error $e) { |
|
| 314 | 318 | return ['' => null]; |
| 315 | 319 | } |
| 316 | 320 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | throw new midcom_error_midgard($e, $guid); |
| 49 | 49 | } |
| 50 | 50 | $person_class = midcom::get()->config->get('person_class'); |
| 51 | - if ( get_class($tmp) == 'midgard_person' |
|
| 51 | + if (get_class($tmp) == 'midgard_person' |
|
| 52 | 52 | && $person_class != 'midgard_person') { |
| 53 | 53 | $tmp = new $person_class($guid); |
| 54 | 54 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | $object = new $classname($src); |
| 81 | 81 | $cache[$classname][$object->guid] = $object; |
| 82 | - $cache[$classname][$object->id] =& $cache[$classname][$object->guid]; |
|
| 82 | + $cache[$classname][$object->id] = & $cache[$classname][$object->guid]; |
|
| 83 | 83 | return $cache[$classname][$object->guid]; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -182,14 +182,14 @@ discard block |
||
| 182 | 182 | return true; |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - if ( isset($object->__object) |
|
| 185 | + if (isset($object->__object) |
|
| 186 | 186 | && is_object($object->__object) |
| 187 | 187 | && $object->__object instanceof $class) { |
| 188 | 188 | // Decorator whose MgdSchema object matches |
| 189 | 189 | return true; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - if ( isset($object->__mgdschema_class_name__) |
|
| 192 | + if (isset($object->__mgdschema_class_name__) |
|
| 193 | 193 | && $object->__mgdschema_class_name__ == $class) { |
| 194 | 194 | // Decorator without object instantiated, check class match |
| 195 | 195 | return true; |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $parent_data = $this->_get_parent_guid_cached($object->guid, $object); |
| 213 | 213 | |
| 214 | 214 | $parent_guid = current($parent_data); |
| 215 | - if ( empty($parent_guid) |
|
| 215 | + if (empty($parent_guid) |
|
| 216 | 216 | || $parent_guid === $object->guid) { |
| 217 | 217 | return null; |
| 218 | 218 | } |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | ]; |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | - if ( $parent_property |
|
| 418 | + if ($parent_property |
|
| 419 | 419 | && $reflector->get_link_target($parent_property)) { |
| 420 | 420 | $target_class = $reflector->get_link_name($parent_property); |
| 421 | 421 | if ($target_class == 'midgard_person') { |
@@ -94,7 +94,8 @@ |
||
| 94 | 94 | } |
| 95 | 95 | try { |
| 96 | 96 | $this->_storage = new midgard_group($id); |
| 97 | - } catch (Exception $e) { |
|
| 97 | + } |
|
| 98 | + catch (Exception $e) { |
|
| 98 | 99 | debug_add('Tried to load a midcom_core_group, but got error ' . $e->getMessage(), MIDCOM_LOG_ERROR); |
| 99 | 100 | debug_print_r('Passed argument was:', $id); |
| 100 | 101 | throw new midcom_error($e->getMessage()); |
@@ -27,7 +27,8 @@ |
||
| 27 | 27 | try { |
| 28 | 28 | midcom::get()->dbfactory->get_object_by_guid($result->fromGuid); |
| 29 | 29 | midcom::get()->dbfactory->get_object_by_guid($result->toGuid); |
| 30 | - } catch (midcom_error $e) { |
|
| 30 | + } |
|
| 31 | + catch (midcom_error $e) { |
|
| 31 | 32 | echo $i . "/" . $total . ": Deleting relatedto #" . $result->id . "\n"; |
| 32 | 33 | $result->delete(); |
| 33 | 34 | } |
@@ -28,7 +28,8 @@ |
||
| 28 | 28 | foreach ($qb->execute() as $feed) { |
| 29 | 29 | try { |
| 30 | 30 | midcom_db_topic::get_cached($feed->node); |
| 31 | - } catch (midcom_error $e) { |
|
| 31 | + } |
|
| 32 | + catch (midcom_error $e) { |
|
| 32 | 33 | debug_add("Node #{$feed->node} does not exist, skipping feed #{$feed->id}", MIDCOM_LOG_ERROR); |
| 33 | 34 | continue; |
| 34 | 35 | } |
@@ -32,7 +32,8 @@ |
||
| 32 | 32 | foreach ($qb->execute() as $article) { |
| 33 | 33 | try { |
| 34 | 34 | $dm->set_storage($article); |
| 35 | - } catch (midcom_error $e) { |
|
| 35 | + } |
|
| 36 | + catch (midcom_error $e) { |
|
| 36 | 37 | $e->log(MIDCOM_LOG_WARN); |
| 37 | 38 | continue; |
| 38 | 39 | } |