From: Bill Erickson Date: Thu, 19 Apr 2018 20:15:51 +0000 (-0400) Subject: LP#1635354 Support date is/not NULL ACQ searches X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=74117423d6d08def2edf8f584deba6f623a0a4ea;p=working%2FEvergreen.git 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 --- 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()} ] },