else {
$val = CRM_Utils_Type::escape($strtolower(trim($value)), 'String');
- if ($wildcard) {
- $val = $strtolower(CRM_Core_DAO::escapeString($val));
- $val = "%$val%";
+ $specialHTMLType = array(
+ 'CheckBox',
+ 'Multi-Select',
+ 'AdvMulti-Select',
+ 'Multi-Select State/Province',
+ 'Multi-Select Country',
+ );
+
+ if (in_array($field['html_type'], $specialHTMLType)) {
+ $val = "[[:cntrl:]]".$val."[[:cntrl:]]";
+ $op = 'RLIKE';
+
+ } elseif ($wildcard) {
+ $val = "[[:cntrl:]]%$val%[[:cntrl:]]";
$op = 'LIKE';
}
if ($value !== NULL && count($value) > 0) {
$sqlOP = $this->getSQLOperator($op);
$clause
- = "{$field['dbAlias']} REGEXP '[[:<:]]" . implode('|', $value) .
- "[[:>:]]'";
+ = "{$field['dbAlias']} REGEXP '[[:cntrl:]]" . implode('|', $value) .
+ "[[:cntrl:]]'";
}
break;
if ($value !== NULL && count($value) > 0) {
$sqlOP = $this->getSQLOperator($op);
$clause
- = "( {$field['dbAlias']} NOT REGEXP '[[:<:]]" . implode('|', $value) .
- "[[:>:]]' OR {$field['dbAlias']} IS NULL )";
+ = "( {$field['dbAlias']} NOT REGEXP '[[:cntrl:]]" . implode('|', $value) .
+ "[[:cntrl:]]' OR {$field['dbAlias']} IS NULL )";
}
break;