From 00adeb397ff6fb9f01dd68a42d7ed136b7afef55 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 17 Nov 2017 09:23:40 +0100 Subject: [PATCH] Bug 19626: (QA follow-up) Small optimization We are only using $calendar when the pref is set. Date calculation can be moved in if-else structure. Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart --- installer/data/mysql/updatedatabase.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index f12d8d0b95..bd60c08606 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -14370,12 +14370,12 @@ if( CheckVersion( $DBversion ) ) { $requested_expiration = dt_from_string($hold->expirationdate); } - my $calendar = Koha::Calendar->new( branchcode => $hold->branchcode ); my $expirationdate = dt_from_string($hold->waitingdate); - $expirationdate->add(days => $max_pickup_delay); - if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) { - $expirationdate = $calendar->days_forward( dt_from_string($hold->waitingdate), $max_pickup_delay ); + my $calendar = Koha::Calendar->new( branchcode => $hold->branchcode ); + $expirationdate = $calendar->days_forward( $expirationdate, $max_pickup_delay ); + } else { + $expirationdate->add( days => $max_pickup_delay ); } my $cmp = $requested_expiration ? DateTime->compare($requested_expiration, $expirationdate) : 0; -- 2.39.5