From 18c9e677691206af1d6900edae9d8a095e720831 Mon Sep 17 00:00:00 2001 From: Andrew Isherwood Date: Wed, 1 May 2019 12:12:14 +0100 Subject: [PATCH] Bug 15260: (follow-up) Fix bug in subtraction prev_open_days can receive either positive or negative numbers and then does the right thing with them. However, we weren't also doing this with the number it receives back from get_push_amt Signed-off-by: Liz Rea Signed-off-by: Josef Moravec --- Koha/Calendar.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Koha/Calendar.pm b/Koha/Calendar.pm index 25299c1c53..775c7755fe 100644 --- a/Koha/Calendar.pm +++ b/Koha/Calendar.pm @@ -310,6 +310,8 @@ sub prev_open_days { while ($self->is_holiday($base_date)) { my $sub_next = $self->get_push_amt($base_date); + # Ensure we're subtracting when we need to be + $sub_next = $sub_next > 0 ? 0 - $sub_next : $sub_next; $base_date->add(days => $sub_next); } -- 2.11.0