From 7fcc613c2bd45d9090aa4eb5feac8afd4c801bd4 Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Tue, 29 Mar 2016 12:27:31 +0530 Subject: [PATCH] CRM-18284 -- include returnProperties when orderBy clause is enabled --- CRM/Contact/Selector.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CRM/Contact/Selector.php b/CRM/Contact/Selector.php index 295c569fc8..8375cea074 100644 --- a/CRM/Contact/Selector.php +++ b/CRM/Contact/Selector.php @@ -1212,6 +1212,11 @@ SELECT DISTINCT 'civicrm_contact', contact_a.id, contact_a.id, '$cacheKey', cont public function contactIDQuery($params, $action, $sortID, $displayRelationshipType = NULL, $queryOperator = 'AND') { $sortOrder = &$this->getSortOrder($this->_action); $sort = new CRM_Utils_Sort($sortOrder, $sortID); + $includeOrderByClause = Civi::settings()->get('includeOrderByClause'); + $returnProperties = CRM_Contact_BAO_Query::NO_RETURN_PROPERTIES; + if ($includeOrderByClause) { + $returnProperties = $this->_returnProperties; + } // rectify params to what proximity search expects if there is a value for prox_distance // CRM-7021 CRM-7905 @@ -1221,7 +1226,7 @@ SELECT DISTINCT 'civicrm_contact', contact_a.id, contact_a.id, '$cacheKey', cont if (!$displayRelationshipType) { $query = new CRM_Contact_BAO_Query($params, - CRM_Contact_BAO_Query::NO_RETURN_PROPERTIES, + $returnProperties, NULL, FALSE, FALSE, 1, FALSE, TRUE, TRUE, NULL, $queryOperator @@ -1229,7 +1234,7 @@ SELECT DISTINCT 'civicrm_contact', contact_a.id, contact_a.id, '$cacheKey', cont } else { $query = new CRM_Contact_BAO_Query($params, - CRM_Contact_BAO_Query::NO_RETURN_PROPERTIES, + $returnProperties, NULL, FALSE, FALSE, 1, FALSE, TRUE, TRUE, $displayRelationshipType, $queryOperator -- 2.25.1