From 2e4895a923d5c5569c9ffa7504ac3c08170762e3 Mon Sep 17 00:00:00 2001 From: Sophie Meynieux Date: Wed, 16 Nov 2016 16:46:04 +0100 Subject: [PATCH] [SIGNED OFF] Bug 11580 - If returnBeforeExpiry is ON, use calendar to calculate return date not on closed day (depending on useDaysMode) Test plan: 1. ReturnBeforeExpiry is activated 2. useDaysMode is different from "circulation rules only" 3. Set expiry date of a patron to a near date 4. Set a closed day on calendar for this date 5. Do a checkout Without patch, return date will be patron expiration date With the patch, return date will be last open day before patron expiration day Signed-off-by: Claire Gravely Signed-off-by: Katrin Fischer --- C4/Circulation.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index fba723f..7434d64 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -3513,6 +3513,11 @@ sub CalcDateDue { $datedue = $expiry_dt->clone->set_time_zone( C4::Context->tz ); } } + if ( C4::Context->preference('useDaysMode') ne 'Days' ) { + # Don't return on a closed day + my $calendar = Koha::Calendar->new( branchcode => $branch ); + $datedue = $calendar->prev_open_day( $datedue ); + } } return $datedue; -- 2.7.4