@@ -42,7 +42,8 @@ |
||
42 | 42 | } |
43 | 43 | try { |
44 | 44 | $resource = org_openpsa_calendar_resource_dba::get_cached($this->resource); |
45 | - } catch (midcom_error $e) { |
|
45 | + } |
|
46 | + catch (midcom_error $e) { |
|
46 | 47 | debug_add("Cannot fetch resource #{$this->resource} returning false", MIDCOM_LOG_INFO); |
47 | 48 | return false; |
48 | 49 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | // TODO: Warehouse management: create new order |
86 | - if ( $this->_deliverable->end < $next_cycle_start |
|
86 | + if ($this->_deliverable->end < $next_cycle_start |
|
87 | 87 | && $this->_deliverable->end != 0) { |
88 | 88 | debug_add('Do not register next cycle, the contract ends before'); |
89 | 89 | return $this->_deliverable->end_subscription(); |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | if ($this->_deliverable->unit != 'd') { |
307 | 307 | //If previous cycle was run at the end of the month, the new one should be at the end of the month as well |
308 | 308 | $date = new DateTime(gmdate('Y-m-d', $time), new DateTimeZone('GMT')); |
309 | - if ( $date->format('t') == $date->format('j') |
|
309 | + if ($date->format('t') == $date->format('j') |
|
310 | 310 | && $new_date->format('t') != $new_date->format('j')) { |
311 | 311 | $new_date->setDate((int) $new_date->format('Y'), (int) $new_date->format('m'), (int) $new_date->format('t')); |
312 | 312 | } |
@@ -372,11 +372,11 @@ discard block |
||
372 | 372 | break; |
373 | 373 | case 'q': |
374 | 374 | // Quarterly recurring subscription |
375 | - $identifier = ceil(((int)$date->format('n')) / 4) . 'Q' . $date->format('y'); |
|
375 | + $identifier = ceil(((int) $date->format('n')) / 4) . 'Q' . $date->format('y'); |
|
376 | 376 | break; |
377 | 377 | case 'hy': |
378 | 378 | // Half-yearly recurring subscription |
379 | - $identifier = ceil(((int)$date->format('n')) / 6) . '/' . $date->format('Y'); |
|
379 | + $identifier = ceil(((int) $date->format('n')) / 6) . '/' . $date->format('Y'); |
|
380 | 380 | break; |
381 | 381 | case 'y': |
382 | 382 | // Yearly recurring subscription |
@@ -126,7 +126,8 @@ |
||
126 | 126 | $salesproject = org_openpsa_sales_salesproject_dba::get_cached($this->_deliverable->salesproject); |
127 | 127 | try { |
128 | 128 | $owner = midcom_db_person::get_cached($salesproject->owner); |
129 | - } catch (midcom_error $e) { |
|
129 | + } |
|
130 | + catch (midcom_error $e) { |
|
130 | 131 | $e->log(); |
131 | 132 | return; |
132 | 133 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | public function _on_creating() |
20 | 20 | { |
21 | - if ( $this->invoice |
|
21 | + if ($this->invoice |
|
22 | 22 | && $this->position == 0) { |
23 | 23 | $invoice = org_openpsa_invoices_invoice_dba::get_cached($this->invoice); |
24 | 24 | $this->position = count($invoice->get_invoice_items()) + 1; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } catch (midcom_error $e) { |
70 | 70 | } |
71 | 71 | } |
72 | - if ( $url == '' |
|
72 | + if ($url == '' |
|
73 | 73 | && $sales_url) { |
74 | 74 | try { |
75 | 75 | $deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($this->deliverable); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $invoice = new org_openpsa_invoices_invoice_dba($this->invoice); |
92 | 92 | $old_sum = $invoice->sum; |
93 | 93 | self::update_invoice($invoice); |
94 | - if ( $old_sum != $invoice->sum |
|
94 | + if ($old_sum != $invoice->sum |
|
95 | 95 | && !empty($this->deliverable)) { |
96 | 96 | $deliverable = new org_openpsa_sales_salesproject_deliverable_dba($this->deliverable); |
97 | 97 | self::update_deliverable($deliverable); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | if ($invoiced != $deliverable->invoiced) { |
133 | 133 | $deliverable->invoiced = $invoiced; |
134 | - if ( $deliverable->orgOpenpsaObtype !== org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION |
|
134 | + if ($deliverable->orgOpenpsaObtype !== org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION |
|
135 | 135 | && $deliverable->state < org_openpsa_sales_salesproject_deliverable_dba::STATE_INVOICED) { |
136 | 136 | $deliverable->state = org_openpsa_sales_salesproject_deliverable_dba::STATE_INVOICED; |
137 | 137 | } |
@@ -66,7 +66,8 @@ discard block |
||
66 | 66 | try { |
67 | 67 | $task = org_openpsa_projects_task_dba::get_cached($this->task); |
68 | 68 | $url = $projects_url . 'task/' . $task->guid . '/'; |
69 | - } catch (midcom_error $e) { |
|
69 | + } |
|
70 | + catch (midcom_error $e) { |
|
70 | 71 | } |
71 | 72 | } |
72 | 73 | if ( $url == '' |
@@ -74,7 +75,8 @@ discard block |
||
74 | 75 | try { |
75 | 76 | $deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($this->deliverable); |
76 | 77 | $url = $sales_url . 'deliverable/' . $deliverable->guid . '/'; |
77 | - } catch (midcom_error $e) { |
|
78 | + } |
|
79 | + catch (midcom_error $e) { |
|
78 | 80 | } |
79 | 81 | } |
80 | 82 | if ($url != '') { |
@@ -96,7 +98,8 @@ discard block |
||
96 | 98 | $deliverable = new org_openpsa_sales_salesproject_deliverable_dba($this->deliverable); |
97 | 99 | self::update_deliverable($deliverable); |
98 | 100 | } |
99 | - } catch (midcom_error $e) { |
|
101 | + } |
|
102 | + catch (midcom_error $e) { |
|
100 | 103 | $e->log(); |
101 | 104 | } |
102 | 105 | } |
@@ -92,7 +92,7 @@ |
||
92 | 92 | $entry['mimetype'] = org_openpsa_documents_document_dba::get_file_type($att->mimetype); |
93 | 93 | } |
94 | 94 | |
95 | - $title = '<a class="tab_escape" href="' .$prefix . 'document/' . $document->guid .'/"><img src="' . $icon . '"'; |
|
95 | + $title = '<a class="tab_escape" href="' . $prefix . 'document/' . $document->guid . '/"><img src="' . $icon . '"'; |
|
96 | 96 | $title .= 'alt="' . $alt . '" style="border: 0px; height: 16px; vertical-align: middle" /> ' . $document->title . '</a>'; |
97 | 97 | |
98 | 98 | $entry['title'] = $title; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
131 | - if ( !$person |
|
131 | + if (!$person |
|
132 | 132 | && !empty($subscriber['person']['handphone'])) { |
133 | 133 | // Perform a simple cell phone test. More complicated duplicate checking is best left to the o.o.contacts duplicate checker |
134 | 134 | $qb = org_openpsa_contacts_person_dba::new_query_builder(); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | // User is or has been subscriber earlier, update status |
175 | 175 | $member = $members[0]; |
176 | 176 | |
177 | - if ( $member->orgOpenpsaObtype == org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED |
|
177 | + if ($member->orgOpenpsaObtype == org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED |
|
178 | 178 | || $member->orgOpenpsaObtype == org_openpsa_directmarketing_campaign_member_dba::NORMAL) { |
179 | 179 | $this->_import_status['already_subscribed']++; |
180 | 180 | return; |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | $qb = org_openpsa_contacts_group_dba::new_query_builder(); |
216 | 216 | |
217 | - if ( array_key_exists('company_id', $this->_schemadbs['organization']['default']->fields) |
|
217 | + if (array_key_exists('company_id', $this->_schemadbs['organization']['default']->fields) |
|
218 | 218 | && !empty($subscriber['organization']['company_id'])) { |
219 | 219 | // Imported data has a company id, we use that instead of name |
220 | 220 | $qb->add_constraint($this->_schemadbs['organization']['default']->fields['company_id']['storage']['location'], '=', $subscriber['organization']['company_id']); |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | // Seek by official name |
223 | 223 | $qb->add_constraint('official', '=', $subscriber['organization']['official']); |
224 | 224 | |
225 | - if ( array_key_exists('city', $this->_schemadbs['organization']['default']->fields) |
|
225 | + if (array_key_exists('city', $this->_schemadbs['organization']['default']->fields) |
|
226 | 226 | && !empty($subscriber['organization']['city'])) { |
227 | 227 | // Imported data has a city, we use also that for matching |
228 | 228 | $qb->add_constraint($this->_schemadbs['organization']['default']->fields['city']['storage']['location'], '=', $subscriber['organization']['city']); |
@@ -300,7 +300,8 @@ |
||
300 | 300 | $organization = $this->_import_subscribers_organization($subscriber); |
301 | 301 | $this->_import_subscribers_organization_member($subscriber, $person, $organization); |
302 | 302 | } |
303 | - } catch (midcom_error $e) { |
|
303 | + } |
|
304 | + catch (midcom_error $e) { |
|
304 | 305 | $e->log(); |
305 | 306 | // Clean up possibly created data |
306 | 307 | $this->_clean_new_objects(); |
@@ -107,7 +107,8 @@ |
||
107 | 107 | if (!empty($_POST['midcom_helper_datamanager2_save'])) { |
108 | 108 | try { |
109 | 109 | $rules = $this->_load_rules(); |
110 | - } catch (midcom_error $e) { |
|
110 | + } |
|
111 | + catch (midcom_error $e) { |
|
111 | 112 | midcom::get()->uimessages->add('org.openpsa.directmarketing', $this->_l10n->get($e->getMessage()), 'error'); |
112 | 113 | return; |
113 | 114 | } |
@@ -125,7 +125,7 @@ |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | $date_identifier = date('Y-m-d', $row['date']); |
128 | - $row_identifier = $task->id . '-' . $row['person']; |
|
128 | + $row_identifier = $task->id . '-' . $row['person']; |
|
129 | 129 | |
130 | 130 | if (!isset($reports[$row_identifier])) { |
131 | 131 | try { |
@@ -32,7 +32,8 @@ discard block |
||
32 | 32 | } |
33 | 33 | try { |
34 | 34 | $date = new DateTime($requested_time); |
35 | - } catch (Exception $e) { |
|
35 | + } |
|
36 | + catch (Exception $e) { |
|
36 | 37 | return false; |
37 | 38 | } |
38 | 39 | $offset = $date->format('N') - 1; |
@@ -119,7 +120,8 @@ discard block |
||
119 | 120 | foreach ($hours as $guid => $row) { |
120 | 121 | try { |
121 | 122 | $task = org_openpsa_projects_task_dba::get_cached($row['task']); |
122 | - } catch (midcom_error $e) { |
|
123 | + } |
|
124 | + catch (midcom_error $e) { |
|
123 | 125 | // Task couldn't be loaded, probably because of ACL |
124 | 126 | continue; |
125 | 127 | } |
@@ -132,7 +134,8 @@ discard block |
||
132 | 134 | $person_object = org_openpsa_contacts_person_dba::get_cached($row['person']); |
133 | 135 | $person_label = $this->_get_list_link($person_object->name, null, null, $row['person']); |
134 | 136 | $person_name = $person_object->name; |
135 | - } catch (midcom_error $e) { |
|
137 | + } |
|
138 | + catch (midcom_error $e) { |
|
136 | 139 | $person_label = $this->_l10n->get('no person'); |
137 | 140 | $person_name = ''; |
138 | 141 | } |
@@ -23,7 +23,8 @@ |
||
23 | 23 | foreach ($this->_try_backends as $backend) { |
24 | 24 | try { |
25 | 25 | $this->_backend = org_openpsa_mail_backend::get($backend, $params); |
26 | - } catch (midcom_error $e) { |
|
26 | + } |
|
27 | + catch (midcom_error $e) { |
|
27 | 28 | debug_add('Failed to load backend ' . $backend . ', message:' . $e->getMessage()); |
28 | 29 | } |
29 | 30 | } |
@@ -42,7 +42,8 @@ discard block |
||
42 | 42 | $object = self::_load_backend($backend, $params); |
43 | 43 | debug_add('Using backend ' . $backend); |
44 | 44 | return $object; |
45 | - } catch (midcom_error $e) { |
|
45 | + } |
|
46 | + catch (midcom_error $e) { |
|
46 | 47 | debug_add('Failed to load backend ' . $backend . ', message:' . $e->getMessage()); |
47 | 48 | } |
48 | 49 | } |
@@ -67,7 +68,8 @@ discard block |
||
67 | 68 | $ret = $this->mail($message); |
68 | 69 | $this->error = false; |
69 | 70 | return $ret; |
70 | - } catch (Exception $e) { |
|
71 | + } |
|
72 | + catch (Exception $e) { |
|
71 | 73 | $this->error = $e->getMessage(); |
72 | 74 | return false; |
73 | 75 | } |
@@ -79,7 +79,7 @@ |
||
79 | 79 | return false; |
80 | 80 | } |
81 | 81 | |
82 | - if ( is_string($this->error) |
|
82 | + if (is_string($this->error) |
|
83 | 83 | && !empty($this->error)) { |
84 | 84 | return $this->error; |
85 | 85 | } |