Skip to content

Commit

Permalink
Merge pull request #11829 from eileenmcnaughton/rules
Browse files Browse the repository at this point in the history
Fix regression on CiviRules search due to exception handling
  • Loading branch information
eileenmcnaughton authored Mar 23, 2018
2 parents b0ec856 + 4caab82 commit eda4db7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions CRM/Contact/Selector.php
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,10 @@ public function fillupPrevNextCache($sort, $cacheKey, $start = 0, $end = self::C

$sql = str_replace(array("SELECT contact_a.id as contact_id", "SELECT contact_a.id as id"), $insertSQL, $sql);
try {
CRM_Core_DAO::executeQuery($sql);
$result = CRM_Core_DAO::executeQuery($sql, [], FALSE, NULL, FALSE, TRUE, TRUE);
if (is_a($result, 'DB_Error')) {
throw new CRM_Core_Exception($result->message);
}
}
catch (CRM_Core_Exception $e) {
if ($coreSearch) {
Expand All @@ -1038,7 +1041,10 @@ public function fillupPrevNextCache($sort, $cacheKey, $start = 0, $end = self::C
$this->rebuildPreNextCache($start, $end, $sort, $cacheKey);
}
else {
CRM_Core_Session::setStatus(ts('Query Failed'));
// This will always show for CiviRules :-( as a) it orders by 'rule_label'
// which is not available in the query & b) it uses contact not contact_a
// as an alias.
// CRM_Core_Session::setStatus(ts('Query Failed'));
return;
}
}
Expand Down

0 comments on commit eda4db7

Please sign in to comment.