[Bug 40665] New: Add booking_id field to issues to link checkouts to bookings that were fulfilled by them
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40665 Bug ID: 40665 Summary: Add booking_id field to issues to link checkouts to bookings that were fulfilled by them Change sponsored?: --- Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement 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 Following the work on Bug 40296, we should add a way to link checkouts back to the bookings that were fulfilled through them. -- 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=40665 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |40296 Circulation| |Bookings function| | CC| |paul.derscheid@lmscloud.de Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40296 [Bug 40296] Bookings that are checked out do not have status updated to completed -- 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=40665 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=40665 --- Comment #1 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Created attachment 185516 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=185516&action=edit Bug 40665: Atomic update -- 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=40665 --- Comment #2 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Created attachment 185517 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=185517&action=edit [DO NOT PUSH] Bug 40665: DBIC -- 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=40665 --- Comment #3 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Created attachment 185518 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=185518&action=edit Bug 40665: Add tests -- 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=40665 --- Comment #4 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Created attachment 185519 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=185519&action=edit Bug 40665: API spec changes -- 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=40665 --- Comment #5 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Created attachment 185520 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=185520&action=edit Bug 40665: Link checkouts to bookings This patch adds a booking_id field to the issues and old_issues tables to create a linkage between checkouts and the bookings that generated them. When a patron with a booking checks out the reserved item, the checkout is linked to their booking and the booking status is updated to 'completed'. The booking_id is preserved during renewals and when checkouts are moved to old_issues upon return. Database changes: - Add booking_id column to issues and old_issues tables - Add foreign key constraints to maintain referential integrity Test plan: 1. Apply the database update 2. Restart services 3. Create a booking for a patron 4. When the patron checks out the booked item: a. Verify the checkout links to the booking (booking_id is set) b. Verify the booking status changes to 'completed' 5. Renew the checkout a. Verify the booking_id is preserved after renewal b. Check the database: SELECT booking_id FROM issues WHERE issue_id = X 6. Return the item a. Verify the checkout moves to old_issues b. Verify the booking_id is preserved in old_issues 7. Test the new Koha::Booking methods: a. For a booking with a checkout, verify $booking->checkout returns the correct Koha::Checkout object b. For a booking with an old checkout, verify $booking->old_checkout returns the correct Koha::Old::Checkout object 8. Test the API: a. Verify checkout endpoints include booking_id in responses b. Verify the booking relationship can be embedded using x-koha-embed: booking 9. Run the test suite: prove t/db_dependent/Circulation.t prove t/db_dependent/Koha/Booking.t prove t/db_dependent/Koha/Checkout.t NOTE: I also thought about the inverse: linking to a checkout from the booking, but as Koha is a circulation centric system, this approach makes more sense in my opinion. I also thought about bidirectional linking via FKs but that is too much maintenance overhead (and potential error source) that we don't need. The inverse lookups should still be performant through the FKs. -- 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=40665 --- Comment #6 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 185895 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=185895&action=edit Bug 40665: Database update This patch updates the database schema to add booking_id foreign key columns to both issues and old_issues tables, enabling the linkage between checkouts and the bookings that generated them. Schema changes: - Add booking_id column to issues and old_issues tables - Add foreign key constraints referencing bookings table - Preserve referential integrity with appropriate CASCADE actions Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- 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=40665 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #185518|0 |1 is obsolete| | --- Comment #7 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 185896 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=185896&action=edit Bug 40665: Add tests Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- 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=40665 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #185519|0 |1 is obsolete| | --- Comment #8 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 185897 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=185897&action=edit Bug 40665: API spec changes Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- 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=40665 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #185520|0 |1 is obsolete| | --- Comment #9 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 185898 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=185898&action=edit Bug 40665: Link checkouts to bookings This patch adds a booking_id field to the issues and old_issues tables to create a linkage between checkouts and the bookings that generated them. When a patron with a booking checks out the reserved item, the checkout is linked to their booking and the booking status is updated to 'completed'. The booking_id is preserved during renewals and when checkouts are moved to old_issues upon return. Database changes: - Add booking_id column to issues and old_issues tables - Add foreign key constraints to maintain referential integrity Test plan: 1. Apply the database update 2. Restart services 3. Create a booking for a patron 4. When the patron checks out the booked item: a. Verify the checkout links to the booking (booking_id is set) b. Verify the booking status changes to 'completed' 5. Renew the checkout a. Verify the booking_id is preserved after renewal b. Check the database: SELECT booking_id FROM issues WHERE issue_id = X 6. Return the item a. Verify the checkout moves to old_issues b. Verify the booking_id is preserved in old_issues 7. Test the new Koha::Booking methods: a. For a booking with a checkout, verify $booking->checkout returns the correct Koha::Checkout object b. For a booking with an old checkout, verify $booking->old_checkout returns the correct Koha::Old::Checkout object 8. Test the API: a. Verify checkout endpoints include booking_id in responses b. Verify the booking relationship can be embedded using x-koha-embed: booking 9. Run the test suite: prove t/db_dependent/Circulation.t prove t/db_dependent/Koha/Booking.t prove t/db_dependent/Koha/Checkout.t NOTE: I also thought about the inverse: linking to a checkout from the booking, but as Koha is a circulation centric system, this approach makes more sense in my opinion. I also thought about bidirectional linking via FKs but that is too much maintenance overhead (and potential error source) that we don't need. The inverse lookups should still be performant through the FKs. Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- 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=40665 --- Comment #10 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 185899 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=185899&action=edit Bug 40665: DBIC Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- 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=40665 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@openfifth.c | |o.uk Attachment #185516|0 |1 is obsolete| | -- 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=40665 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #185517|0 |1 is obsolete| | -- 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=40665 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- 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=40665 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- 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=40665 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |me@paulderscheid.xyz |ity.org | QA Contact|testopia@bugs.koha-communit |martin.renvoize@openfifth.c |y.org |o.uk -- 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=40665 --- Comment #11 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 186250 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186250&action=edit Bug 40665: (RM follow-up) Adjust number of tests in t/db_dependent/Circulation.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40665 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to main Version(s)| |25.11.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=40665 --- Comment #12 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Nice work everyone! Pushed to main for 25.11 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40665 --- Comment #13 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 186369 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186369&action=edit Bug 40665: Fix Cypress tests Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40665 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@gmail.com --- Comment #14 from Jonathan Druart <jonathan.druart@gmail.com> --- (In reply to Jonathan Druart from comment #13)
Created attachment 186369 [details] [review] Bug 40665: Fix Cypress tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Pushed to main. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40665 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |additional_work_needed --- Comment #15 from Jonathan Druart <jonathan.druart@gmail.com> --- Koha_Main_MariaDB_update is failing: https://jenkins.koha-community.org/job/Koha_Main_MariaDB_update/261/consoleF... 22:29:35 koha-1 | -foreign key linking this checkout to the booking it fulfills 22:29:35 koha-1 | +foreign key linking this checkout to the booking it fulfilled -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40665 --- Comment #16 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 187589 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=187589&action=edit Bug 40665: (follow-up) Sync comment for booking_id column -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40665 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com Keywords|additional_work_needed | --- Comment #17 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- follow-up pushed to main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40665 --- Comment #18 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 187673 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=187673&action=edit Bug 40665: Fix DB struct diff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40665 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #187673|0 |1 is obsolete| | --- Comment #19 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 187699 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=187699&action=edit Bug 40665: Fix DB struct diff Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40665 --- Comment #20 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- follow-up pushed to main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40665 Laura Escamilla <Laura.escamilla@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |Laura.escamilla@bywatersolu | |tions.com Status|Pushed to main |Needs documenting --- Comment #21 from Laura Escamilla <Laura.escamilla@bywatersolutions.com> --- This is an enhancement and will not be backported to the 25.05.x branch. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org