@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | if ($result === true) { |
21 | 21 | $result = []; |
22 | 22 | } |
23 | - if ( empty($fields['end']) |
|
23 | + if (empty($fields['end']) |
|
24 | 24 | && empty($fields['continuous'])) { |
25 | 25 | $result['end'] = midcom::get()->i18n->get_string('select either end date or continuous', 'org.openpsa.sales'); |
26 | 26 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | public function validate_units(array $fields) |
34 | 34 | { |
35 | 35 | $result = []; |
36 | - if ( empty($fields['invoiceByActualUnits']) |
|
36 | + if (empty($fields['invoiceByActualUnits']) |
|
37 | 37 | && empty($fields['plannedUnits'])) { |
38 | 38 | $result['plannedUnits'] = midcom::get()->i18n->get_string('select either planned units or invoice by actual units', 'org.openpsa.sales'); |
39 | 39 | return $result; |
@@ -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 | } |
@@ -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 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | //Set some List-xxx headers to avoid auto-replies and in general to be a good netizen |
93 | 93 | $mail->headers['List-Id'] = "<{$this->_message->guid}@{$_SERVER['SERVER_NAME']}>"; |
94 | - $mail->headers['List-Unsubscribe'] = '<' . $member->get_unsubscribe_url() . '>'; |
|
94 | + $mail->headers['List-Unsubscribe'] = '<' . $member->get_unsubscribe_url() . '>'; |
|
95 | 95 | |
96 | 96 | debug_add('mail->from: ' . $mail->from . ', mail->to: ' . $mail->to . ', mail->subject: ' . $mail->subject); |
97 | 97 | switch ($this->_message->orgOpenpsaObtype) { |
@@ -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); |
@@ -19,7 +19,7 @@ |
||
19 | 19 | foreach ($properties as $propname => $val) { |
20 | 20 | $proplink = ""; |
21 | 21 | $description = preg_replace('/ *\n */', "\n", $val['value']); |
22 | - if ( $val['link'] |
|
22 | + if ($val['link'] |
|
23 | 23 | && $linked_component = midcom::get()->dbclassloader->get_component_for_class($val['link_name'])) { |
24 | 24 | $proplink = "<a href='{$prefix}__ais/help/{$linked_component}/mgdschemas/#{$val['link_name']}' title='{$linked_component}/{$val['link_name']}::{$val['link_target']}'>{$val['link_name']}:{$val['link_target']}</a>"; |
25 | 25 | $classname = str_replace('_', '\\_', $val['link_name']); |
@@ -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)) { |
@@ -272,7 +272,7 @@ |
||
272 | 272 | if ($part === '') { |
273 | 273 | continue; |
274 | 274 | } |
275 | - if ( midcom::get()->config->get('theme') |
|
275 | + if (midcom::get()->config->get('theme') |
|
276 | 276 | && !$args_started |
277 | 277 | && midcom_helper_misc::check_page_exists($part)) { |
278 | 278 | $page_style .= '/' . $part; |
@@ -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 | } |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | |
50 | 50 | throw new midcom_error_midgard($e, $guid); |
51 | 51 | } |
52 | - $person_class = midcom::get()->config->get('person_class'); |
|
53 | - if ( get_class($tmp) == 'midgard_person' |
|
52 | + $person_class = midcom::get()->config->get('person_class'); |
|
53 | + if (get_class($tmp) == 'midgard_person' |
|
54 | 54 | && $person_class != 'midgard_person') { |
55 | 55 | $tmp = new $person_class($guid); |
56 | 56 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | } |
82 | 82 | $object = new $classname($src); |
83 | 83 | $cache[$classname][$object->guid] = $object; |
84 | - $cache[$classname][$object->id] =& $cache[$classname][$object->guid]; |
|
84 | + $cache[$classname][$object->id] = & $cache[$classname][$object->guid]; |
|
85 | 85 | return $cache[$classname][$object->guid]; |
86 | 86 | } |
87 | 87 | |
@@ -184,14 +184,14 @@ discard block |
||
184 | 184 | return true; |
185 | 185 | } |
186 | 186 | |
187 | - if ( isset($object->__object) |
|
187 | + if (isset($object->__object) |
|
188 | 188 | && is_object($object->__object) |
189 | 189 | && $object->__object instanceof $class) { |
190 | 190 | // Decorator whose MgdSchema object matches |
191 | 191 | return true; |
192 | 192 | } |
193 | 193 | |
194 | - if ( isset($object->__mgdschema_class_name__) |
|
194 | + if (isset($object->__mgdschema_class_name__) |
|
195 | 195 | && $object->__mgdschema_class_name__ == $class) { |
196 | 196 | // Decorator without object instantiated, check class match |
197 | 197 | return true; |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $parent_data = $this->_get_parent_guid_cached($object->guid, $object); |
215 | 215 | |
216 | 216 | $parent_guid = current($parent_data); |
217 | - if ( empty($parent_guid) |
|
217 | + if (empty($parent_guid) |
|
218 | 218 | || $parent_guid === $object->guid) { |
219 | 219 | return null; |
220 | 220 | } |
@@ -417,11 +417,11 @@ discard block |
||
417 | 417 | ]; |
418 | 418 | } |
419 | 419 | |
420 | - if ( $parent_property |
|
420 | + if ($parent_property |
|
421 | 421 | && $reflector->get_link_target($parent_property)) { |
422 | 422 | $target_class = $reflector->get_link_name($parent_property); |
423 | 423 | if ($target_class == 'midgard_person') { |
424 | - $person_class = midcom::get()->config->get('person_class'); |
|
424 | + $person_class = midcom::get()->config->get('person_class'); |
|
425 | 425 | if ($person_class != 'midgard_person') { |
426 | 426 | $target_class = $person_class; |
427 | 427 | } |
@@ -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()); |