@@ -, +, @@ redundant JS calculation --- Koha/Patron.pm | 4 ++++ api/v1/swagger/definitions/patron.yaml | 4 ++++ koha-tmpl/intranet-tmpl/prog/js/staff-global.js | 8 +------- 3 files changed, 9 insertions(+), 7 deletions(-) --- a/Koha/Patron.pm +++ a/Koha/Patron.pm @@ -2519,6 +2519,10 @@ sub to_api { ? Mojo::JSON->true : Mojo::JSON->false; + $json_patron->{expired} = ( $self->is_expired ) + ? Mojo::JSON->true + : Mojo::JSON->false; + return $json_patron; } --- a/api/v1/swagger/definitions/patron.yaml +++ a/api/v1/swagger/definitions/patron.yaml @@ -209,6 +209,10 @@ properties: - boolean - "null" description: set to 1 if library marked this patron as having lost his card + expired: + type: boolean + readOnly: true + description: If patron is expired restricted: type: boolean readOnly: true --- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js +++ a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js @@ -695,12 +695,6 @@ 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) @@ -735,7 +729,7 @@ function patron_autocomplete(node, options) { item.library.name.escapeHtml() + "" : "") + - (expired + (item.expired ? '' + __("Expired") + "" --