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

(-)a/Koha/Hold.pm (-8 / +1 lines)
Lines 178-195 sub set_waiting { Link Here
178
178
179
    $self->priority(0);
179
    $self->priority(0);
180
180
181
    my $waiting_date;
182
    my $today = dt_from_string();
181
    my $today = dt_from_string();
183
182
184
    if ( $self->waitingdate ) {
185
        $waiting_date = $self->waitingdate;
186
    } else {
187
        $waiting_date = $today->ymd;
188
    }
189
190
    my $values = {
183
    my $values = {
191
        found => 'W',
184
        found => 'W',
192
        waitingdate => $waiting_date,
185
        ( !$self->waitingdate ? ( waitingdate => $today->ymd ) : () ),
193
        desk_id => $desk_id,
186
        desk_id => $desk_id,
194
    };
187
    };
195
188
(-)a/t/db_dependent/Hold.t (-7 / +6 lines)
Lines 227-247 subtest "store() tests" => sub { Link Here
227
227
228
subtest "set_waiting() tests" => sub {
228
subtest "set_waiting() tests" => sub {
229
229
230
    plan tests => 1;
230
    plan tests => 2;
231
231
232
    $schema->storage->txn_begin();
232
    $schema->storage->txn_begin();
233
233
234
    # Disable logging
235
    t::lib::Mocks::mock_preference( 'HoldsLog', 0 );
236
237
    my $hold = $builder->build_object({ class => 'Koha::Holds' });
234
    my $hold = $builder->build_object({ class => 'Koha::Holds' });
238
235
239
    $hold->waitingdate('2021-01-01');
236
    $hold->waitingdate('2021-01-01');
240
241
    $hold->set_waiting();
237
    $hold->set_waiting();
238
    is($hold->waitingdate, '2021-01-01', "Setting waiting when already waiting should not update waitingdate");
242
239
243
    is($hold->waitingdate,'2021-01-01',"Setting waiting when already waiting should not update waitingdate");
240
    $hold->waitingdate(undef)->store;
241
    $hold->set_waiting();
242
    isnt($hold->waitingdate, undef, "Setting waiting when not waiting already should update waitingdate");
244
243
244
    $schema->storage->txn_rollback();
245
};
245
};
246
246
247
subtest "delete() tests" => sub {
247
subtest "delete() tests" => sub {
248
- 

Return to bug 21652