From 770ca0736ccfb651510d63122d007924fcae92be Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Mon, 16 Sep 2024 08:53:33 +0000 Subject: [PATCH] Bug 36454: Add 'expired' information on patron auto complete results Test plan: 1) Alter the 'Expiry date' of any patron. 2) Search for that patron on any search input that provides auto complete results (e.g. top 'Search patrons' input) 3) Notice the expired patron has a 'expired' indication. Those who aren't do not. Signed-off-by: Owen Leonard --- koha-tmpl/intranet-tmpl/prog/js/staff-global.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js index e357c8b398..baa34c4d7b 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js @@ -674,6 +674,12 @@ function patron_autocomplete(node, options) { } else { loggedInClass = ""; } + let new_date = new Date(); + let today = Date.parse($date_to_rfc3339($date(new_date.toString()))); + let expiration = Date.parse( + $date_to_rfc3339($date(item.expiry_date.toString())) + ); + let expired = today > expiration; return $("
  • ") .addClass(loggedInClass) .data("ui-autocomplete-item", item) @@ -709,6 +715,11 @@ function patron_autocomplete(node, options) { "" : "") + "" + + (expired + ? '' + + __("expired") + + "" + : "") + "" ) .appendTo(ul); -- 2.39.5