Bug 25850: (QA follow-up) Match logic in is_holiday
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 29 Jun 2020 08:54:58 +0000 (09:54 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 16 Jul 2020 14:28:02 +0000 (15:28 +0100)
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Koha/Calendar.pm

index f2bc834..0b5ac18 100644 (file)
@@ -246,11 +246,18 @@ sub get_push_amt {
         unless exists $self->{days_mode};
 
     my $dow = $base_date->day_of_week;
+    # Representation fix
+    # DateTime object dow (1-7) where Monday is 1
+    # Arrays are 0-based where 0 = Sunday, not 7.
+    if ( $dow == 7 ) {
+        $dow = 0;
+    }
+
     return (
         # We're using Dayweek useDaysMode option
         $self->{days_mode} eq 'Dayweek' &&
         # It's not a permanently closed day
-        !$self->{weekly_closed_days}->[$dow % 7]
+        !$self->{weekly_closed_days}->[$dow]
     ) ? 7 : 1;
 }