From 0b24ceab7b5ceb27b449e8b90eacb4751300114e Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Thu, 13 Feb 2020 12:14:52 -0500 Subject: [PATCH] add support for __gte, __gt, __lte, and _lt for acqlia searches (perl) Signed-off-by: Galen Charlton --- .../perlmods/lib/OpenILS/Application/Acq/Search.pm | 40 ++++++++++++++++++++-- 1 file changed, 38 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 8619f6f13a..2954c482cf 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) = breakdown_term($unit); + my ($k, $v, $fuzzy, $between, $not, $starts, $ends, $castdate, $gte, $lte, $age, $gt, $lt) = breakdown_term($unit); my $point = $subquery->{"where"}->{"-and"}; my $term_clause; @@ -91,6 +91,14 @@ sub prepare_acqlia_search_and { push @$point, {"attr_value" => {"ilike" => $v . "%"}}; } elsif ($ends and not ref $v) { push @$point, {"attr_value" => {"ilike" => "%" . $v}}; + } elsif ($gte and not ref $v) { + push @$point, {"attr_value" => {">=" => $v}}; + } elsif ($lte and not ref $v) { + push @$point, {"attr_value" => {"<=" => $v}}; + } elsif ($gt and not ref $v) { + push @$point, {"attr_value" => {">" => $v}}; + } elsif ($lt and not ref $v) { + push @$point, {"attr_value" => {"<" => $v}}; } elsif ($between and could_be_range($v)) { push @$point, {"attr_value" => {"between" => $v}}; } elsif (check_1d_max($v)) { @@ -113,7 +121,7 @@ sub prepare_acqlia_search_or { foreach my $unit (@$acqlia) { # castdate not supported for acqlia fields: they're all type text - my ($k, $v, $fuzzy, $between, $not, $starts, $ends) = breakdown_term($unit); + my ($k, $v, $fuzzy, $between, $not, $starts, $ends, $castdate, $gte, $lte, $age, $gt, $lt) = breakdown_term($unit); my $term_clause; if ($fuzzy and not ref $v) { $term_clause = { @@ -136,6 +144,34 @@ sub prepare_acqlia_search_or { "attr_value" => {"ilike" => "%" . $v} } }; + } elsif ($gte and not ref $v) { + $term_clause = { + "-and" => { + "definition" => $k, + "attr_value" => {">=" => $v} + } + }; + } elsif ($lte and not ref $v) { + $term_clause = { + "-and" => { + "definition" => $k, + "attr_value" => {"<=" => $v} + } + }; + } elsif ($gt and not ref $v) { + $term_clause = { + "-and" => { + "definition" => $k, + "attr_value" => {">" => $v} + } + }; + } elsif ($lt and not ref $v) { + $term_clause = { + "-and" => { + "definition" => $k, + "attr_value" => {">" => $v} + } + }; } elsif ($between and could_be_range($v)) { $term_clause = { "-and" => { -- 2.11.0