From 08cc07a4c70db866121f4f6aeec3b5eb97992cdb 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. --- 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 4a34305..1d300f1 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -940,7 +940,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 030e90a..d708054 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 3330a1c..302b155 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.7.4