Skip to content

Commit

Permalink
Merge pull request #9886 from JMAConsulting/CRM-20169
Browse files Browse the repository at this point in the history
CRM-20169 WIP (possibly wanting refactor of whole report) Added alterReportVar hook support to activity report
  • Loading branch information
colemanw authored Jun 26, 2017
2 parents c75c1bd + 49344e3 commit 5502c5c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions CRM/Report/Form/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,8 @@ public function postProcess() {
$this->_formValues["activity_date_time_relative"] = NULL;
}
$this->beginPostProcess();
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);

//Assign those recordtype to array which have filter operator as 'Is not empty' or 'Is empty'
$nullFilters = array();
Expand Down Expand Up @@ -860,9 +862,18 @@ public function postProcess() {
}
$this->limit();
$groupByFromSelect = CRM_Contact_BAO_Query::getGroupByFromSelectColumns($this->_selectClauses, 'civicrm_activity_id');

$this->_aclWhere = "";
$this->buildPermissionClause();

$sql = "{$this->_select}
FROM civireport_activity_temp_target tar
{$groupByFromSelect} {$this->_having} {$this->_orderBy} {$this->_limit}";
FROM civireport_activity_temp_target tar
INNER JOIN civicrm_activity {$this->_aliases['civicrm_activity']} ON {$this->_aliases['civicrm_activity']}.id = tar.civicrm_activity_id
INNER JOIN civicrm_activity_contact {$this->_aliases['civicrm_activity_contact']} ON {$this->_aliases['civicrm_activity_contact']}.activity_id = {$this->_aliases['civicrm_activity']}.id
AND {$this->_aliases['civicrm_activity_contact']}.record_type_id = {$sourceID}
LEFT JOIN civicrm_contact contact_civireport ON contact_civireport.id = {$this->_aliases['civicrm_activity_contact']}.contact_id
WHERE (1) AND {$this->_aclWhere} {$groupByFromSelect} {$this->_having} {$this->_orderBy} {$this->_limit}";

$this->buildRows($sql, $rows);

// format result set.
Expand Down

0 comments on commit 5502c5c

Please sign in to comment.