From: Jitendra Purohit <jitendra@fuzion.co.nz>
Date: Mon, 21 Dec 2020 11:00:25 +0000 (+0530)
Subject: Fix fatal error on contribution summary report -> add to group action
X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ec089f4bf3621b12975a7f8926c5af789a46f94d;p=civicrm-core.git

Fix fatal error on contribution summary report -> add to group action
---

diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php
index b70d4869e6..ceaca5ef39 100644
--- a/CRM/Report/Form.php
+++ b/CRM/Report/Form.php
@@ -4962,7 +4962,11 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a
       $select = preg_replace('/SELECT(\s+SQL_CALC_FOUND_ROWS)?\s+/i', $select, $this->_select);
       $sql = "{$select} {$this->_from} {$this->_where} {$this->_groupBy} {$this->_having} {$this->_orderBy}";
       $sql = str_replace('WITH ROLLUP', '', $sql);
+      if (!$this->optimisedForOnlyFullGroupBy) {
+        CRM_Core_DAO::disableFullGroupByMode();
+      }
       $dao = CRM_Core_DAO::executeQuery($sql);
+      CRM_Core_DAO::reenableFullGroupByMode();
 
       $contact_ids = [];
       // Add resulting contacts to group