From d7c9a291b48ef8303ad9a0c7e869b3ecdded0712 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Sun, 29 Oct 2017 15:17:24 +1100 Subject: [PATCH] CRM-21364 Fix upgrades from 4.2.x for ONLY_FULL_GROUP_BY compatability --- CRM/Upgrade/Incremental/php/FourThree.php | 5 ++--- CRM/Upgrade/Incremental/php/FourTwo.php | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CRM/Upgrade/Incremental/php/FourThree.php b/CRM/Upgrade/Incremental/php/FourThree.php index cc3b29844708..71442572e4e8 100644 --- a/CRM/Upgrade/Incremental/php/FourThree.php +++ b/CRM/Upgrade/Incremental/php/FourThree.php @@ -762,7 +762,7 @@ public function createFinancialRecords() { (contribution_id, payment_instrument_id, currency, total_amount, net_amount, fee_amount, trxn_id, status_id, check_number, to_financial_account_id, from_financial_account_id, trxn_date, payment_processor_id, is_fee) -SELECT con.id, ft.payment_instrument_id, ft.currency, ft.fee_amount, NULL, NULL, ft.trxn_id, %1 as status_id, +SELECT DISTINCT con.id, ft.payment_instrument_id, ft.currency, ft.fee_amount, NULL, NULL, ft.trxn_id, %1 as status_id, ft.check_number, efaFT.financial_account_id as to_financial_account_id, CASE WHEN efaPP.financial_account_id IS NOT NULL THEN efaPP.financial_account_id @@ -782,8 +782,7 @@ public function createFinancialRecords() { AND efaPP.account_relationship = {$assetAccountIs}) LEFT JOIN {$tempTableName1} tpi ON ft.payment_instrument_id = tpi.instrument_id -WHERE ft.fee_amount IS NOT NULL AND ft.fee_amount != 0 AND (con.contribution_status_id IN (%1, %3) OR (con.contribution_status_id =%2 AND con.is_pay_later = 1)) -GROUP BY con.id"; +WHERE ft.fee_amount IS NOT NULL AND ft.fee_amount != 0 AND (con.contribution_status_id IN (%1, %3) OR (con.contribution_status_id =%2 AND con.is_pay_later = 1))"; CRM_Core_DAO::executeQuery($sql, $queryParams); //link financial_trxn to contribution diff --git a/CRM/Upgrade/Incremental/php/FourTwo.php b/CRM/Upgrade/Incremental/php/FourTwo.php index 47a3a0994d25..f047bb29fa0a 100644 --- a/CRM/Upgrade/Incremental/php/FourTwo.php +++ b/CRM/Upgrade/Incremental/php/FourTwo.php @@ -613,7 +613,7 @@ public static function task_4_2_alpha1_convertContributions(CRM_Queue_TaskContex LEFT JOIN civicrm_price_set_entity cpse on cpse.entity_table = 'civicrm_contribution_page' AND cpse.entity_id = cc.contribution_page_id WHERE (cc.id BETWEEN %1 AND %2) AND cli.entity_id IS NULL AND cc.contribution_page_id IS NOT NULL AND cpp.contribution_id IS NULL -GROUP BY cc.id +GROUP BY cc.id, cmp.membership_id "; $result = CRM_Core_DAO::executeQuery($sql, $sqlParams);