acq search: allow searching on an explicit null value
authorGalen Charlton <gmc@equinoxinitiative.org>
Tue, 25 Feb 2020 18:44:35 +0000 (13:44 -0500)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 25 Feb 2020 18:44:35 +0000 (13:44 -0500)
This adjusts the special logic introduced in LP#1031535 so
that explicitly searching with a field set to not null (e.g.,
when using the Angular grid 'exists' filter) will work.

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Search.pm

index 2f5b94b..cd7e852 100644 (file)
@@ -423,7 +423,7 @@ sub prepare_terms {
                 } elsif ($gt or $lt) {
                     my $op = $gt ? '>' : '<';
                     $v = {$op => $v};
-                } elsif (not ref $v and $not) {
+                } elsif (not ref $v and $not and defined($v)) {
                     # the old way, NOT (blah.id = $v) needs to be
                     # (blah.id <> $x OR blah.id IS NULL)
                     $not = 0;   # avoid the regular negative transformation