@@ -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 | } |
@@ -57,7 +57,7 @@ |
||
57 | 57 | |
58 | 58 | private function get_units($units = false) |
59 | 59 | { |
60 | - if ( $this->_deliverable->invoiceByActualUnits |
|
60 | + if ($this->_deliverable->invoiceByActualUnits |
|
61 | 61 | || $this->_deliverable->plannedUnits == 0) { |
62 | 62 | // In most cases we calculate the price based on the actual units entered |
63 | 63 | return $units ?: $this->_deliverable->units; |
@@ -163,17 +163,17 @@ |
||
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
166 | - * Inserts a link detector to the given HTML source. All outgoing |
|
167 | - * HTTP links in the source HTML are replaced with the given |
|
168 | - * link detector address so that the token "URL" is replaced with |
|
169 | - * encoded form of the original link. It is expected that the link detector |
|
170 | - * address points to a script that records the passed link and |
|
171 | - * forwards the client to the real link target. |
|
172 | - * |
|
173 | - * @param string $html the HTML source |
|
174 | - * @param string $address the link detector address |
|
175 | - * @return string HTML source with the link detector |
|
176 | - */ |
|
166 | + * Inserts a link detector to the given HTML source. All outgoing |
|
167 | + * HTTP links in the source HTML are replaced with the given |
|
168 | + * link detector address so that the token "URL" is replaced with |
|
169 | + * encoded form of the original link. It is expected that the link detector |
|
170 | + * address points to a script that records the passed link and |
|
171 | + * forwards the client to the real link target. |
|
172 | + * |
|
173 | + * @param string $html the HTML source |
|
174 | + * @param string $address the link detector address |
|
175 | + * @return string HTML source with the link detector |
|
176 | + */ |
|
177 | 177 | private function _insert_link_detector($html, $address) |
178 | 178 | { |
179 | 179 | $address = addslashes($address); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | //Check for bounce detector usage |
35 | 35 | if (!empty($config['bounce_detector_address'])) { |
36 | 36 | //Force bouncer as backend if default specified |
37 | - if ( empty($config['mail_send_backend']) |
|
37 | + if (empty($config['mail_send_backend']) |
|
38 | 38 | || $config['mail_send_backend'] == 'try_default') { |
39 | 39 | $config['mail_send_backend'] = 'bouncer'; |
40 | 40 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $address = addslashes($address); |
180 | 180 | return preg_replace_callback( |
181 | 181 | '/href="(http:\/\/.*?)"/i', |
182 | - function ($match) use ($address) { |
|
182 | + function($match) use ($address) { |
|
183 | 183 | return 'href="' . str_replace("URL", rawurlencode($match[1]), $address) . '"'; |
184 | 184 | }, |
185 | 185 | $html); |
@@ -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 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | private function _update_cache() |
145 | 145 | { |
146 | 146 | $this->_merged = $this->_global; |
147 | - if ( !empty($this->_local) |
|
147 | + if (!empty($this->_local) |
|
148 | 148 | && is_array($this->_local)) { |
149 | 149 | $this->_merged = array_merge($this->_merged, $this->_local); |
150 | 150 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function store(array $params, $reset = true) |
187 | 187 | { |
188 | - if ( !$this->_object_stored |
|
188 | + if (!$this->_object_stored |
|
189 | 189 | && $this->_object) { |
190 | 190 | $this->_store_from_object(); |
191 | 191 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | */ |
270 | 270 | public function get_all() |
271 | 271 | { |
272 | - if ( !$this->_object_stored |
|
272 | + if (!$this->_object_stored |
|
273 | 273 | && $this->_object) { |
274 | 274 | $this->_store_from_object(); |
275 | 275 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | */ |
286 | 286 | public function exists($key) |
287 | 287 | { |
288 | - if ( !$this->_object_stored |
|
288 | + if (!$this->_object_stored |
|
289 | 289 | && $this->_object) { |
290 | 290 | $this->_store_from_object(); |
291 | 291 | } |