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 1426-1433 subtest 'ReserveExpiration syspref tests' => sub { Link Here
1426
    t::lib::Mocks::mock_preference( 'ReserveExpiration', 1 );
1426
    t::lib::Mocks::mock_preference( 'ReserveExpiration', 1 );
1427
1427
1428
    my $expirationdate = dt_from_string->add( days => 1 );
1428
    my $expirationdate = dt_from_string->add( days => 1 );
1429
    my $hold = $builder->build_object(
1429
    my $hold           = $builder->build_object(
1430
        {   class => 'Koha::Holds',
1430
        {
1431
            class => 'Koha::Holds',
1431
            value => { expirationdate => $expirationdate }
1432
            value => { expirationdate => $expirationdate }
1432
        }
1433
        }
1433
    );
1434
    );
Lines 1435-1441 subtest 'ReserveExpiration syspref tests' => sub { Link Here
1435
    # Disable expiration date for reserves
1436
    # Disable expiration date for reserves
1436
    t::lib::Mocks::mock_preference( 'ReserveExpiration', 0 );
1437
    t::lib::Mocks::mock_preference( 'ReserveExpiration', 0 );
1437
1438
1438
    my $reverted = C4::Reserves::RevertWaitingStatus({ itemnumber => $hold->itemnumber });
1439
    my $reverted = C4::Reserves::RevertWaitingStatus( { itemnumber => $hold->itemnumber } );
1439
1440
1440
    is( $reverted->expirationdate, undef, "Expiration date should be removed with reserve expiration disabled" );
1441
    is( $reverted->expirationdate, undef, "Expiration date should be removed with reserve expiration disabled" );
1441
1442
Lines 1443-1456 subtest 'ReserveExpiration syspref tests' => sub { Link Here
1443
    t::lib::Mocks::mock_preference( 'ReserveExpiration', 1 );
1444
    t::lib::Mocks::mock_preference( 'ReserveExpiration', 1 );
1444
1445
1445
    $hold = $builder->build_object(
1446
    $hold = $builder->build_object(
1446
        {   class => 'Koha::Holds',
1447
        {
1448
            class => 'Koha::Holds',
1447
            value => { expirationdate => $expirationdate }
1449
            value => { expirationdate => $expirationdate }
1448
        }
1450
        }
1449
    );
1451
    );
1450
1452
1451
    $reverted = C4::Reserves::RevertWaitingStatus({ itemnumber => $hold->itemnumber });
1453
    $reverted = C4::Reserves::RevertWaitingStatus( { itemnumber => $hold->itemnumber } );
1452
1454
1453
    is( $reverted->expirationdate, undef, "Expiration date is still removed because we can't reset to the original expiration date" );
1455
    is(
1456
        $reverted->expirationdate, undef,
1457
        "Expiration date is still removed because we can't reset to the original expiration date"
1458
    );
1454
};
1459
};
1455
1460
1456
sub count_hold_print_messages {
1461
sub count_hold_print_messages {
1457
- 

Return to bug 24194