Commit beb596e1 authored by Kurund Jalmi's avatar Kurund Jalmi

CRM-13274, search builder fixes

----------------------------------------
* CRM-13274: Sort by pseudo-constants is broken for search builder
  https://issues.civicrm.org/jira/browse/CRM-13274
parent b884c685
......@@ -4357,6 +4357,14 @@ civicrm_relationship.is_permission_a_b = 0
$this->_whereTables["civicrm_email"] = 1;
$order = str_replace($field, "civicrm_email.{$field}", $order);
break;
default:
//CRM-12565 add "`" around $field if it is a pseudo constant
foreach ($this->_pseudoConstantsSelect as $key => $value) {
if (!empty($value['element']) && $value['element'] == $field) {
$order = str_replace($field, "`{$field}`", $order);
}
}
}
$this->_fromClause = self::fromClause($this->_tables, NULL, NULL, $this->_primaryLocation, $this->_mode);
$this->_simpleFromClause = self::fromClause($this->_whereTables, NULL, NULL, $this->_primaryLocation, $this->_mode);
......
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