From e4a6d756763b3aec53d7eea5c1e25e47edb38805 Mon Sep 17 00:00:00 2001 From: Paul Derscheid Date: Mon, 5 Aug 2024 13:41:23 +0000 Subject: [PATCH] Bug 37141: (follow-up) Check for expired bookings when rendering bookings table We preserve the existing logic of this bug and add another case for when we just encounter expired bookings. In that case we render the fieldset without the 'filtered' class and determine the value of filter_expired in bookings.js by the class being set. Signed-off-by: David Nind Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer --- .../intranet-tmpl/prog/en/includes/patron-detail-tabs.inc | 6 ++++++ koha-tmpl/intranet-tmpl/prog/js/tables/bookings.js | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-detail-tabs.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-detail-tabs.inc index 84b33bafd6..bf6de17daf 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-detail-tabs.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-detail-tabs.inc @@ -25,6 +25,7 @@ [% END %] [% WRAPPER tab_item tabname="bookings" %] [% SET bookings_count = patron.bookings.filter_by_active.count %] + [% SET expired_bookings_count = patron.bookings.count - bookings_count %] Bookings ([% bookings_count || 0 | html %]) [% END %] [% END %] @@ -218,6 +219,11 @@ Show expired
+ [% ELSIF ( expired_bookings_count ) %] +
+ Hide expired +
+
[% ELSE %]

Patron has nothing booked.

[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/tables/bookings.js b/koha-tmpl/intranet-tmpl/prog/js/tables/bookings.js index 08fcc4f6ae..781455fecf 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/tables/bookings.js +++ b/koha-tmpl/intranet-tmpl/prog/js/tables/bookings.js @@ -2,8 +2,10 @@ // Bookings var bookings_table; $(document).ready(function () { + // Determine whether we have a filtered list + let filter_expired = $("#expired_filter").hasClass('filtered'); + // Load bookings table on tab selection - let filter_expired = true; $("#bookings-tab").on("click", function () { let additional_filters = { patron_id: patron_borrowernumber, -- 2.39.5