CRM-18284 -- include returnProperties when orderBy clause is enabled
authorjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Tue, 29 Mar 2016 06:57:31 +0000 (12:27 +0530)
committerjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Tue, 29 Mar 2016 06:57:31 +0000 (12:27 +0530)
CRM/Contact/Selector.php

index 295c569fc82f860b54b66f2d01e434188e4b402f..8375cea074384ddc3bdec4709c0121bec600225c 100644 (file)
@@ -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