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

(-)a/Koha/Hold.pm (-2 / +6 lines)
Lines 980-989 sub store { Link Here
980
sub _set_default_expirationdate {
980
sub _set_default_expirationdate {
981
    my $self = shift;
981
    my $self = shift;
982
982
983
    my $period   = C4::Context->preference('DefaultHoldExpirationdatePeriod')     || 0;
983
    my $period   = C4::Context->preference('DefaultHoldExpirationdatePeriod');
984
    my $timeunit = C4::Context->preference('DefaultHoldExpirationdateUnitOfTime') || 'days';
984
    my $timeunit = C4::Context->preference('DefaultHoldExpirationdateUnitOfTime') || 'days';
985
985
986
    $self->expirationdate( dt_from_string( $self->reservedate )->add( $timeunit => $period ) );
986
    if ( defined C4::Context->preference('DefaultHoldExpirationdatePeriod')
987
        && C4::Context->preference('DefaultHoldExpirationdatePeriod') ne '' )
988
    {
989
        $self->expirationdate( dt_from_string( $self->reservedate )->add( $timeunit => $period ) );
990
    }
987
}
991
}
988
992
989
=head3 _move_to_old
993
=head3 _move_to_old
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+1 lines)
Lines 1078-1083 Circulation: Link Here
1078
                  months: months
1078
                  months: months
1079
                  years: years
1079
                  years: years
1080
            - from reserve date.
1080
            - from reserve date.
1081
            - <br><strong>NOTE:</strong> If <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=DefaultHoldExpirationdatePeriod">DefaultHoldExpirationdatePeriod</a> is left blank, no default expiration date is set.</br>
1081
        -
1082
        -
1082
            - When placing a hold via the staff interface default the pickup location to the
1083
            - When placing a hold via the staff interface default the pickup location to the
1083
            - pref: DefaultHoldPickupLocation
1084
            - pref: DefaultHoldPickupLocation
(-)a/t/db_dependent/Hold.t (-2 / +21 lines)
Lines 160-166 $schema->storage->txn_rollback(); Link Here
160
160
161
subtest "store() tests" => sub {
161
subtest "store() tests" => sub {
162
162
163
    plan tests => 7;
163
    plan tests => 8;
164
164
165
    $schema->storage->txn_begin();
165
    $schema->storage->txn_begin();
166
166
Lines 292-297 subtest "store() tests" => sub { Link Here
292
        'Expiration date set same as patron_expiration_date after reverting holds waiting status.'
292
        'Expiration date set same as patron_expiration_date after reverting holds waiting status.'
293
    );
293
    );
294
294
295
    # Do not set expiration date for hold if no period is set
296
    t::lib::Mocks::mock_preference( 'DefaultHoldExpirationdatePeriod', '' );
297
    $hold = Koha::Hold->new(
298
        {
299
            biblionumber   => $biblio->biblionumber,
300
            itemnumber     => $item->id,
301
            reservedate    => '2022-12-14',
302
            waitingdate    => '2022-12-14',
303
            borrowernumber => $borrower->borrowernumber,
304
            branchcode     => $library->branchcode,
305
            suspend        => 0,
306
        }
307
    )->store;
308
    $hold->discard_changes;
309
310
    is(
311
        $hold->expirationdate,
312
        undef, 'Expiration date not set if "DefaultHoldExpirationdatePeriod" is left empty.'
313
    );
314
295
    $schema->storage->txn_rollback();
315
    $schema->storage->txn_rollback();
296
};
316
};
297
317
298
- 

Return to bug 29074