[Koha-bugs] [Bug 25850] New: CalcDateDue freezes with 'useDaysMode' set to 'Daysweek' and the due date lands on a sunday.
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Tue Jun 23 15:53:02 CEST 2020
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25850
Bug ID: 25850
Summary: CalcDateDue freezes with 'useDaysMode' set to
'Daysweek' and the due date lands on a sunday.
Change sponsored?: ---
Product: Koha
Version: 19.11
Hardware: All
OS: All
Status: NEW
Severity: major
Priority: P5 - low
Component: Circulation
Assignee: koha-bugs at lists.koha-community.org
Reporter: andreas.jonsson at kreablo.se
QA Contact: testopia at bugs.koha-community.org
CC: gmcharlt at gmail.com, kyle.m.hall at gmail.com
>From the DateTime manual page:
$dt->day_of_week()
Returns the day of the week as a number, from 1..7, with 1 being Monday
and 7 being Sunday.
Also available as "$dt->wday()" and "$dt->dow()".
But the method "get_push_amt" assumes that day_of_week is numbered 0..6 with 0
being Sunday. (Also, there is a funny equality test of a boolean value and the
number 1.)
The result is that for Sundays, $self->{weekly_closed_days}->[$dow] is
undefined and its negation is thus true, which results in a push_amt of seven
days, which lands on the next Sunday and the process repeats.
sub get_push_amt {
my ( $self, $base_date) = @_;
my $dow = $base_date->day_of_week;
return (
# We're using Dayweek useDaysMode option
$self->{days_mode} eq 'Dayweek' &&
# It's not a permanently closed day
!$self->{weekly_closed_days}->[$dow] == 1
) ? 7 : 1;
}
--
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
More information about the Koha-bugs
mailing list