|
@@ -37,7 +37,7 @@ discard block |
|
|
block discarded – undo |
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 |
|
|
block discarded – undo |
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 |
|
|
block discarded – undo |
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 |
|
|
block discarded – undo |
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 |
|
|
block discarded – undo |
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 |
|
|
block discarded – undo |
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
|
} |