[Bug 43493] New: Link Koha::Library opening hours with the library Calendar
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43493 Bug ID: 43493 Summary: Link Koha::Library opening hours with the library Calendar Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org Depends on: 43492 Blocks: 36079 Target Milestone: --- Bug 36079 points out that library opening hours and the library Calendar are not linked in any meaningful way: a library can have a weekly closure configured for a day it also has opening hours set for, and nothing reconciles the two - they are entirely separate subsystems that happen to share a library_id foreign key. Building on the library_opening_hours facade from Bug 43492, this bug adds a Koha::Library->opening_hours accessor and makes the facade's availability checks (is_open_at, next_change) consult Koha::Library->calendar->is_holiday first: if the Calendar says the library is closed that day for any reason (weekly closure, repeating closure, single closure, correctly excluding exception-override days), opening hours checks report closed regardless of what hours are configured. This resolves Bug 36079 by composing the two existing facades rather than merging their storage - Calendar remains the source of truth for whether the library is open at all on a given day, and Opening Hours remains the source of truth for which windows it is open during. Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36079 [Bug 36079] Library hours and the Calendar are not linked in any meaningful ways https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43492 [Bug 43492] Normalize library opening hours into a dedicated library_opening_hours table -- 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=43493 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |43495 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Expanding the scope of this bug: it now also covers switching C4::Circulation::CalcDateDue onto the new Koha::Library::OpeningHours facade (previously split out as Bug 43495), including the library_hours to library_opening_hours data migration and dropping the old table. Landing the Calendar linkage together with its actual consumer means the combined patch is testable end to end via a real due date calculation (hourly loan, with both opening hours and a calendar closure configured), rather than being internal-only wiring with no visible behaviour change. Bug 43495 is being closed as a duplicate of this one; its scope is folded in here. Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43495 [Bug 43495] Use the new opening hours facade in circulation due date calculations -- 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=43493 --- Comment #2 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- *** Bug 43495 has been marked as a duplicate of this bug. *** -- 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=43493 --- Comment #3 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- *** Bug 43496 has been marked as a duplicate of this bug. *** -- 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=43493 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|43495 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43495 [Bug 43495] Use the new opening hours facade in circulation due date calculations -- 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=43493 --- Comment #4 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Narrowing this bug's scope back down: the CalcDateDue switch and the library_hours migration/drop have moved into Bug 43492 (see comment there), landing together with the schema/facade rather than as a separate follow-up - this avoids a real intermediate-state problem where the admin UI and circulation would read two different, drifting copies of the data between the two bugs landing. This bug is now just the Calendar linkage: Koha::Library->opening_hours composing with Koha::Library->calendar->is_holiday so opening-hours checks correctly report closed on a calendar closure day regardless of configured hours, resolving Bug 36079. Still depends on Bug 43492, still testable via an actual due date calculation (through the facade CalcDateDue already uses). -- 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=43493 --- Comment #5 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 205407 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205407&action=edit Bug 43493: Link Koha::Library::OpeningHours to the Calendar Adds a lazy calendar accessor to Koha::Library::OpeningHours and an opt-in consider_calendar param on is_open_at, so callers can ask "is this library open right now" and have the answer reflect Calendar holidays as well as configured hours - resolving Bug 36079, where the two subsystems had no knowledge of each other. Deliberately opt-in rather than the default: C4::Circulation::CalcDateDue already uses is_open_at (via Bug 43492) inside its "Days" due-date mode, which is explicitly documented as ignoring the calendar. Making is_open_at unconditionally calendar-aware would silently change that already-submitted behaviour; CalcDateDue is untouched by this patch. Test plan: 1. prove t/db_dependent/Koha/Library/OpeningHours.t 2. Note the new "is_open_at consider_calendar (Bug 36079)" subtest: configure Wednesday 09:00-17:00 hours for a library, add a single Calendar closure for a specific Wednesday, and confirm is_open_at($dt) still says open (hours only) while is_open_at($dt, consider_calendar => 1) says closed for that date, and unaffected Wednesdays are unaffected either way. 3. prove t/db_dependent/Circulation/CalcDateDue.t t/db_dependent/Koha/Library.t t/db_dependent/Koha/Library/Calendar.t to confirm no regressions. -- 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=43493 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |martin.renvoize@openfifth.c |ity.org |o.uk Status|NEW |Needs Signoff QA Contact|testopia@bugs.koha-communit |tomascohen@gmail.com |y.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org