https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43838
Bug ID: 43838
Summary: Dayweek pushes dates by a whole week when it should
move to the next open day
Initiative type: ---
Sponsorship ---
status:
Product: Koha
Version: Main
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P5 - low
Component: Circulation
Assignee: [email protected]
Reporter: [email protected]
QA Contact: [email protected]
CC: [email protected], [email protected]
Blocks: 42334
Target Milestone: ---
With useDaysMode (or the daysmode circulation rule) set to 'Dayweek', the
"push to the same weekday" logic is applied in places where it shouldn't,
moving dates a whole week instead of to the nearest open day.
The cause is in Koha::Library::Calendar: next_open_days and prev_open_days
call get_push_amt on every closed day they step over. Under Dayweek,
get_push_amt returns 7 unless the weekday is a weekly closure. So any time
those methods meet a closed day that is not a weekly closure, they jump a
whole week, even when the caller just wants the next/previous open day. This
dates back to bug 15260 (2019), which introduced Dayweek.
Affected cases (library with no weekly closures, closed on Tue 2026-11-10 and
Wed 2026-11-11, Dayweek):
1. ReturnBeforeExpiry: due date clamped to the patron expiry date on a closed
day is moved back with prev_open_days( $datedue, 1 ).
prev_open_days(Wed 11, 1) returns Tue 2026-11-03, expected Mon 2026-11-09.
2. TalkingTech_itiva_outbound.pl: waiting date on a closed day uses
next_open_days( $waiting_date, 1 ) to compute days_since_waiting.
next_open_days(Tue 10, 1) returns Wed 2026-11-18, expected Thu 2026-11-12.
3. Non-weekly loan periods: the syspref description says Dayweek pushes to
"the next open day otherwise", but a 10-day loan from Sat 2026-10-31
(landing on Tue 10) is due Wed 2026-11-18, expected Thu 2026-11-12.
Hourly loans ending on a closed day are affected in the same way, as
addHours uses next_open_days too.
Weekly loan periods should keep pushing to the next open matching weekday,
as documented.
Proposed fix: next_open_days and prev_open_days always step one day at a
time, and only addDays applies the weekly push, for Dayweek and loan periods
that are a whole number of weeks.
This blocks bug 42334, which moves this logic to a new class. Fixing it here
first keeps the fix small enough to be backported.
Referenced Bugs:
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42334
[Bug 42334] Introduce Koha::Calendar::DateCalculator for date arithmetic
--
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]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/