From cdc67311a533e184cc81885307702b2e24a30fcf Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=A9sar?= Date: Tue, 1 Dec 2020 14:19:07 +0100 Subject: [PATCH] Adapt filters with empty and null values in alphanumeric custom fields --- CRM/Report/Form.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index b70d4869e6..57e30f0637 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -2103,9 +2103,25 @@ class CRM_Report_Form extends CRM_Core_Form { 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': -- 2.25.1