Skip to content

Commit

Permalink
Merge pull request #13847 from eileenmcnaughton/report_temp
Browse files Browse the repository at this point in the history
Use TempTable methods - bookkeeping report
  • Loading branch information
eileenmcnaughton authored Mar 17, 2019
2 parents 8dc65d8 + a247224 commit 4c86a93
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions CRM/Report/Form/Contribute/Bookkeeping.php
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,6 @@ public function groupBy() {
*/
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
Expand All @@ -618,9 +617,8 @@ public function statistics(&$rows) {

$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}
Expand Down

0 comments on commit 4c86a93

Please sign in to comment.