Bug 36454: (QA follow-up) Use native is_expired instead of redundant JS calculation
Test plan: 1) $ yarn api:bundle 2) $ koha-plack --restart kohadev 3) Make a patron expired, search for them. Verify the 'expired' badge still shows Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
a35c89fa29
commit
c9c2dc6c7c
3 changed files with 9 additions and 7 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 $("<li></li>")
|
||||
.addClass(loggedInClass)
|
||||
.data("ui-autocomplete-item", item)
|
||||
|
@ -735,7 +729,7 @@ function patron_autocomplete(node, options) {
|
|||
item.library.name.escapeHtml() +
|
||||
"</span>"
|
||||
: "") +
|
||||
(expired
|
||||
(item.expired
|
||||
? '<span class="badge text-bg-warning">' +
|
||||
__("Expired") +
|
||||
"</span>"
|
||||
|
|
Loading…
Reference in a new issue