Bug 39270: Check to make sure checkouts are not already booked

To test:

1. Find an item that is bookable, I turned on Bookable at the item type level for BK. I am using biblionumber=28 in k-t-d with 3 items
2. Book item with barcode ( 39999000001297 ). I did March 7 - April 1
3. Book item with barcode ( 39999000001259 ). I did March 7 - April 1
4. Now checkout 39999000001297 to the patron is was booked to. When asked about early collection say yes.
5. Now item with barcode ( 39999000001273 ) is not checked out or booked. It should be bookable
6. Try to book it, it is not available till April 2, though it should be available right now.
7. APPLY PATCH
8. Try the bookings again.
9. You should correctly not be able to book 39999000001297 or 39999000001259.
10. You should be able to book 39999000001273.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 37c8c6606a)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Lucas Gass 2025-03-07 00:02:30 +00:00 committed by Paul Derscheid
parent d0f50136c8
commit 708f14ce56
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
1 changed files with 14 additions and 9 deletions

View File

@ -354,15 +354,20 @@ $("#placeBookingModal").on("show.bs.modal", function (e) {
// Merge current checkouts into bookings
for (checkout of checkouts) {
let booking = {
biblio_id: biblionumber,
booking_id: null,
end_date: checkout.due_date,
item_id: checkout.item_id,
patron_id: checkout.patron_id,
start_date: new Date().toISOString(),
};
bookings.unshift(booking);
let already_booked = bookings.some(
b => b.item_id === checkout.item_id
);
if (!already_booked) {
let booking = {
biblio_id: biblionumber,
booking_id: null,
end_date: checkout.due_date,
item_id: checkout.item_id,
patron_id: checkout.patron_id,
start_date: new Date().toISOString(),
};
bookings.unshift(booking);
}
}
// Update flatpickr mode