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 <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
996298340f
commit
00adeb397f
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue