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@lists.koha-community.org
          Reporter: andreas.jons...@kreablo.se
        QA Contact: testo...@bugs.koha-community.org
                CC: gmcha...@gmail.com, kyle.m.h...@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.
_______________________________________________
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
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/

Reply via email to