From a24722475ff8fbfb7c8ad34a9397f07663dde0b2 Mon Sep 17 00:00:00 2001 From: mark burdett Date: Mon, 18 Mar 2019 10:54:07 +1300 Subject: [PATCH] Use TempTable methods - bookkeeping report --- CRM/Report/Form/Contribute/Bookkeeping.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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} -- 2.25.1