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 cc3b298447..71442572e4 100644 --- a/CRM/Upgrade/Incremental/php/FourThree.php +++ b/CRM/Upgrade/Incremental/php/FourThree.php @@ -762,7 +762,7 @@ INSERT INTO civicrm_financial_trxn (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 @@ FROM civicrm_contribution con 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 47a3a0994d..f047bb29fa 100644 --- a/CRM/Upgrade/Incremental/php/FourTwo.php +++ b/CRM/Upgrade/Incremental/php/FourTwo.php @@ -613,7 +613,7 @@ LEFT JOIN civicrm_participant_payment cpp ON cc.id = cpp.contribution_id 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); -- 2.25.1