From a08b309c4f7fc9714a660e4422fdf1f2b7f65dd6 Mon Sep 17 00:00:00 2001 From: Alex Arnaud Date: Thu, 4 May 2017 08:54:16 +0000 Subject: [PATCH] Bug 12063 - Remove checking of ExpireReservesMaxPickUpDelay in CancelExpiredReserves(). Koha::Hold::set_waiting calculate expiration date from today instead of hold's waiting date. Signed-off-by: Marcel de Rooy Signed-off-by: Kyle M Hall --- C4/Reserves.pm | 1 - Koha/Hold.pm | 2 +- t/db_dependent/Holds/CancelReserves.t | 9 ++------- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index e1e355a03e..5520954453 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -899,7 +899,6 @@ Cancels all reserves with an expiration date from before today. =cut sub CancelExpiredReserves { - return unless C4::Context->preference("ExpireReservesMaxPickUpDelay"); my $today = dt_from_string(); my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays'); diff --git a/Koha/Hold.pm b/Koha/Hold.pm index 030e90ad99..d708054c5a 100644 --- a/Koha/Hold.pm +++ b/Koha/Hold.pm @@ -140,7 +140,7 @@ sub set_waiting { $expirationdate->add(days => $max_pickup_delay); if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) { - $expirationdate = $calendar->days_forward( dt_from_string($self->waitingdate), $max_pickup_delay ); + $expirationdate = $calendar->days_forward( dt_from_string(), $max_pickup_delay ); } # If patron's requested expiration date is prior to the diff --git a/t/db_dependent/Holds/CancelReserves.t b/t/db_dependent/Holds/CancelReserves.t index 3330a1ce0d..302b155a91 100644 --- a/t/db_dependent/Holds/CancelReserves.t +++ b/t/db_dependent/Holds/CancelReserves.t @@ -8,7 +8,7 @@ use Koha::DateUtils; use t::lib::Mocks; use t::lib::TestBuilder; -use Test::More tests => 6; +use Test::More tests => 5; use_ok('C4::Reserves'); @@ -63,12 +63,7 @@ my $reserve2 = $builder->build({ CancelExpiredReserves(); my $r2 = Koha::Holds->find($reserve2->{reserve_id}); -ok($r2, 'Without ExpireReservesMaxPickUpDelay, reserve 2 should not be canceled.'); - -t::lib::Mocks::mock_preference('ExpireReservesMaxPickUpDelay', 1); -CancelExpiredReserves(); -$r2 = Koha::Holds->find($reserve2->{reserve_id}); -is($r2, undef,'With ExpireReservesMaxPickUpDelay, reserve 2 should be canceled.'); +is($r2, undef,'reserve 2 should be canceled.'); # Reserve expired on holiday my $reserve3 = $builder->build({ -- 2.39.5