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

(-)a/Koha/Hold.pm (-6 / +7 lines)
Lines 940-952 sub store { Link Here
940
        if ( exists $updated_columns{reservedate} || $hold_reverted ) {
940
        if ( exists $updated_columns{reservedate} || $hold_reverted ) {
941
            if (
941
            if (
942
                ( C4::Context->preference('DefaultHoldExpirationdate')
942
                ( C4::Context->preference('DefaultHoldExpirationdate')
943
                && ! exists $updated_columns{expirationdate} )
943
                    && ( ! exists $updated_columns{expirationdate} || $hold_reverted ) )
944
                || ( C4::Context->preference('DefaultHoldExpirationdate')
944
            )
945
                && exists $updated_columns{expirationdate}
946
                && $hold_reverted )
947
              )
948
            {
945
            {
949
                $self->_set_default_expirationdate;
946
                if($self->patron_expiration_date){
947
                    $self->expirationdate($self->patron_expiration_date);
948
                } else {
949
                    $self->_set_default_expirationdate;
950
                }
950
            }
951
            }
951
        }
952
        }
952
    }
953
    }
(-)a/t/db_dependent/Hold.t (-2 / +26 lines)
Lines 146-152 $schema->storage->txn_rollback(); Link Here
146
146
147
subtest "store() tests" => sub {
147
subtest "store() tests" => sub {
148
148
149
    plan tests => 6;
149
    plan tests => 7;
150
150
151
    $schema->storage->txn_begin();
151
    $schema->storage->txn_begin();
152
152
Lines 241-246 subtest "store() tests" => sub { Link Here
241
    is( $hold->expirationdate,
241
    is( $hold->expirationdate,
242
        $expected_date, 'Expiration date set after reverting holds waiting status.' );
242
        $expected_date, 'Expiration date set after reverting holds waiting status.' );
243
243
244
    my $patron_expiration_date = dt_from_string('2023-11-06')->ymd;
245
    $hold = Koha::Hold->new(
246
        {
247
            biblionumber           => $biblio->biblionumber,
248
            itemnumber             => $item->id,
249
            reservedate            => '2023-10-15',
250
            expirationdate         => $patron_expiration_date,
251
            waitingdate            => '2023-10-15',
252
            borrowernumber         => $borrower->borrowernumber,
253
            branchcode             => $library->branchcode,
254
            suspend                => 0,
255
            patron_expiration_date => $patron_expiration_date,
256
        }
257
    )->store;
258
    $hold->discard_changes;
259
260
    $hold->set_waiting;
261
    C4::Reserves::RevertWaitingStatus(
262
        { itemnumber => $item->itemnumber }
263
    );
264
    $hold->discard_changes;
265
266
    is( $hold->expirationdate,
267
        $patron_expiration_date, 'Expiration date set same as patron_expiration_date after reverting holds waiting status.' );
268
244
    $schema->storage->txn_rollback();
269
    $schema->storage->txn_rollback();
245
};
270
};
246
271
247
- 

Return to bug 34032