Skip to content

Commit

Permalink
CRM-20169 Added alterReportVar hook support to activity report
Browse files Browse the repository at this point in the history
----------------------------------------
* CRM-20169: Add support for alterReportVar hook in Activity Report
  https://issues.civicrm.org/jira/browse/CRM-20169
  • Loading branch information
Edzelopez committed Feb 23, 2017
1 parent 12ec5bb commit ff42925
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions CRM/Report/Form/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -859,10 +859,9 @@ public function postProcess() {
}
}
$this->limit();
$groupByFromSelect = CRM_Contact_BAO_Query::getGroupByFromSelectColumns($this->_selectClauses, 'civicrm_activity_id');
$sql = "{$this->_select}
FROM civireport_activity_temp_target tar
{$groupByFromSelect} {$this->_having} {$this->_orderBy} {$this->_limit}";

$this->getSQLQuery($sql);

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

// format result set.
Expand Down Expand Up @@ -1107,4 +1106,19 @@ public function sectionTotals() {
}
}

/**
* Function to add alterReportVar hook support.
*
* @param string $sql
* The final SQL required to build the report.
**/
public function getSQLQuery(&$sql) {
$this->_from = " FROM civireport_activity_temp_target tar ";
$this->_groupBy = CRM_Contact_BAO_Query::getGroupByFromSelectColumns($this->_selectClauses, 'civicrm_activity_id');

CRM_Utils_Hook::alterReportVar('sql', $this, $this);

$sql = "{$this->_select} {$this->_from} {$this->_where} {$this->_groupBy} {$this->_having} {$this->_orderBy} {$this->_limit}";
}

}

0 comments on commit ff42925

Please sign in to comment.