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

(-)a/Koha/Holds.pm (+2 lines)
Lines 111-116 Items that are not: Link Here
111
sub get_items_that_can_fill {
111
sub get_items_that_can_fill {
112
    my ( $self ) = @_;
112
    my ( $self ) = @_;
113
113
114
    return Koha::Items->new->empty() unless $self->count() > 0;
115
114
    my @itemnumbers = $self->search({ 'me.itemnumber' => { '!=' => undef } })->get_column('itemnumber');
116
    my @itemnumbers = $self->search({ 'me.itemnumber' => { '!=' => undef } })->get_column('itemnumber');
115
    my @biblionumbers = $self->search({ 'me.itemnumber' => undef })->get_column('biblionumber');
117
    my @biblionumbers = $self->search({ 'me.itemnumber' => undef })->get_column('biblionumber');
116
    my @bibs_or_items;
118
    my @bibs_or_items;
(-)a/circ/pendingreserves.pl (-2 / +4 lines)
Lines 193-200 my $holds = Koha::Holds->search( Link Here
193
my @biblionumbers = $holds->get_column('biblionumber');
193
my @biblionumbers = $holds->get_column('biblionumber');
194
194
195
my $all_items;
195
my $all_items;
196
foreach my $item ( $holds->get_items_that_can_fill->as_list ) {
196
if( $holds->count ){
197
    push @{$all_items->{$item->biblionumber}}, $item;
197
    foreach my $item ( $holds->get_items_that_can_fill->as_list ) {
198
        push @{$all_items->{$item->biblionumber}}, $item;
199
    }
198
}
200
}
199
201
200
# patrons count per biblio
202
# patrons count per biblio
(-)a/t/db_dependent/Koha/Holds.t (-2 / +6 lines)
Lines 411-417 subtest 'Desks' => sub { Link Here
411
};
411
};
412
412
413
subtest 'get_items_that_can_fill' => sub {
413
subtest 'get_items_that_can_fill' => sub {
414
    plan tests => 3;
414
    plan tests => 5;
415
415
416
    my $biblio = $builder->build_sample_biblio;
416
    my $biblio = $builder->build_sample_biblio;
417
    my $itype_1 = $builder->build_object({ class => 'Koha::ItemTypes' }); # For 1, 2, 3, 4
417
    my $itype_1 = $builder->build_object({ class => 'Koha::ItemTypes' }); # For 1, 2, 3, 4
Lines 503-508 subtest 'get_items_that_can_fill' => sub { Link Here
503
    is_deeply( [ map { $_->itemnumber } $items->as_list ],
503
    is_deeply( [ map { $_->itemnumber } $items->as_list ],
504
        [ $item_2->itemnumber ], 'Only item 2 is available for filling the hold' );
504
        [ $item_2->itemnumber ], 'Only item 2 is available for filling the hold' );
505
505
506
    my $no_holds = Koha::Holds->new->empty();
507
    my $no_items = $no_holds->get_items_that_can_fill();
508
    is( ref $no_items, "Koha::Items", "Routine returns a Koha::Items object");
509
    is( $no_items->count, 0, "Object is empty when called on no holds");
510
506
};
511
};
507
512
508
subtest 'set_waiting+patron_expiration_date' => sub {
513
subtest 'set_waiting+patron_expiration_date' => sub {
509
- 

Return to bug 30155