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

(-)a/Koha/Hold.pm (-1 / +1 lines)
Lines 252-258 sub set_waiting { Link Here
252
        $max_pickup_delay = $rule->rule_value;
252
        $max_pickup_delay = $rule->rule_value;
253
    }
253
    }
254
254
255
    my $new_expiration_date = dt_from_string($self->waitingdate)->clone->add( days => $max_pickup_delay );
255
    $new_expiration_date = dt_from_string($self->waitingdate)->clone->add( days => $max_pickup_delay );
256
256
257
    if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) {
257
    if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) {
258
        my $itemtype = $self->item ? $self->item->effective_itemtype : $self->biblio->itemtype;
258
        my $itemtype = $self->item ? $self->item->effective_itemtype : $self->biblio->itemtype;
(-)a/circ/waitingreserves.pl (-1 / +2 lines)
Lines 100-106 while ( my $hold = $holds->next ) { Link Here
100
    next unless $hold->waitingdate;
100
    next unless $hold->waitingdate;
101
101
102
    my ( $expire_year, $expire_month, $expire_day ) = split (/-/, $hold->expirationdate);
102
    my ( $expire_year, $expire_month, $expire_day ) = split (/-/, $hold->expirationdate);
103
    my $calcDate = Date_to_Days( $expire_year, $expire_month, $expire_day ) if $hold->expirationdate;
103
    my $calcDate;
104
    $calcDate = Date_to_Days( $expire_year, $expire_month, $expire_day ) if $hold->expirationdate;
104
105
105
    if ($calcDate and $today > $calcDate) {
106
    if ($calcDate and $today > $calcDate) {
106
        if ( $op eq 'cud-cancelall' ) {
107
        if ( $op eq 'cud-cancelall' ) {
(-)a/installer/data/mysql/atomicupdate/bug24194-add-ReserveExpiration-syspref.pl (-4 / +6 lines)
Lines 1-12 Link Here
1
use Modern::Perl;
1
use Modern::Perl;
2
2
3
return {
3
return {
4
    bug_number => "24194",
4
    bug_number  => "24194",
5
    description => "Add new system preference ReserveExpiration",
5
    description => "Add new system preference ReserveExpiration",
6
    up => sub {
6
    up          => sub {
7
        my ($args) = @_;
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
9
10
        $dbh->do(q{INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ("ReserveExpiration", 1, NULL, "Enable the use of expiration date in holds module.", "YesNo") });
10
        $dbh->do(
11
            q{INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ("ReserveExpiration", 1, NULL, "Enable the use of expiration date in holds module.", "YesNo") }
12
        );
11
    },
13
    },
12
};
14
};
(-)a/misc/cronjobs/holds/cancel_expired_holds.pl (-1 / +1 lines)
Lines 75-81 pod2usage(1) if $help; Link Here
75
75
76
cronlogaction({ info => $command_line_options });
76
cronlogaction({ info => $command_line_options });
77
77
78
if( C4::Context->preference('ReserveExpiration') ) {
78
if ( C4::Context->preference('ReserveExpiration') ) {
79
    C4::Reserves::CancelExpiredReserves($reason);
79
    C4::Reserves::CancelExpiredReserves($reason);
80
}
80
}
81
81
(-)a/t/db_dependent/Hold.t (-3 / +5 lines)
Lines 443-450 subtest 'ReserveExpiration syspref tests' => sub { Link Here
443
    t::lib::Mocks::mock_preference( 'ReserveExpiration', 0 );
443
    t::lib::Mocks::mock_preference( 'ReserveExpiration', 0 );
444
444
445
    my $expirationdate = dt_from_string->add( days => 1 );
445
    my $expirationdate = dt_from_string->add( days => 1 );
446
    my $hold = $builder->build_object(
446
    my $hold           = $builder->build_object(
447
        {   class => 'Koha::Holds',
447
        {
448
            class => 'Koha::Holds',
448
            value => { patron_expiration_date => $expirationdate }
449
            value => { patron_expiration_date => $expirationdate }
449
        }
450
        }
450
    );
451
    );
Lines 456-462 subtest 'ReserveExpiration syspref tests' => sub { Link Here
456
    t::lib::Mocks::mock_preference( 'ReserveExpiration', 1 );
457
    t::lib::Mocks::mock_preference( 'ReserveExpiration', 1 );
457
458
458
    $hold = $builder->build_object(
459
    $hold = $builder->build_object(
459
        {   class => 'Koha::Holds',
460
        {
461
            class => 'Koha::Holds',
460
            value => { patron_expiration_date => $expirationdate }
462
            value => { patron_expiration_date => $expirationdate }
461
        }
463
        }
462
    );
464
    );
(-)a/t/db_dependent/Reserves.t (-7 / +11 lines)
Lines 1370-1377 subtest 'ReserveExpiration syspref tests' => sub { Link Here
1370
    t::lib::Mocks::mock_preference( 'ReserveExpiration', 1 );
1370
    t::lib::Mocks::mock_preference( 'ReserveExpiration', 1 );
1371
1371
1372
    my $expirationdate = dt_from_string->add( days => 1 );
1372
    my $expirationdate = dt_from_string->add( days => 1 );
1373
    my $hold = $builder->build_object(
1373
    my $hold           = $builder->build_object(
1374
        {   class => 'Koha::Holds',
1374
        {
1375
            class => 'Koha::Holds',
1375
            value => { expirationdate => $expirationdate }
1376
            value => { expirationdate => $expirationdate }
1376
        }
1377
        }
1377
    );
1378
    );
Lines 1379-1385 subtest 'ReserveExpiration syspref tests' => sub { Link Here
1379
    # Disable expiration date for reserves
1380
    # Disable expiration date for reserves
1380
    t::lib::Mocks::mock_preference( 'ReserveExpiration', 0 );
1381
    t::lib::Mocks::mock_preference( 'ReserveExpiration', 0 );
1381
1382
1382
    my $reverted = C4::Reserves::RevertWaitingStatus({ itemnumber => $hold->itemnumber });
1383
    my $reverted = C4::Reserves::RevertWaitingStatus( { itemnumber => $hold->itemnumber } );
1383
1384
1384
    is( $reverted->expirationdate, undef, "Expiration date should be removed with reserve expiration disabled" );
1385
    is( $reverted->expirationdate, undef, "Expiration date should be removed with reserve expiration disabled" );
1385
1386
Lines 1387-1400 subtest 'ReserveExpiration syspref tests' => sub { Link Here
1387
    t::lib::Mocks::mock_preference( 'ReserveExpiration', 1 );
1388
    t::lib::Mocks::mock_preference( 'ReserveExpiration', 1 );
1388
1389
1389
    $hold = $builder->build_object(
1390
    $hold = $builder->build_object(
1390
        {   class => 'Koha::Holds',
1391
        {
1392
            class => 'Koha::Holds',
1391
            value => { expirationdate => $expirationdate }
1393
            value => { expirationdate => $expirationdate }
1392
        }
1394
        }
1393
    );
1395
    );
1394
1396
1395
    $reverted = C4::Reserves::RevertWaitingStatus({ itemnumber => $hold->itemnumber });
1397
    $reverted = C4::Reserves::RevertWaitingStatus( { itemnumber => $hold->itemnumber } );
1396
1398
1397
    is( $reverted->expirationdate, undef, "Expiration date is still removed because we can't reset to the original expiration date" );
1399
    is(
1400
        $reverted->expirationdate, undef,
1401
        "Expiration date is still removed because we can't reset to the original expiration date"
1402
    );
1398
};
1403
};
1399
1404
1400
sub count_hold_print_messages {
1405
sub count_hold_print_messages {
1401
- 

Return to bug 24194