Skip to content
Snippets Groups Projects
Commit d5ab5d88 authored by Monish Deb's avatar Monish Deb
Browse files

#2174: Activity Summary report is missing pagination

parent a61fabf2
Branches
Tags
No related merge requests found
......@@ -20,6 +20,7 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form {
protected $_phoneField = FALSE;
protected $_tempTableName;
protected $_tempDurationSumTableName;
protected $_totalRows;
/**
* This report has not been optimised for group filtering.
......@@ -466,7 +467,7 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form {
$this->groupBy(FALSE);
// build the query to calulate duration sum
$sql = "SELECT SUM(activity_civireport.duration) as civicrm_activity_duration_total {$this->_from} {$this->_where} {$this->_groupBy} {$this->_having} {$this->_orderBy} {$this->_limit}";
$sql = "SELECT SQL_CALC_FOUND_ROWS SUM(activity_civireport.duration) as civicrm_activity_duration_total {$this->_from} {$this->_where} {$this->_groupBy} {$this->_having} {$this->_orderBy} {$this->_limit}";
// create temp table to store duration
$this->_tempDurationSumTableName = $this->createTemporaryTable('tempDurationSumTable', "
......@@ -478,6 +479,7 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form {
{$sql}";
CRM_Core_DAO::disableFullGroupByMode();
CRM_Core_DAO::executeQuery($insertQuery);
$this->_totalRows = CRM_Core_DAO::singleValueQuery("SELECT FOUND_ROWS()");
CRM_Core_DAO::reenableFullGroupByMode();
$sql = "SELECT {$this->_tempTableName}.*, {$this->_tempDurationSumTableName}.civicrm_activity_duration_total
......@@ -494,6 +496,16 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form {
return $sql;
}
/**
* Set pager.
*
* @param int $rowCount
*/
public function setPager($rowCount = self::ROW_COUNT_LIMIT) {
$this->_rowsFound = $this->_totalRows;
parent::setPager($rowCount);
}
/**
* Group the fields.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment