Bug 41898: Fix callers of bookings API after removing server-side active filter

The bookings REST controller previously applied filter_by_active (status IN
'new','issued') as a server-side pre-filter. Removing that pre-filter means
callers that relied on it must now supply an explicit status filter.

- pendingbookings.tt: add status filter to additional_filters so the
  pending-bookings-to-collect page still shows only new+issued bookings
- place_booking.js: correct status values from the obsolete 'pending','active'
  (never valid in the schema) to the correct 'new','issued'

Test plan:
1. Navigate to Circulation > Bookings to collect.
   - Confirm only bookings with status "New" or "Issued" are listed.
   - Complete a booking (check out then return the item) and confirm it
     disappears from the list.
2. On any biblio with multiple bookings, open the Place booking modal.
   - Create overlapping bookings where one is completed or cancelled.
   - Confirm the modal does not treat completed/cancelled bookings as active
     conflicts when checking availability.

Sponsored-by: OpenFifth <https://openfifth.co.uk/>
Sponsored-by: Westminster City Council <https://www.westminster.gov.uk/>
Signed-off-by: Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Martin Renvoize 2026-06-08 15:06:15 +01:00 committed by Pedro Amorim
parent c7673a9d6a
commit bf8237ae54
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
2 changed files with 4 additions and 1 deletions

View File

@ -134,6 +134,9 @@
};
$(document).ready(function () {
let additional_filters = {
status: function () {
return { "-in": ["new", "issued"] };
},
start_date: function () {
let fromdate = $("#from");
let isoFrom;

View File

@ -422,7 +422,7 @@ $("#placeBookingModal").on("show.bs.modal", function (e) {
"/api/v1/bookings?biblio_id=" +
biblionumber +
"&_per_page=-1" +
'&q={"status":{"-in":["new","pending","active"]}}',
'&q={"status":{"-in":["new","issued"]}}',
dataType: "json",
type: "GET",
});