@@ -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 | } |
@@ -142,7 +142,8 @@ |
||
142 | 142 | try { |
143 | 143 | $person = org_openpsa_contacts_person_dba::get_cached($link->person); |
144 | 144 | $segment = $person->get_parameter('org.openpsa.directmarketing.segments', $segmentation_param); |
145 | - } catch (midcom_error $e) { |
|
145 | + } |
|
146 | + catch (midcom_error $e) { |
|
146 | 147 | } |
147 | 148 | if (empty($segment)) { |
148 | 149 | $segment = $this->_l10n->get('no segment'); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $qb_receipts->add_constraint('orgOpenpsaObtype', '=', org_openpsa_directmarketing_campaign_messagereceipt_dba::SENT); |
38 | 38 | $qb_receipts->add_order('metadata.created'); |
39 | 39 | $receipts = $qb_receipts->execute_unchecked(); |
40 | - $receipt_data =& $this->_request_data['report']['receipt_data']; |
|
40 | + $receipt_data = & $this->_request_data['report']['receipt_data']; |
|
41 | 41 | $receipt_data['first_send'] = $receipts[0]->metadata->created ?? 0; |
42 | 42 | $receipt_data['last_send'] = end($receipts)->metadata->created ?? 0; |
43 | 43 | $receipt_data['sent'] = count($receipts); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | private function _get_campaign_data(int $first_send) |
66 | 66 | { |
67 | - $campaign_data =& $this->_request_data['report']['campaign_data']; |
|
67 | + $campaign_data = & $this->_request_data['report']['campaign_data']; |
|
68 | 68 | $qb_unsub = org_openpsa_directmarketing_campaign_member_dba::new_query_builder(); |
69 | 69 | $qb_unsub->add_constraint('campaign', '=', $this->_message->campaign); |
70 | 70 | $qb_unsub->add_constraint('orgOpenpsaObtype', '=', org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | private function _get_link_data($segmentation_param) |
89 | 89 | { |
90 | 90 | $this->_request_data['report']['link_data'] = []; |
91 | - $link_data =& $this->_request_data['report']['link_data']; |
|
91 | + $link_data = & $this->_request_data['report']['link_data']; |
|
92 | 92 | |
93 | 93 | $link_data['counts'] = []; |
94 | 94 | $link_data['percentages'] = ['of_links' => [], 'of_recipients' => []]; |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | foreach ($links as $link) { |
115 | 115 | $segment = ''; |
116 | 116 | $segment_notfound = false; |
117 | - if ( $segmentation_param |
|
117 | + if ($segmentation_param |
|
118 | 118 | && !empty($link->person)) { |
119 | 119 | try { |
120 | 120 | $person = org_openpsa_contacts_person_dba::get_cached($link->person); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | if (!isset($link_data['segments'][$segment])) { |
129 | 129 | $link_data['segments'][$segment] = $segment_prototype; |
130 | 130 | } |
131 | - $segment_data =& $link_data['segments'][$segment]; |
|
131 | + $segment_data = & $link_data['segments'][$segment]; |
|
132 | 132 | } else { |
133 | 133 | $segment_data = $segment_prototype; |
134 | 134 | } |
@@ -238,15 +238,15 @@ discard block |
||
238 | 238 | $this->_initialize_field($array['percentages']['of_links'], $link); |
239 | 239 | $this->_initialize_field($array['percentages']['of_recipients'], $link); |
240 | 240 | |
241 | - $link_data =& $this->_request_data['report']['link_data']; |
|
242 | - $array['percentages']['of_links'][$link->target]['total'] = ($array['counts'][$link->target]['total']/$link_data['total'])*100; |
|
243 | - $array['percentages']['of_links'][$link->target][$link->token] = ($array['counts'][$link->target][$link->token]/$link_data['total'])*100; |
|
241 | + $link_data = & $this->_request_data['report']['link_data']; |
|
242 | + $array['percentages']['of_links'][$link->target]['total'] = ($array['counts'][$link->target]['total'] / $link_data['total']) * 100; |
|
243 | + $array['percentages']['of_links'][$link->target][$link->token] = ($array['counts'][$link->target][$link->token] / $link_data['total']) * 100; |
|
244 | 244 | |
245 | - $receipt_data =& $this->_request_data['report']['receipt_data']; |
|
246 | - $array['percentages']['of_recipients'][$link->target]['total'] = ((count($array['counts'][$link->target])-1)/($receipt_data['sent']-$receipt_data['bounced']))*100; |
|
247 | - $array['percentages']['of_recipients'][$link->target][$link->token] = ($array['counts'][$link->target][$link->token]/($receipt_data['sent']-$receipt_data['bounced']))*100; |
|
245 | + $receipt_data = & $this->_request_data['report']['receipt_data']; |
|
246 | + $array['percentages']['of_recipients'][$link->target]['total'] = ((count($array['counts'][$link->target]) - 1) / ($receipt_data['sent'] - $receipt_data['bounced'])) * 100; |
|
247 | + $array['percentages']['of_recipients'][$link->target][$link->token] = ($array['counts'][$link->target][$link->token] / ($receipt_data['sent'] - $receipt_data['bounced'])) * 100; |
|
248 | 248 | |
249 | - if ( !isset($array['percentages']['of_recipients']['total']) |
|
249 | + if (!isset($array['percentages']['of_recipients']['total']) |
|
250 | 250 | || $array['percentages']['of_recipients'][$link->target]['total'] > $array['percentages']['of_recipients']['total']) { |
251 | 251 | $array['percentages']['of_recipients']['total'] = $array['percentages']['of_recipients'][$link->target]['total']; |
252 | 252 | } |
@@ -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(); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | // User is or has been subscriber earlier, update status |
134 | 134 | $member = $members[0]; |
135 | 135 | |
136 | - if ( $member->orgOpenpsaObtype == org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED |
|
136 | + if ($member->orgOpenpsaObtype == org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED |
|
137 | 137 | || $member->orgOpenpsaObtype == org_openpsa_directmarketing_campaign_member_dba::NORMAL) { |
138 | 138 | $this->_import_status['already_subscribed']++; |
139 | 139 | return; |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | $qb = org_openpsa_contacts_group_dba::new_query_builder(); |
175 | 175 | $schema = $this->_schemadbs['organization']->get('default'); |
176 | - if ( $schema->has_field('company_id') |
|
176 | + if ($schema->has_field('company_id') |
|
177 | 177 | && !empty($subscriber['organization']['company_id'])) { |
178 | 178 | // Imported data has a company id, we use that instead of name |
179 | 179 | $qb->add_constraint($schema->get_field('company_id')['storage']['location'], '=', $subscriber['organization']['company_id']); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | // Seek by official name |
182 | 182 | $qb->add_constraint('official', '=', $subscriber['organization']['official']); |
183 | 183 | |
184 | - if ( $schema->has_field('city') |
|
184 | + if ($schema->has_field('city') |
|
185 | 185 | && !empty($subscriber['organization']['city'])) { |
186 | 186 | // Imported data has a city, we use also that for matching |
187 | 187 | $qb->add_constraint($schema->get_field('city')['storage']['location'], '=', $subscriber['organization']['city']); |
@@ -34,7 +34,7 @@ |
||
34 | 34 | echo " <th>{$type}</th>\n"; |
35 | 35 | echo " <td style=\"text-align: right;\">" . number_format($count) . "</td>\n"; |
36 | 36 | if (isset($cleanups_kept[$type])) { |
37 | - echo " <td style=\"text-align: right;\">" . number_format($cleanups_kept[$type]) ."</td>\n"; |
|
37 | + echo " <td style=\"text-align: right;\">" . number_format($cleanups_kept[$type]) . "</td>\n"; |
|
38 | 38 | } |
39 | 39 | echo " </tr>\n"; |
40 | 40 | } |