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

(-)a/Koha/Holds.pm (-1 / +1 lines)
Lines 116-122 sub get_items_that_can_fill { Link Here
116
    my @biblionumbers = $self->search({ 'me.itemnumber' => undef })->get_column('biblionumber');
116
    my @biblionumbers = $self->search({ 'me.itemnumber' => undef })->get_column('biblionumber');
117
    my @bibs_or_items;
117
    my @bibs_or_items;
118
    push @bibs_or_items, 'me.itemnumber' => { in => \@itemnumbers } if @itemnumbers;
118
    push @bibs_or_items, 'me.itemnumber' => { in => \@itemnumbers } if @itemnumbers;
119
    push @bibs_or_items, 'biblionumber' => { in => \@biblionumbers } if @biblionumbers;
119
    push @bibs_or_items, 'me.biblionumber' => { in => \@biblionumbers } if @biblionumbers;
120
120
121
    my @branchtransfers = map { $_->itemnumber }
121
    my @branchtransfers = map { $_->itemnumber }
122
      Koha::Item::Transfers->search(
122
      Koha::Item::Transfers->search(
(-)a/t/db_dependent/Koha/Holds.t (-2 / +14 lines)
Lines 410-416 subtest 'Desks' => sub { Link Here
410
};
410
};
411
411
412
subtest 'get_items_that_can_fill' => sub {
412
subtest 'get_items_that_can_fill' => sub {
413
    plan tests => 3;
413
    plan tests => 4;
414
414
415
    my $biblio = $builder->build_sample_biblio;
415
    my $biblio = $builder->build_sample_biblio;
416
    my $itype_1 = $builder->build_object({ class => 'Koha::ItemTypes' }); # For 1, 2, 3, 4
416
    my $itype_1 = $builder->build_object({ class => 'Koha::ItemTypes' }); # For 1, 2, 3, 4
Lines 502-507 subtest 'get_items_that_can_fill' => sub { Link Here
502
    is_deeply( [ map { $_->itemnumber } $items->as_list ],
502
    is_deeply( [ map { $_->itemnumber } $items->as_list ],
503
        [ $item_2->itemnumber ], 'Only item 2 is available for filling the hold' );
503
        [ $item_2->itemnumber ], 'Only item 2 is available for filling the hold' );
504
504
505
506
    my $noloan_itype = $builder->build_object( { class => 'Koha::ItemTypes', value => { notforloan => 1 } } );
507
    t::lib::Mocks::mock_preference( 'item-level_itypes', 0 );
508
    Koha::Holds->find( $waiting_reserve_id )->delete;
509
    $holds = Koha::Holds->search(
510
        {
511
            reserve_id => [ $reserve_id_1, $reserve_id_2 ]
512
        }
513
    );
514
    $items = $holds->get_items_that_can_fill;
515
    is_deeply( [ sort map { $_->itemnumber } $items->as_list ],
516
        [ $item_1->itemnumber, $item_2->itemnumber, $item_5->itemnumber ], 'Items 1, 2, and 5 are available for filling the holds' );
517
505
};
518
};
506
519
507
$schema->storage->txn_rollback;
520
$schema->storage->txn_rollback;
508
- 

Return to bug 30432