// mhas == multiple has
if ($value !== NULL && count($value) > 0) {
$sqlOP = $this->getSQLOperator($op);
- $clause
- = "{$field['dbAlias']} REGEXP '[[:cntrl:]]" . implode('|', $value) .
- "[[:cntrl:]]'";
+ $clause = "( {$field['dbAlias']} REGEXP '[[:<:]]" . implode('[[:>:]]|[[:<:]]', $value) . "[[:>:]]' )";
}
break;
// mnot == multiple is not one of
if ($value !== NULL && count($value) > 0) {
$sqlOP = $this->getSQLOperator($op);
- $clause
- = "( {$field['dbAlias']} NOT REGEXP '[[:cntrl:]]" . implode('|', $value) .
- "[[:cntrl:]]' OR {$field['dbAlias']} IS NULL )";
+ $clause = "( {$field['dbAlias']} NOT REGEXP '[[:<:]]" . implode('[[:>:]]|[[:<:]]', $value) . "[[:>:]]' )";
}
break;
if ($fieldName == 'case_type_id') {
$value = CRM_Utils_Array::value("{$fieldName}_value", $this->_params);
if (!empty($value)) {
- $clause = "( {$field['dbAlias']} REGEXP '[[:<:]]" .
+ $operator = '';
+ if ($op == 'notin') {
+ $operator = 'NOT';
+ }
+ $clause = "( {$field['dbAlias']} {$operator} REGEXP '[[:<:]]" .
implode('[[:>:]]|[[:<:]]', $value) . "[[:>:]]' )";
}
$op = NULL;
if ($fieldName == 'rid') {
$value = CRM_Utils_Array::value("{$fieldName}_value", $this->_params);
if (!empty($value)) {
- $clause = "( {$field['dbAlias']} REGEXP '[[:<:]]" .
+ $operator = '';
+ if ($op == 'notin') {
+ $operator = 'NOT';
+ }
+ $clause = "( {$field['dbAlias']} {$operator} REGEXP '[[:<:]]" .
implode('[[:>:]]|[[:<:]]', $value) . "[[:>:]]' )";
}
$op = NULL;