Skip to content

Commit

Permalink
CRM-21546: Implement unique opens filter for mailing opened report
Browse files Browse the repository at this point in the history
  • Loading branch information
monishdeb committed Dec 13, 2017
1 parent 72b9dfa commit 191596b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions CRM/Report/Form/Mailing/Opened.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ public function __construct() {
'id' => array(
'required' => TRUE,
'no_display' => TRUE,
'dbAlias' => CRM_Utils_SQL::supportsFullGroupBy() ? 'ANY_VALUE(civicrm_mailing_event_opened.id)' : NULL,
),
'time_stamp' => array(
'title' => ts('Open Date'),
Expand All @@ -191,6 +192,11 @@ public function __construct() {
'operatorType' => CRM_Report_Form::OP_DATE,
'type' => CRM_Utils_Type::T_DATE,
),
'unique_opens' => array(
'title' => ts('Unique Opens'),
'type' => CRM_Utils_Type::T_BOOLEAN,
'pseudofield' => TRUE,
),
),
'order_bys' => array(
'time_stamp' => array(
Expand Down Expand Up @@ -296,6 +302,11 @@ public function groupBy() {
$groupBy = "civicrm_mailing_event_queue.email_id";
}
$this->_groupBy = CRM_Contact_BAO_Query::getGroupByFromSelectColumns($this->_selectClauses, $groupBy);

if (!empty($this->_params['unique_opens_value'])) {
$this->_groupBy .= ", civicrm_mailing_event_queue.id";
$this->_groupBy = str_replace('mailing_event_opened_civireport.id,', '', $this->_groupBy);
}
}

public function postProcess() {
Expand Down

0 comments on commit 191596b

Please sign in to comment.