From ba94b6d35c97dd289bf7f33b957085a563ed34e1 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 19 Apr 2018 16:15:51 -0400 Subject: [PATCH] LP#1635354 Support date is/not NULL ACQ searches Adds support for searching on 'date is NULL' in the ACQ unified search interface. To use, chose the 'is' or 'is not' matcher and leave the text input value empty. Update the canned completed invoices search to filter on 'close_date IS NOT NULL' instead of the now-removed 'complete' field. Signed-off-by: Bill Erickson Signed-off-by: Kathy Lussier --- .../perlmods/lib/OpenILS/Application/Acq/Search.pm | 3 +++ Open-ILS/web/js/ui/default/acq/search/unified.js | 12 ++++++++---- 2 files changed, 11 insertions(+), 4 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 9c488b9136..c09fd35543 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Search.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Search.pm @@ -58,6 +58,9 @@ sub castdate { $op = ">=" if $gte; $op = "<=" if $lte; + # avoid transforming a date if the match value is NULL. + return {'=' => undef} if $op eq '=' and not $value; + +{$op => {"transform" => "date", "value" => $value}}; } diff --git a/Open-ILS/web/js/ui/default/acq/search/unified.js b/Open-ILS/web/js/ui/default/acq/search/unified.js index 3aa07c099b..94c0aa7e77 100644 --- a/Open-ILS/web/js/ui/default/acq/search/unified.js +++ b/Open-ILS/web/js/ui/default/acq/search/unified.js @@ -573,9 +573,13 @@ function TermManager() { var value; if (typeof(this.widgets[id].declaredClass) != "undefined") { if (this.widgets[id].declaredClass.match(/Date/)) { - value = - dojo.date.stamp.toISOString(this.widgets[id].value). - split("T")[0]; + if (this.widgets[id].value) { + value = + dojo.date.stamp.toISOString( + this.widgets[id].value).split("T")[0]; + } else { + value = null; + } } else { value = this.widgets[id].attr("value"); if (this.widgets[id].declaredClass.match(/Check/)) @@ -946,7 +950,7 @@ function URIManager() { "inv": { "search_object": { "acqinv": [ - {"complete": "f"}, + {"close_date": null}, {"receiver": openils.User.user.ws_ou()} ] }, -- 2.43.2