https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40665
--- Comment #5 from Paul Derscheid <[email protected]> --- 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. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
