Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-20169 (possibly wanting refactor of whole report) Added alterReportVar hook support to activity report #9886

Merged
merged 2 commits into from
Jun 26, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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