From 5dc24de022a91cce45921e6ac80f01d486a3a5c1 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Mon, 22 Mar 2021 17:55:22 +1100 Subject: [PATCH] Fix issue with no group by sql_mode --- CRM/Contact/BAO/GroupContactCache.php | 2 ++ tests/phpunit/CiviTest/CiviUnitTestCase.php | 1 + 2 files changed, 3 insertions(+) diff --git a/CRM/Contact/BAO/GroupContactCache.php b/CRM/Contact/BAO/GroupContactCache.php index b63e2c49d0..defc740039 100644 --- a/CRM/Contact/BAO/GroupContactCache.php +++ b/CRM/Contact/BAO/GroupContactCache.php @@ -483,6 +483,8 @@ WHERE id IN ( $groupIDs ) CRM_Core_DAO::executeQuery("INSERT IGNORE INTO $tempTable (group_id, contact_id) {$contactQuery}"); } + CRM_Core_DAO::reenableFullGroupByMode(); + if ($group->children) { // Store a list of contacts who are removed from the parent group diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index 9fd3369ab6..1792a1c229 100644 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -3800,6 +3800,7 @@ WHERE a1.is_primary = 0 $currentModes = array_fill_keys(CRM_Utils_SQL::getSqlModes(), 1); $currentModes = array_merge($currentModes, array_fill_keys($modes, 1)); CRM_Core_DAO::executeQuery("SET GLOBAL sql_mode = '" . implode(',', array_keys($currentModes)) . "'"); + CRM_Core_DAO::executeQuery("SET sql_mode = '" . implode(',', array_keys($currentModes)) . "'"); } } -- 2.25.1