https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42608
--- Comment #1 from Martin Renvoize (ashimema) <[email protected]> --- Created attachment 199157 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199157&action=edit Bug 42608: Stop hold pickup expiration from week-jumping over closures Koha::Hold::set_waiting calls Koha::Calendar::days_forward to derive the holds-shelf expiration date when ExcludeHolidaysFromMaxPickUpDelay is on. days_forward iterated next_open_days($dt, 1) ReservesMaxPickUpDelay times, and next_open_days consults get_push_amt for every closed day it encounters. Under useDaysMode=Dayweek, get_push_amt returns 7 for any closure that is not a permanently closed weekday -- so an intermediate Bank Holiday Monday inside the pickup window pushed the cursor a whole week forward instead of one day, inflating the expiration by seven days. Dayweek is a loan-due-date concept: it exists to keep a Friday-due loan due on a Friday across closures. A patron does not pick a weekday for a hold-shelf collection; staff set the expiration when they trap the item, and the only thing that should drive it is how many open days the patron should have to come and collect. days_forward is now decoupled from useDaysMode and always counts forward one open day at a time, ignoring closures without consuming them from the count. next_open_days, prev_open_days, get_push_amt and addDays are unchanged -- loan due-date math keeps the existing Dayweek behaviour. Test plan: 1. Inside KTD, run the updated unit tests: prove t/db_dependent/Calendar.t prove t/db_dependent/Hold.t Confirm both pass, including the new Bug 42608 sub-tests. 2. Manual reproduction: - Set sysprefs: useDaysMode=Dayweek, ReservesMaxPickUpDelay=6, ExcludeHolidaysFromMaxPickUpDelay=ON, ExpireReservesOnHolidays=ON. - On a branch, mark Sundays as a weekly closure and add a single holiday on Monday 2026-05-04. - Trap five holds to waiting at that branch with waitingdates 2026-04-27 through 2026-05-01. - Without the patch: expirationdates are 2026-05-11, 2026-05-12, 2026-05-13, 2026-05-14, 2026-05-15 (all +14 calendar days). - With the patch: expirationdates are 2026-05-05, 2026-05-06, 2026-05-07, 2026-05-08, 2026-05-09 (giving the patron 6 open days in every case, skipping Sun 3 May and Mon 4 May). 3. Verify the existing Calendar mode behaviour is unchanged: - Switch useDaysMode to Calendar and repeat step 2 -- the same expected expirationdates should apply. 4. Verify loan due-date behaviour is unchanged: - With useDaysMode=Dayweek, issue an item with a loan period that places its due date on Mon 2026-05-04. Confirm the due date rolls forward by a whole week (the original Dayweek intent), proving this patch did not regress addDays/addDuration. Sponsored-by: OpenFifth <https://openfifth.co.uk/> -- 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/
