From e1e4252aa8061a079d0f6db9ff5bb94e73c6cda2 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Mon, 27 Apr 2020 16:42:16 -0400 Subject: [PATCH] add __isnotnull as acq search field modifier Signed-off-by: Galen Charlton --- Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Search.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Search.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Search.pm index cd7e852c7e..35965feeaf 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Search.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Search.pm @@ -79,7 +79,7 @@ sub prepare_acqlia_search_and { }; # castdate not supported for acqlia fields: they're all type text - my ($k, $v, $fuzzy, $between, $not, $starts, $ends, $castdate, $gte, $lte, $age, $gt, $lt) = breakdown_term($unit); + my ($k, $v, $fuzzy, $between, $not, $starts, $ends, $castdate, $gte, $lte, $age, $gt, $lt, $notnull) = breakdown_term($unit); my $point = $subquery->{"where"}->{"-and"}; my $term_clause; @@ -101,6 +101,8 @@ sub prepare_acqlia_search_and { push @$point, {"attr_value" => {"<" => $v}}; } elsif ($between and could_be_range($v)) { push @$point, {"attr_value" => {"between" => $v}}; + } elsif ($notnull) { + push @$point, {"attr_value" => {"!=" => undef}}; } elsif (check_1d_max($v)) { push @$point, {"attr_value" => $v}; } else { @@ -208,6 +210,7 @@ sub breakdown_term { $term->{"__age"} ? 1 : 0, $term->{"__gt"} ? 1 : 0, $term->{"__lt"} ? 1 : 0, + $term->{"__isnotnull"} ? 1 : 0, ); } @@ -384,7 +387,7 @@ sub prepare_terms { $outer_clause->{$conj} = [] unless $outer_clause->{$conj}; foreach my $unit (@{$terms->{$class}}) { my $special_clause; - my ($k, $v, $fuzzy, $between, $not, $starts, $ends, $castdate, $gte, $lte, $age, $gt, $lt) = + my ($k, $v, $fuzzy, $between, $not, $starts, $ends, $castdate, $gte, $lte, $age, $gt, $lt, $notnull) = breakdown_term($unit); my $term_clause; @@ -414,6 +417,8 @@ sub prepare_terms { } else { $term_clause = {$k => {between => $v}}; } + } elsif ($notnull) { + $term_clause = {$k => {"!=" => undef}}; } elsif (check_1d_max($v)) { if ($castdate) { $v = castdate($v, $gte, $lte, 0, $gt, $lt); -- 2.11.0