Make return for query more like sql
authoreileen <emcnaughton@wikimedia.org>
Wed, 10 Jul 2019 13:21:41 +0000 (01:21 +1200)
committereileen <emcnaughton@wikimedia.org>
Fri, 12 Jul 2019 03:05:05 +0000 (15:05 +1200)
CRM/Export/BAO/Export.php
CRM/Export/BAO/ExportProcessor.php

index d9d25089b8120403d2f15a76904399e64f89cf23..a72677c9b40b0772ada267d866fdd26916929174 100644 (file)
@@ -201,13 +201,11 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c
     $processor->setComponentTable($componentTable);
     $processor->setComponentClause($componentClause);
 
-    list($query, $select, $from, $where, $having) = $processor->runQuery($params, $order);
+    list($query, $queryString) = $processor->runQuery($params, $order);
 
     // This perhaps only needs calling when $mergeSameHousehold == 1
     self::buildRelatedContactArray($selectAll, $ids, $processor, $componentTable);
 
-    $queryString = "$select $from $where $having";
-
     $groupBy = self::getGroupBy($processor, $query);
 
     $queryString .= $groupBy;
index e40099aa404ed1acbf5552e1787b96f4d0c8bfb8..94526575c88a4e14bc76e56bd0a6a17824366940 100644 (file)
@@ -721,7 +721,7 @@ class CRM_Export_BAO_ExportProcessor {
     list($select, $from, $where, $having) = $query->query();
     $this->setQueryFields($query->_fields);
     $whereClauses = ['trash_clause' => "contact_a.is_deleted != 1"];
-    if ($this->getRequestedFields() && ($this->getComponentTable())){
+    if ($this->getRequestedFields() && ($this->getComponentTable())) {
       $from .= " INNER JOIN " . $this->getComponentTable() . " ctTable ON ctTable.contact_id = contact_a.id ";
     }
     elseif ($this->getComponentClause()) {
@@ -741,7 +741,7 @@ class CRM_Export_BAO_ExportProcessor {
     else {
       $where .= " AND " . implode(' AND ', $whereClauses);
     }
-    return [$query, $select, $from, $where . $addressWhere, $having];
+    return [$query, "$select $from $where $having"];
   }
 
   /**