@@ -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'); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $qb_receipts->add_constraint('orgOpenpsaObtype', '=', org_openpsa_directmarketing_campaign_messagereceipt_dba::SENT); |
34 | 34 | $qb_receipts->add_order('metadata.created'); |
35 | 35 | $receipts = $qb_receipts->execute_unchecked(); |
36 | - $receipt_data =& $this->_request_data['report']['receipt_data']; |
|
36 | + $receipt_data = & $this->_request_data['report']['receipt_data']; |
|
37 | 37 | $receipt_data['first_send'] = $receipts[0]->metadata->created ?? 0; |
38 | 38 | $receipt_data['last_send'] = end($receipts)->metadata->created ?? 0; |
39 | 39 | $receipt_data['sent'] = count($receipts); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | private function _get_campaign_data(int $first_send) |
62 | 62 | { |
63 | - $campaign_data =& $this->_request_data['report']['campaign_data']; |
|
63 | + $campaign_data = & $this->_request_data['report']['campaign_data']; |
|
64 | 64 | $qb_unsub = org_openpsa_directmarketing_campaign_member_dba::new_query_builder(); |
65 | 65 | $qb_unsub->add_constraint('campaign', '=', $this->_message->campaign); |
66 | 66 | $qb_unsub->add_constraint('orgOpenpsaObtype', '=', org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | private function _get_link_data($segmentation_param) |
85 | 85 | { |
86 | 86 | $this->_request_data['report']['link_data'] = []; |
87 | - $link_data =& $this->_request_data['report']['link_data']; |
|
87 | + $link_data = & $this->_request_data['report']['link_data']; |
|
88 | 88 | |
89 | 89 | $link_data['counts'] = []; |
90 | 90 | $link_data['percentages'] = ['of_links' => [], 'of_recipients' => []]; |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | foreach ($links as $link) { |
111 | 111 | $segment = ''; |
112 | 112 | $segment_notfound = false; |
113 | - if ( $segmentation_param |
|
113 | + if ($segmentation_param |
|
114 | 114 | && !empty($link->person)) { |
115 | 115 | try { |
116 | 116 | $person = org_openpsa_contacts_person_dba::get_cached($link->person); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $segment_notfound = true; |
123 | 123 | } |
124 | 124 | $link_data['segments'][$segment] ??= $segment_prototype; |
125 | - $segment_data =& $link_data['segments'][$segment]; |
|
125 | + $segment_data = & $link_data['segments'][$segment]; |
|
126 | 126 | } else { |
127 | 127 | $segment_data = $segment_prototype; |
128 | 128 | } |
@@ -230,15 +230,15 @@ discard block |
||
230 | 230 | $this->_initialize_field($array['percentages']['of_links'], $link); |
231 | 231 | $this->_initialize_field($array['percentages']['of_recipients'], $link); |
232 | 232 | |
233 | - $link_data =& $this->_request_data['report']['link_data']; |
|
234 | - $array['percentages']['of_links'][$link->target]['total'] = ($array['counts'][$link->target]['total']/$link_data['total'])*100; |
|
235 | - $array['percentages']['of_links'][$link->target][$link->token] = ($array['counts'][$link->target][$link->token]/$link_data['total'])*100; |
|
233 | + $link_data = & $this->_request_data['report']['link_data']; |
|
234 | + $array['percentages']['of_links'][$link->target]['total'] = ($array['counts'][$link->target]['total'] / $link_data['total']) * 100; |
|
235 | + $array['percentages']['of_links'][$link->target][$link->token] = ($array['counts'][$link->target][$link->token] / $link_data['total']) * 100; |
|
236 | 236 | |
237 | - $receipt_data =& $this->_request_data['report']['receipt_data']; |
|
238 | - $array['percentages']['of_recipients'][$link->target]['total'] = ((count($array['counts'][$link->target])-1)/($receipt_data['sent']-$receipt_data['bounced']))*100; |
|
239 | - $array['percentages']['of_recipients'][$link->target][$link->token] = ($array['counts'][$link->target][$link->token]/($receipt_data['sent']-$receipt_data['bounced']))*100; |
|
237 | + $receipt_data = & $this->_request_data['report']['receipt_data']; |
|
238 | + $array['percentages']['of_recipients'][$link->target]['total'] = ((count($array['counts'][$link->target]) - 1) / ($receipt_data['sent'] - $receipt_data['bounced'])) * 100; |
|
239 | + $array['percentages']['of_recipients'][$link->target][$link->token] = ($array['counts'][$link->target][$link->token] / ($receipt_data['sent'] - $receipt_data['bounced'])) * 100; |
|
240 | 240 | |
241 | - if ( !isset($array['percentages']['of_recipients']['total']) |
|
241 | + if (!isset($array['percentages']['of_recipients']['total']) |
|
242 | 242 | || $array['percentages']['of_recipients'][$link->target]['total'] > $array['percentages']['of_recipients']['total']) { |
243 | 243 | $array['percentages']['of_recipients']['total'] = $array['percentages']['of_recipients'][$link->target]['total']; |
244 | 244 | } |
@@ -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 | } |
@@ -73,7 +73,7 @@ |
||
73 | 73 | $button_config[MIDCOM_TOOLBAR_URL] = $url; |
74 | 74 | //The constants are numeric, so array_merge won't work... |
75 | 75 | foreach ($options as $key => $value) { |
76 | - if ( is_array($value) |
|
76 | + if (is_array($value) |
|
77 | 77 | && !empty($button_config[$key])) { |
78 | 78 | $value = array_merge($button_config[$key], $value); |
79 | 79 | } |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | midcom::get()->auth->require_admin_user(); |
3 | 3 | |
4 | -if ( empty($_POST['to']) |
|
4 | +if (empty($_POST['to']) |
|
5 | 5 | || empty($_POST['from'])) { |
6 | 6 | ?> |
7 | 7 | <h2>Send test email</h2> |
@@ -23,7 +23,7 @@ |
||
23 | 23 | include dirname(__DIR__) . '/config-default.inc.php'; |
24 | 24 | } |
25 | 25 | |
26 | -if (! defined('MIDCOM_STATIC_URL')) { |
|
26 | +if (!defined('MIDCOM_STATIC_URL')) { |
|
27 | 27 | define('MIDCOM_STATIC_URL', '/midcom-static'); |
28 | 28 | } |
29 | 29 |
@@ -48,7 +48,8 @@ |
||
48 | 48 | try { |
49 | 49 | $pdf_helper->render_and_attach(); |
50 | 50 | return $this->reply(true, $this->_l10n->get('pdf created')); |
51 | - } catch (midcom_error $e) { |
|
51 | + } |
|
52 | + catch (midcom_error $e) { |
|
52 | 53 | return $this->reply(false, $this->_l10n->get('pdf creation failed') . ': ' . $e->getMessage()); |
53 | 54 | } |
54 | 55 | } |