https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40296

--- Comment #4 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 183744
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=183744&action=edit
Bug 40296: (follow-up) Fix booking patron ownership and cancellation logic

This follow-up addresses critical issues in the initial implementation:

1. **Patron Ownership Check**: Only mark bookings as 'completed' when
   the patron checking out the item is the same patron who made the booking

2. **Smart Cancellation**: When another patron checks out an item that
   conflicts with an existing booking:
   - Cancel the booking only if checkout overlaps with actual booking period
   - Respect lead/trail periods - don't cancel if conflict is only during
     preparation periods (allows librarian override scenarios)

3. **Date Logic**: Proper overlap detection using start_date and end_date
   rather than periods extended by lead time

This prevents incorrect booking completion and handles librarian override
scenarios appropriately.

Test plan:
1. Apply previous patch and this follow-up
2. Enable bookings and create a bookable item

Test A - Patron's own booking completion:
3. Create booking for Patron A: start = today, end = +7 days
4. Check out item to Patron A (due date = +5 days)
5. Verify booking status = 'completed'

Test B - Another patron's booking cancellation:
6. Return the item, create new booking for Patron A: start = +2 days, end = +6
days
7. Check out item to Patron B (due date = +4 days) - may need override
8. Verify Patron A's booking status = 'cancelled'

Test C - Lead period override scenario:
9. Return item, set bookings_lead_period circulation rule = 3 days
10. Create booking for Patron A: start = +5 days, end = +8 days
11. Check out item to Patron B (due date = +4 days) - conflicts with lead
period
12. Override the booking conflict warning
13. Verify Patron A's booking status remains 'new' (not cancelled)
14. This respects librarian's decision that item will return in time

Test D - No booking scenario:
15. Return item, ensure no active bookings exist
16. Check out item to any patron
17. Verify checkout works normally without errors

-- 
You are receiving this mail because:
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/

Reply via email to