Skip to content
Snippets Groups Projects
Commit d3eb843f authored by Kurund Jalmi's avatar Kurund Jalmi
Browse files

Merge pull request #2255 from pratik-joshi/CRM-14010

CRM-14010 fix : some operators handling was missing for preferredCommunication method where clause logic
parents 72c9c889 4b20f7df
No related branches found
No related tags found
No related merge requests found
...@@ -3744,7 +3744,10 @@ WHERE id IN ( $groupIDs ) ...@@ -3744,7 +3744,10 @@ WHERE id IN ( $groupIDs )
list($name, $op, $value, $grouping, $wildcard) = $values; list($name, $op, $value, $grouping, $wildcard) = $values;
$pref = array(); $pref = array();
if (!is_array($value)) { if (in_array($op, array( 'IS NULL', 'IS NOT NULL', 'IS EMPTY', 'IS NOT EMPTY'))) {
$value = NULL;
}
elseif (!is_array($value)) {
$v = array(); $v = array();
$value = trim($value, ' ()'); $value = trim($value, ' ()');
if (strpos($value, CRM_Core_DAO::VALUE_SEPARATOR) !== FALSE) { if (strpos($value, CRM_Core_DAO::VALUE_SEPARATOR) !== FALSE) {
...@@ -3771,10 +3774,16 @@ WHERE id IN ( $groupIDs ) ...@@ -3771,10 +3774,16 @@ WHERE id IN ( $groupIDs )
$commPref = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method'); $commPref = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method');
$sqlValue = array(); $sqlValue = array();
$showValue = array();
$sql = "contact_a.preferred_communication_method"; $sql = "contact_a.preferred_communication_method";
foreach ($pref as $val) { if (in_array($op, array('IS NULL', 'IS NOT NULL', 'IS EMPTY', 'IS NOT EMPTY'))) {
$sqlValue[] = "( $sql like '%" . CRM_Core_DAO::VALUE_SEPARATOR . $val . CRM_Core_DAO::VALUE_SEPARATOR . "%' ) "; $sqlValue[] = "{$sql} {$op}";
$showValue[] = $commPref[$val]; }
else {
foreach ($pref as $val) {
$sqlValue[] = "( $sql like '%" . CRM_Core_DAO::VALUE_SEPARATOR . $val . CRM_Core_DAO::VALUE_SEPARATOR . "%' ) ";
$showValue[] = $commPref[$val];
}
} }
$this->_where[$grouping][] = "( " . implode(' OR ', $sqlValue) . " )"; $this->_where[$grouping][] = "( " . implode(' OR ', $sqlValue) . " )";
$this->_qill[$grouping][] = ts('Preferred Communication Method') . " $op " . implode(' ' . ts('or') . ' ', $showValue); $this->_qill[$grouping][] = ts('Preferred Communication Method') . " $op " . implode(' ' . ts('or') . ' ', $showValue);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment