X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FReport%2FForm%2FActivitySummary.php;h=2450a20eb6283f8c5969da95bb6d3a2ec2e31e31;hb=47e886934211c581107274f2d2b0a19e817ab46c;hp=bf584a59f89f40dd5d139ea66d71a581589518af;hpb=f1195cae6d39dfe0dfa53a424add819afa0dca52;p=civicrm-core.git diff --git a/CRM/Report/Form/ActivitySummary.php b/CRM/Report/Form/ActivitySummary.php index bf584a59f8..2450a20eb6 100644 --- a/CRM/Report/Form/ActivitySummary.php +++ b/CRM/Report/Form/ActivitySummary.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 5 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2018 | + | Copyright CiviCRM LLC (c) 2004-2019 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -28,7 +28,7 @@ /** * * @package CRM - * @copyright CiviCRM LLC (c) 2004-2018 + * @copyright CiviCRM LLC (c) 2004-2019 */ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form { @@ -532,9 +532,6 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form { } CRM_Utils_Hook::alterReportVar('sql', $this, $this); - // store the duration count in temp table - $this->_tempTableName = CRM_Core_DAO::createTempTableName('civicrm_activity'); - // build temporary table column names base on column headers of result $dbColumns = array(); foreach ($this->_columnHeaders as $fieldName => $dontCare) { @@ -542,10 +539,9 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form { } // create temp table to store main result - $tempQuery = "CREATE TEMPORARY TABLE {$this->_tempTableName} ( - id int unsigned NOT NULL AUTO_INCREMENT, " . implode(', ', $dbColumns) . ' , PRIMARY KEY (id))' - . $this->_databaseAttributes; - CRM_Core_DAO::executeQuery($tempQuery); + $this->_tempTableName = $this->createTemporaryTable('tempTable', " + id int unsigned NOT NULL AUTO_INCREMENT, " . implode(', ', $dbColumns) . ' , PRIMARY KEY (id)', + TRUE); // build main report query $sql = "{$this->_select} {$this->_from} {$this->_where} {$this->_groupBy} {$this->_having} {$this->_orderBy} {$this->_limit}"; @@ -565,11 +561,9 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form { $sql = "SELECT 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 = CRM_Core_DAO::createTempTableName('civicrm_activity'); - $tempQuery = "CREATE TEMPORARY TABLE {$this->_tempDurationSumTableName} ( - id int unsigned NOT NULL AUTO_INCREMENT, civicrm_activity_duration_total VARCHAR(128), PRIMARY KEY (id))" - . $this->_databaseAttributes; - CRM_Core_DAO::executeQuery($tempQuery); + $this->_tempDurationSumTableName = $this->createTemporaryTable('tempDurationSumTable', " + id int unsigned NOT NULL AUTO_INCREMENT, civicrm_activity_duration_total VARCHAR(128), PRIMARY KEY (id)", + TRUE); // store the result in temporary table $insertQuery = "INSERT INTO {$this->_tempDurationSumTableName} (civicrm_activity_duration_total)