Bug 39270 - Some bookable items cannot be booked
Summary: Some bookable items cannot be booked
Status: Pushed to stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal
Assignee: Lucas Gass (lukeg)
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-06 23:50 UTC by Lucas Gass (lukeg)
Modified: 2025-03-23 14:15 UTC (History)
4 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.05.00,24.11.03
Circulation function:


Attachments
Bug 39270: Check to make sure checkouts are not already booked (2.70 KB, patch)
2025-03-07 00:04 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 39270: Check to make sure checkouts are not already booked (2.76 KB, patch)
2025-03-17 16:25 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lucas Gass (lukeg) 2025-03-06 23:50:06 UTC
It took me a while to figure this out so please bear with me on the tedious test plan: 

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.
Comment 1 Lucas Gass (lukeg) 2025-03-06 23:50:53 UTC
I don't know if this can manifest in other ways but those are the steps I followed to recreate.
Comment 2 Lucas Gass (lukeg) 2025-03-07 00:00:28 UTC
I think in place_booking.js there is a double count going on and we need to check if the checkout is already booked or not.
Comment 3 Lucas Gass (lukeg) 2025-03-07 00:04:23 UTC
Created attachment 179023 [details] [review]
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.
Comment 4 Martin Renvoize (ashimema) 2025-03-17 16:23:46 UTC
Wow, good catch Lucas!
Comment 5 Martin Renvoize (ashimema) 2025-03-17 16:25:25 UTC
Created attachment 179416 [details] [review]
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>
Comment 6 Martin Renvoize (ashimema) 2025-03-17 16:26:05 UTC
Going strait for a QA here.. the code is clear and sensible and fixes a clear bug now you've highlighted it.

Thanks Lucas.

Passing QA
Comment 7 Katrin Fischer 2025-03-19 10:56:35 UTC
Pushed for 25.05!

Well done everyone, thank you!
Comment 8 Paul Derscheid 2025-03-23 14:09:39 UTC
Nice work everyone!

Pushed to 24.11.x for 24.11.03