[Bug 41887] New: Booking::store runs clash detection on terminal status transition causing 500 on checkout
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41887 Bug ID: 41887 Summary: Booking::store runs clash detection on terminal status transition causing 500 on checkout Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Circulation Assignee: koha-bugs@lists.koha-community.org Reporter: paul.derscheid@lmscloud.de QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle@bywatersolutions.com - Booking::store runs item-level and biblio-level clash detection unconditionally on every call - During checkout, C4::Circulation sets the booking status to 'completed' and calls ->store(), which triggers these checks - Combined with false positives from Biblio::check_booking (e.g. checkouts on non-bookable sibling items inflating the unavailable count, see Bug XXXXX), this throws Koha::Exceptions::Booking::Clash resulting in an unhandled 500 error - Even without false positives, running clash detection on a terminal transition (completed/cancelled) is unnecessary and should be skipped Steps to reproduce: - Have a biblio with two items: one bookable, one not (bookable = 0). - Create a booking on the bookable item. - Check out the non-bookable item to a patron. - Check out the bookable item to the booking patron. - Expected: Checkout succeeds, booking transitions to completed. - Actual: 500 internal server error from Koha::Exceptions::Booking::Clash. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41887 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Circulation| |Bookings function| | Depends on| |29002 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29002 [Bug 29002] Add ability to book items ahead of time -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41887 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41887 --- Comment #1 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Created attachment 193376 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=193376&action=edit Bug 41887: Skip clash detection on terminal status transition - Booking::store runs item-level and biblio-level clash detection unconditionally on every call - During checkout, C4::Circulation sets the booking status to 'completed' and calls ->store(), which triggers clash checks - Combined with false positives from Biblio::check_booking (e.g. checkouts on non-bookable sibling items inflating the unavailable count), this throws Koha::Exceptions::Booking::Clash resulting in a 500 error - Running clash detection on a terminal transition is unnecessary regardless; skip it for cancelled/completed - Add _is_final_status_transition() helper that inspects the dirty columns to detect completed/cancelled transitions - Guard both clash detection blocks with the new helper To test: 1. Have a biblio with two items: one bookable, one not (bookable = 0). 2. Create a booking on the bookable item. 3. Check out the non-bookable item to a patron. 4. Check out the bookable item to the booking patron (this triggers the completed transition via C4::Circulation). 5. Without the patch: 500 error from Koha::Exceptions::Booking::Clash. 6. Apply the patch. 7. Repeat steps 2-4. 8. Verify the checkout succeeds and the booking transitions to completed. 9. Run: prove t/db_dependent/Koha/Booking.t and confirm the new subtest "store() skips clash detection on terminal status transition" passes. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41887 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41887 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #193376|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41887 --- Comment #2 from David Nind <david@davidnind.com> --- Created attachment 193531 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=193531&action=edit Bug 41887: Skip clash detection on terminal status transition - Booking::store runs item-level and biblio-level clash detection unconditionally on every call - During checkout, C4::Circulation sets the booking status to 'completed' and calls ->store(), which triggers clash checks - Combined with false positives from Biblio::check_booking (e.g. checkouts on non-bookable sibling items inflating the unavailable count), this throws Koha::Exceptions::Booking::Clash resulting in a 500 error - Running clash detection on a terminal transition is unnecessary regardless; skip it for cancelled/completed - Add _is_final_status_transition() helper that inspects the dirty columns to detect completed/cancelled transitions - Guard both clash detection blocks with the new helper To test: 1. Have a biblio with two items: one bookable, one not (bookable = 0). 2. Create a booking on the bookable item. 3. Check out the non-bookable item to a patron. 4. Check out the bookable item to the booking patron (this triggers the completed transition via C4::Circulation). 5. Without the patch: 500 error from Koha::Exceptions::Booking::Clash. 6. Apply the patch. 7. Repeat steps 2-4. 8. Verify the checkout succeeds and the booking transitions to completed. 9. Run: prove t/db_dependent/Koha/Booking.t and confirm the new subtest "store() skips clash detection on terminal status transition" passes. Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41887 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com Assignee|koha-bugs@lists.koha-commun |paul.derscheid@lmscloud.de |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41887 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |martin.renvoize@openfifth.c |y.org |o.uk -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41887 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Sponsorship status|--- |Sponsored Comma delimited| |Büchereizentrale list of Sponsors| |Schleswig-Holstein | |<https://www.bz-sh.de/> Patch complexity|--- |Small patch Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41887 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #193531|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41887 --- Comment #3 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 193775 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=193775&action=edit Bug 41887: Skip clash detection on terminal status transition - Booking::store runs item-level and biblio-level clash detection unconditionally on every call - During checkout, C4::Circulation sets the booking status to 'completed' and calls ->store(), which triggers clash checks - Combined with false positives from Biblio::check_booking (e.g. checkouts on non-bookable sibling items inflating the unavailable count), this throws Koha::Exceptions::Booking::Clash resulting in a 500 error - Running clash detection on a terminal transition is unnecessary regardless; skip it for cancelled/completed - Add _is_final_status_transition() helper that inspects the dirty columns to detect completed/cancelled transitions - Guard both clash detection blocks with the new helper To test: 1. Have a biblio with two items: one bookable, one not (bookable = 0). 2. Create a booking on the bookable item. 3. Check out the non-bookable item to a patron. 4. Check out the bookable item to the booking patron (this triggers the completed transition via C4::Circulation). 5. Without the patch: 500 error from Koha::Exceptions::Booking::Clash. 6. Apply the patch. 7. Repeat steps 2-4. 8. Verify the checkout succeeds and the booking transitions to completed. 9. Run: prove t/db_dependent/Koha/Booking.t and confirm the new subtest "store() skips clash detection on terminal status transition" passes. Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41887 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Comma delimited|Büchereizentrale |Büchereizentrale list of Sponsors|Schleswig-Holstein |Schleswig-Holstein |<https://www.bz-sh.de/> |<https://www.bz-sh.de/> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41887 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to main Version(s)| |26.05.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41887 --- Comment #4 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Nice work everyone! Pushed to main for 26.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41887 Jacob O'Mara <jacob.omara@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to main |Pushed to stable Version(s)|26.05.00 |26.05.00,25.11.04 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41887 --- Comment #5 from Jacob O'Mara <jacob.omara@openfifth.co.uk> --- Thanks all, pushed to 25.11.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41887 Laura Escamilla <Laura.escamilla@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |Laura.escamilla@bywatersolu | |tions.com Status|Pushed to stable |Needs documenting --- Comment #6 from Laura Escamilla <Laura.escamilla@bywatersolutions.com> --- Not backported to 25.05.x, as the patch does not apply cleanly to the branch, but I’m happy to revisit if needed. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41887 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs documenting |RESOLVED Resolution|--- |FIXED --- Comment #7 from David Nind <david@davidnind.com> --- Bug fix, no changes to the manual required. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org