@@ -134,7 +134,8 @@ discard block |
||
134 | 134 | |
135 | 135 | try { |
136 | 136 | $deliverable = new org_openpsa_sales_salesproject_deliverable_dba($args['deliverable']); |
137 | - } catch (midcom_error $e) { |
|
137 | + } |
|
138 | + catch (midcom_error $e) { |
|
138 | 139 | $handler->print_error("Deliverable {$args['deliverable']} not found: " . midcom_connection::get_error_string()); |
139 | 140 | return false; |
140 | 141 | } |
@@ -158,7 +159,8 @@ discard block |
||
158 | 159 | } |
159 | 160 | try { |
160 | 161 | $deliverable = new org_openpsa_sales_salesproject_deliverable_dba($args['deliverable']); |
161 | - } catch (midcom_error $e) { |
|
162 | + } |
|
163 | + catch (midcom_error $e) { |
|
162 | 164 | $handler->print_error('no deliverable with passed GUID: ' . $args['deliverable'] . ', aborting'); |
163 | 165 | return false; |
164 | 166 | } |
@@ -166,7 +168,8 @@ discard block |
||
166 | 168 | //get the owner of the salesproject the deliverable belongs to |
167 | 169 | try { |
168 | 170 | $project = new org_openpsa_sales_salesproject_dba($deliverable->salesproject); |
169 | - } catch (midcom_error $e) { |
|
171 | + } |
|
172 | + catch (midcom_error $e) { |
|
170 | 173 | $handler->print_error('Failed to load salesproject: ' . $e->getMessage()); |
171 | 174 | return false; |
172 | 175 | } |
@@ -52,7 +52,7 @@ |
||
52 | 52 | */ |
53 | 53 | private function _find_suspects_event(midcom_core_dbaobject $object, org_openpsa_relatedto_dba $defaults, array &$links_array) |
54 | 54 | { |
55 | - if ( !is_array($object->participants) |
|
55 | + if (!is_array($object->participants) |
|
56 | 56 | || count($object->participants) < 2) { |
57 | 57 | //We have invalid list or less than two participants, abort |
58 | 58 | return; |
@@ -51,7 +51,8 @@ |
||
51 | 51 | } |
52 | 52 | try { |
53 | 53 | $this->_request_data['product'] = org_openpsa_products_product_dba::get_cached($this->_deliverable->product); |
54 | - } catch (midcom_error $e) { |
|
54 | + } |
|
55 | + catch (midcom_error $e) { |
|
55 | 56 | $this->_request_data['product'] = false; |
56 | 57 | } |
57 | 58 | } |
@@ -113,7 +113,8 @@ |
||
113 | 113 | try { |
114 | 114 | $this->_request_data['customer'] = new org_openpsa_contacts_group_dba($guid); |
115 | 115 | $qb->add_constraint('customer', '=', $this->_request_data['customer']->id); |
116 | - } catch (midcom_error $e) { |
|
116 | + } |
|
117 | + catch (midcom_error $e) { |
|
117 | 118 | $this->_request_data['customer'] = new org_openpsa_contacts_person_dba($guid); |
118 | 119 | $qb->add_constraint('customerContact', '=', $this->_request_data['customer']->id); |
119 | 120 | } |
@@ -159,7 +159,8 @@ |
||
159 | 159 | |
160 | 160 | try { |
161 | 161 | $object = new $classname($guid); |
162 | - } catch (midcom_error $e) { |
|
162 | + } |
|
163 | + catch (midcom_error $e) { |
|
163 | 164 | $handler->print_error($type . " {$guid} not found, error " . $e->getMessage()); |
164 | 165 | return false; |
165 | 166 | } |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | |
78 | 78 | public function resolve_object_link(midcom_db_topic $topic, midcom_core_dbaobject $object) : ?string |
79 | 79 | { |
80 | - if ( $object instanceof org_openpsa_contacts_group_dba |
|
80 | + if ($object instanceof org_openpsa_contacts_group_dba |
|
81 | 81 | || $object instanceof midcom_db_group) { |
82 | 82 | return "group/{$object->guid}/"; |
83 | 83 | } |
84 | - if ( $object instanceof org_openpsa_contacts_person_dba |
|
84 | + if ($object instanceof org_openpsa_contacts_person_dba |
|
85 | 85 | || $object instanceof midcom_db_person) { |
86 | 86 | return "person/{$object->guid}/"; |
87 | 87 | } |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | // We have a feed URL, but we should check if it is GeoRSS as well |
111 | 111 | $items = net_nemein_rss_fetch::raw_fetch($data['rss_url'])->get_items(); |
112 | 112 | |
113 | - if ( !empty($items) |
|
114 | - && ( $items[0]->get_latitude() |
|
113 | + if (!empty($items) |
|
114 | + && ($items[0]->get_latitude() |
|
115 | 115 | || $items[0]->get_longitude())) { |
116 | 116 | // This is a GeoRSS feed |
117 | 117 | $data['georss_url'] = $data['rss_url']; |
@@ -114,7 +114,8 @@ |
||
114 | 114 | && $deliverable->end > $this->_request_data['start'])) { |
115 | 115 | $invoices = array_merge($invoices, $this->_get_invoices_for_subscription($deliverable, $at_entry)); |
116 | 116 | } |
117 | - } catch (midcom_error $e) { |
|
117 | + } |
|
118 | + catch (midcom_error $e) { |
|
118 | 119 | } |
119 | 120 | } |
120 | 121 | $invoices = array_merge($invoices, $this->_get_deliverable_invoices()); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | private function _get_invoices_for_subscription(org_openpsa_sales_salesproject_deliverable_dba $deliverable, midcom_services_at_entry_dba $at_entry) : array |
66 | 66 | { |
67 | - if ( $deliverable->invoiceByActualUnits |
|
67 | + if ($deliverable->invoiceByActualUnits |
|
68 | 68 | && $at_entry->arguments['cycle'] > 1) { |
69 | 69 | $invoice_sum = $deliverable->invoiced / ($at_entry->arguments['cycle'] - 1); |
70 | 70 | if ($invoice_sum == 0) { |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | $time = $at_entry->start; |
81 | 81 | $scheduler = new org_openpsa_invoices_scheduler($deliverable); |
82 | 82 | |
83 | - while ( $time < $this->_request_data['end'] |
|
84 | - && ( $time < $deliverable->end |
|
83 | + while ($time < $this->_request_data['end'] |
|
84 | + && ($time < $deliverable->end |
|
85 | 85 | || $deliverable->continuous)) { |
86 | 86 | $invoices[] = $this->get_invoice_for_deliverable($deliverable, $invoice_sum, $time, $calculation_base); |
87 | 87 | |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | foreach ($qb->execute() as $at_entry) { |
124 | 124 | try { |
125 | 125 | $deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($at_entry->arguments['deliverable']); |
126 | - if ( $deliverable->continuous |
|
127 | - || ( $deliverable->start < $this->_request_data['end'] |
|
126 | + if ($deliverable->continuous |
|
127 | + || ($deliverable->start < $this->_request_data['end'] |
|
128 | 128 | && $deliverable->end > $this->_request_data['start'])) { |
129 | 129 | $invoices = array_merge($invoices, $this->_get_invoices_for_subscription($deliverable, $at_entry)); |
130 | 130 | } |
@@ -71,7 +71,8 @@ |
||
71 | 71 | $owner = org_openpsa_contacts_person_dba::get_cached($salesproject->owner); |
72 | 72 | $row['index_owner'] = $owner->name; |
73 | 73 | $row['owner'] = org_openpsa_widgets_contact::get($owner->guid)->show_inline(); |
74 | - } catch (midcom_error $e) { |
|
74 | + } |
|
75 | + catch (midcom_error $e) { |
|
75 | 76 | $e->log(); |
76 | 77 | } |
77 | 78 | $row['amount'] = $object->pricePerUnit * $object->units; |
@@ -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 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | */ |
280 | 280 | private function add_misc_rule(array $rule, string $class, string $person_property) : bool |
281 | 281 | { |
282 | - $persons = [ 0 => -1]; |
|
282 | + $persons = [0 => -1]; |
|
283 | 283 | $match = $rule['match']; |
284 | 284 | $constraint_match = "IN"; |
285 | 285 | if ($rule['match'] == '<>') { |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | $ret = []; |
352 | 352 | |
353 | 353 | foreach ($object->get_properties() as $property) { |
354 | - if ( $property[0] == '_' |
|
354 | + if ($property[0] == '_' |
|
355 | 355 | || in_array($property, $skip_properties)) { |
356 | 356 | // Skip private or otherwise invalid properties |
357 | 357 | continue; |
@@ -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 | } |