From d5ab5d8832cca8dcd8a3aec8a9a0235462490da9 Mon Sep 17 00:00:00 2001 From: Monish Deb Date: Wed, 9 Dec 2020 05:37:40 +0530 Subject: [PATCH] core#2174: Activity Summary report is missing pagination --- CRM/Report/Form/ActivitySummary.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/CRM/Report/Form/ActivitySummary.php b/CRM/Report/Form/ActivitySummary.php index fe5df28649..6c80399890 100644 --- a/CRM/Report/Form/ActivitySummary.php +++ b/CRM/Report/Form/ActivitySummary.php @@ -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. * -- 2.25.1