https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38940
--- Comment #5 from Martin Renvoize (ashimema) <[email protected]> --- Created attachment 188622 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=188622&action=edit Bug 38940: Fix ConsiderLibraryHoursInCirculation when next day has no hours When ConsiderLibraryHoursInCirculation is set to "shorten the loan period and set the checkout to be due at the library's close time", the feature fails to work if the next day has null/blank library hours (e.g., weekends or closed days). The code was incorrectly forcing the system to ignore library hours entirely whenever EITHER today's hours OR tomorrow's hours were undefined. This was too restrictive because: - The 'close' option only needs today's closing time - The 'open' option needs tomorrow's opening time This patch modifies the logic to: 1. Only ignore library hours if today's hours are missing 2. For 'open' mode, require tomorrow's hours to extend the loan 3. For 'close' mode, allow it to work with just today's hours 4. Gracefully handle null tomorrow hours in both code paths Test plan: 1. Apply patch and run tests: prove t/db_dependent/Circulation/CalcDateDue.t prove t/db_dependent/Circulation.t 2. Set up a library with operating hours in Tools > Libraries and hours > [Your library] - Monday-Friday: 09:00-17:00 - Saturday-Sunday: Leave blank (no hours defined) 3. Set system preferences: - ConsiderLibraryHoursInCirculation: shorten the loan period - useDaysMode: Use the calendar to skip days the library is closed 4. Create a circulation rule with hourly loan: - Go to Administration > Circulation and fine rules - Set loan period to 4 hours for a patron category/itemtype 5. On a Friday at 2:00 PM, check out an item with the 4-hour loan rule - Without patch: Due date would be Friday 6:00 PM (ignoring library hours because Saturday has no hours) - With patch: Due date should be Friday 5:00 PM (correctly shortened to library closing time) 6. Verify that checking out at 3:00 PM still shortens to 5:00 PM close 7. Test with ConsiderLibraryHoursInCirculation set to "extend to next opening time" - Checkout should fall back to standard loan duration when next day has no hours (since we can't extend to an undefined opening time) NOTES FOR REVIEW: When ConsiderLibraryHoursInCirculation is set to "extend the loan period to the library's next opening time" and the next day has no defined hours, this patch falls back to using the standard loan duration (ignoring library hours). Question for reviewers: Should we instead roll forward to find the next day that HAS defined opening hours? For example, if checking out Friday evening with the library closed Saturday/Sunday, should we extend the due date to Monday's opening time rather than falling back to ignoring library hours? Sponsored-by: Open Fifth <https://openfith.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/
