Commit 0e7133be authored by eileen's avatar eileen

Call getSearchSQLParts to get the desired part instead of sql wrangling

parent fe3416bf
......@@ -273,17 +273,17 @@ class CRM_Campaign_Selector_Search extends CRM_Core_Selector_Base implements CRM
$cacheKey = "civicrm search {$this->_key}";
Civi::service('prevnext')->deleteItem(NULL, $cacheKey, 'civicrm_contact');
$sql = $this->_query->getSearchSQL(0, 0, $sort,
$sql = $this->_query->getSearchSQLParts(0, 0, $sort,
FALSE, FALSE,
FALSE, FALSE,
$this->_campaignWhereClause,
NULL,
$this->_campaignFromClause
);
list($select, $from) = explode(' FROM ', $sql);
$selectSQL = "
SELECT %1, contact_a.id, contact_a.display_name
FROM {$from}
FROM {$sql['from']}
";
try {
......
......@@ -555,15 +555,12 @@ WHERE id IN ( $groupIDs )
);
$query->_useDistinct = FALSE;
$query->_useGroupBy = FALSE;
$searchSQL
= $query->searchQuery(
$sqlParts = $query->getSearchSQLParts(
0, 0, NULL,
FALSE, FALSE,
FALSE, TRUE,
TRUE,
NULL, NULL, NULL,
TRUE
FALSE, TRUE
);
$searchSQL = "{$sqlParts['select']} {$sqlParts['from']} {$sqlParts['where']} {$sqlParts['having']} {$sqlParts['group_by']}";
}
$groupID = CRM_Utils_Type::escape($groupID, 'Integer');
$sql = $searchSQL . " AND contact_a.id NOT IN (
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment