Skip to content
Snippets Groups Projects
Commit 907cf95c authored by jaapjansma's avatar jaapjansma
Browse files

Fixed issue with multi value filters and not in

parent 80449178
No related branches found
No related tags found
No related merge requests found
......@@ -50,6 +50,7 @@ class MultiValueFieldWhereClause extends AbstractWhereClause implements WhereCla
$this->value = array($this->value);
}
$combine = "OR";
$includeNullStatement = false;
foreach($this->value as $value) {
$escapedValue = '';
try {
......@@ -61,18 +62,23 @@ class MultiValueFieldWhereClause extends AbstractWhereClause implements WhereCla
case 'LIKE':
case 'IN':
case '=':
$clauses[] = "(`$this->table_alias`.`$this->field` LIKE '$compareValue')";
$clauses[] = "`$this->table_alias`.`$this->field` LIKE '$compareValue'";
break;
case 'NOT LIKE':
case 'NOT IN':
case '!=':
$includeNullStatement = true;
$combine = "AND";
$clauses[] = "(`$this->table_alias`.`$this->field` NOT LIKE '$compareValue')";
$clauses[] = "`$this->table_alias`.`$this->field` NOT LIKE '$compareValue'";
break;
}
}
if (count($clauses)) {
return "(" . implode(" $combine ", $clauses) . ")";
$extraStatement = "";
if ($includeNullStatement) {
$extraStatement .= " OR `$this->table_alias`.`$this->field` IS NULL";
}
return "(" . implode(" $combine ", $clauses) . ")" . $extraStatement;
}
return "";
}
......
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