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

(-)a/Koha/Acquisition/Order.pm (-4 / +4 lines)
Lines 177-194 sub subscription { Link Here
177
    return Koha::Subscription->_new_from_dbic( $subscription_rs );
177
    return Koha::Subscription->_new_from_dbic( $subscription_rs );
178
}
178
}
179
179
180
=head3 current_holds
180
=head3 current_item_level_holds
181
181
182
    my $holds = $order->current_holds;
182
    my $holds = $order->current_item_level_holds;
183
183
184
Returns the current holds associated to the order. It returns a I<Koha::Holds>
184
Returns the current item-level holds associated to the order. It returns a I<Koha::Holds>
185
resultset in scalar context or a list of I<Koha::Hold> objects in list context.
185
resultset in scalar context or a list of I<Koha::Hold> objects in list context.
186
186
187
It returns B<undef> if no I<biblio> or no I<items> are linked to the order.
187
It returns B<undef> if no I<biblio> or no I<items> are linked to the order.
188
188
189
=cut
189
=cut
190
190
191
sub current_holds {
191
sub current_item_level_holds {
192
    my ($self) = @_;
192
    my ($self) = @_;
193
193
194
    my $items_rs     = $self->_result->aqorders_items;
194
    my $items_rs     = $self->_result->aqorders_items;
(-)a/t/db_dependent/Koha/Acquisition/Order.t (-5 / +4 lines)
Lines 283-289 subtest 'duplicate_to | add_item' => sub { Link Here
283
    $schema->storage->txn_rollback;
283
    $schema->storage->txn_rollback;
284
};
284
};
285
285
286
subtest 'current_holds() tests' => sub {
286
subtest 'current_item_level_holds() tests' => sub {
287
287
288
    plan tests => 3;
288
    plan tests => 3;
289
289
Lines 328-343 subtest 'current_holds() tests' => sub { Link Here
328
        }
328
        }
329
    );
329
    );
330
330
331
    is( $order->current_holds, undef, 'Returns undef if no linked biblio');
331
    is( $order->current_item_level_holds, undef, 'Returns undef if no linked biblio');
332
332
333
    $order->set({ biblionumber => $biblio->biblionumber })->store->discard_changes;
333
    $order->set({ biblionumber => $biblio->biblionumber })->store->discard_changes;
334
334
335
    is( $order->current_holds, undef, 'Returns undef if no linked items');
335
    is( $order->current_item_level_holds, undef, 'Returns undef if no linked items');
336
336
337
    $order->add_item( $item_2->itemnumber );
337
    $order->add_item( $item_2->itemnumber );
338
    $order->add_item( $item_3->itemnumber );
338
    $order->add_item( $item_3->itemnumber );
339
339
340
    is( $order->current_holds->count, 1, 'Only current (not future) holds are returned');
340
    is( $order->current_item_level_holds->count, 1, 'Only current (not future) holds are returned');
341
341
342
    $schema->storage->txn_rollback;
342
    $schema->storage->txn_rollback;
343
};
343
};
344
- 

Return to bug 24440