View | Details | Raw Unified | Return to bug 12063
Collapse All | Expand All

(-)a/C4/Reserves.pm (-1 lines)
Lines 940-946 Cancels all reserves with an expiration date from before today. Link Here
940
=cut
940
=cut
941
941
942
sub CancelExpiredReserves {
942
sub CancelExpiredReserves {
943
    return unless C4::Context->preference("ExpireReservesMaxPickUpDelay");
944
943
945
    my $today = dt_from_string();
944
    my $today = dt_from_string();
946
    my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays');
945
    my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays');
(-)a/Koha/Hold.pm (-1 / +1 lines)
Lines 140-146 sub set_waiting { Link Here
140
    $expirationdate->add(days => $max_pickup_delay);
140
    $expirationdate->add(days => $max_pickup_delay);
141
141
142
    if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) {
142
    if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) {
143
        $expirationdate = $calendar->days_forward( dt_from_string($self->waitingdate), $max_pickup_delay );
143
        $expirationdate = $calendar->days_forward( dt_from_string(), $max_pickup_delay );
144
    }
144
    }
145
145
146
    # If patron's requested expiration date is prior to the
146
    # If patron's requested expiration date is prior to the
(-)a/t/db_dependent/Holds/CancelReserves.t (-8 / +2 lines)
Lines 8-14 use Koha::DateUtils; Link Here
8
use t::lib::Mocks;
8
use t::lib::Mocks;
9
use t::lib::TestBuilder;
9
use t::lib::TestBuilder;
10
10
11
use Test::More tests => 6;
11
use Test::More tests => 5;
12
12
13
use_ok('C4::Reserves');
13
use_ok('C4::Reserves');
14
14
Lines 63-74 my $reserve2 = $builder->build({ Link Here
63
63
64
CancelExpiredReserves();
64
CancelExpiredReserves();
65
my $r2 = Koha::Holds->find($reserve2->{reserve_id});
65
my $r2 = Koha::Holds->find($reserve2->{reserve_id});
66
ok($r2, 'Without ExpireReservesMaxPickUpDelay, reserve 2 should not be canceled.');
66
is($r2, undef,'reserve 2 should be canceled.');
67
68
t::lib::Mocks::mock_preference('ExpireReservesMaxPickUpDelay', 1);
69
CancelExpiredReserves();
70
$r2 = Koha::Holds->find($reserve2->{reserve_id});
71
is($r2, undef,'With ExpireReservesMaxPickUpDelay, reserve 2 should be canceled.');
72
67
73
# Reserve expired on holiday
68
# Reserve expired on holiday
74
my $reserve3 = $builder->build({
69
my $reserve3 = $builder->build({
75
- 

Return to bug 12063