From: mark burdett Date: Sun, 17 Mar 2019 21:54:07 +0000 (+1300) Subject: Use TempTable methods - bookkeeping report X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a24722475ff8fbfb7c8ad34a9397f07663dde0b2;p=civicrm-core.git Use TempTable methods - bookkeeping report --- diff --git a/CRM/Report/Form/Contribute/Bookkeeping.php b/CRM/Report/Form/Contribute/Bookkeeping.php index ee117af7a4..053b8b3718 100644 --- a/CRM/Report/Form/Contribute/Bookkeeping.php +++ b/CRM/Report/Form/Contribute/Bookkeeping.php @@ -602,7 +602,6 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form { */ public function statistics(&$rows) { $statistics = parent::statistics($rows); - $tempTableName = CRM_Core_DAO::createTempTableName('civicrm_contribution'); $financialSelect = "CASE WHEN {$this->_aliases['civicrm_entity_financial_trxn']}_item.entity_id IS NOT NULL THEN {$this->_aliases['civicrm_entity_financial_trxn']}_item.amount ELSE {$this->_aliases['civicrm_entity_financial_trxn']}.amount @@ -618,9 +617,8 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form { $this->groupBy(); - $tempQuery = "CREATE TEMPORARY TABLE {$tempTableName} {$this->_databaseAttributes} AS - {$select} {$this->_from} {$this->_where} {$this->_groupBy} "; - CRM_Core_DAO::executeQuery($tempQuery); + $tempTableName = $this->createTemporaryTable('tempTable', " + {$select} {$this->_from} {$this->_where} {$this->_groupBy} "); $sql = "SELECT COUNT(trxnID) as count, SUM(amount) as amount, currency FROM {$tempTableName}