From 94cb2350bb60005f9ce1251b48c43b1a34c6d460 Mon Sep 17 00:00:00 2001 From: atif-shaikh Date: Tue, 9 Sep 2014 18:45:12 +0530 Subject: [PATCH] CRM-15231 - Fatal error on search when ACLs are enabled https://issues.civicrm.org/jira/browse/CRM-15231 --- CRM/Contact/BAO/Query.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 84ed1af12c..c4431c9ec1 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -4597,6 +4597,7 @@ civicrm_relationship.is_permission_a_b = 0 } // note : this modifies _fromClause and _simpleFromClause + $this->_sort = $sort; $this->includePseudoFieldsJoin($sort); list($select, $from, $where, $having) = $this->query($count, $sortByChar, $groupContacts, $onlyDeleted); @@ -4694,13 +4695,11 @@ civicrm_relationship.is_permission_a_b = 0 if (!$count) { $this->_useDistinct = TRUE; } - - if (empty($this->_fromClause)) { - $this->_fromClause = self::fromClause($this->_tables, NULL, NULL, $this->_primaryLocation, $this->_mode); - } - - if (empty($this->_simpleFromClause)) { - $this->_simpleFromClause = self::fromClause($this->_whereTables, NULL, NULL, $this->_primaryLocation, $this->_mode); + //CRM-15231 + $this->_fromClause = self::fromClause($this->_tables, NULL, NULL, $this->_primaryLocation, $this->_mode); + $this->_simpleFromClause = self::fromClause($this->_whereTables, NULL, NULL, $this->_primaryLocation, $this->_mode); + if (!empty($_GET['crmSID'])) { + $this->includePseudoFieldsJoin($this->_sort); } } } -- 2.25.1