Skip to content

Commit

Permalink
Adapt filters with empty and null values in alphanumeric custom fields
Browse files Browse the repository at this point in the history
  • Loading branch information
CsarRamos committed Dec 1, 2020
1 parent 2e68206 commit cdc6731
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions CRM/Report/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -2103,9 +2103,25 @@ public function whereClause(&$field, $op, $value, $min, $max) {
break;

case 'nll':
if ($type == 'String') {
$sqlOP = $this->getSQLOperator($op);
$clause = "( {$field['dbAlias']} $sqlOP OR {$field['dbAlias']} = '' )";
}
else {
$sqlOP = $this->getSQLOperator($op);
$clause = "( {$field['dbAlias']} $sqlOP )";
}
break;

case 'nnll':
$sqlOP = $this->getSQLOperator($op);
$clause = "( {$field['dbAlias']} $sqlOP )";
if ($type == 'String') {
$sqlOP = $this->getSQLOperator($op);
$clause = "( {$field['dbAlias']} $sqlOP AND {$field['dbAlias']} <> '' )";
}
else {
$sqlOP = $this->getSQLOperator($op);
$clause = "( {$field['dbAlias']} $sqlOP )";
}
break;

case 'eq':
Expand Down

0 comments on commit cdc6731

Please sign in to comment.