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

(-)a/Koha/Holds.pm (-1 / +8 lines)
Lines 161-171 sub get_items_that_can_fill { Link Here
161
            collapse => 1,
161
            collapse => 1,
162
        }
162
        }
163
    )->get_column('itemnumber');
163
    )->get_column('itemnumber');
164
    my @pending_recalls = Koha::Recalls->search(
165
        { 'status' => [ 'waiting', 'in_transit' ] },
166
        {
167
            columns  => ['item_id'],
168
            collapse => 1,
169
        }
170
    )->get_column('item_id');
164
171
165
    return Koha::Items->search(
172
    return Koha::Items->search(
166
        {
173
        {
167
            -or        => \@bibs_or_items,
174
            -or        => \@bibs_or_items,
168
            itemnumber => { -not_in => [ @branchtransfers, @waiting_holds ] },
175
            itemnumber => { -not_in => [ @branchtransfers, @waiting_holds, @pending_recalls ] },
169
            onloan     => undef,
176
            onloan     => undef,
170
            notforloan => 0,
177
            notforloan => 0,
171
        }
178
        }
(-)a/t/db_dependent/Koha/Holds.t (-2 / +11 lines)
Lines 807-813 subtest 'Desks' => sub { Link Here
807
};
807
};
808
808
809
subtest 'get_items_that_can_fill' => sub {
809
subtest 'get_items_that_can_fill' => sub {
810
    plan tests => 6;
810
    plan tests => 7;
811
811
812
    Koha::CirculationRules->search(
812
    Koha::CirculationRules->search(
813
        {
813
        {
Lines 912-917 subtest 'get_items_that_can_fill' => sub { Link Here
912
        [ $item_2->itemnumber, $item_5->itemnumber ], 'Only item 2 and 5 are available for filling the hold'
912
        [ $item_2->itemnumber, $item_5->itemnumber ], 'Only item 2 and 5 are available for filling the hold'
913
    );
913
    );
914
914
915
    my $waiting_recall = $builder->build_object(
916
        { class => 'Koha::Recalls', value => { item_id => $item_5->itemnumber, status => 'waiting' } } );
917
    $items = $holds->get_items_that_can_fill;
918
    is_deeply(
919
        [ map { $_->itemnumber } $items->as_list ],
920
        [ $item_2->itemnumber ],
921
        'Only item 2 is available for filling the hold as item 5 is allocated to a pending recall'
922
    );
923
    $waiting_recall->delete;
924
915
    # Marking item_5 is no hold allowed
925
    # Marking item_5 is no hold allowed
916
    Koha::CirculationRule->new(
926
    Koha::CirculationRule->new(
917
        {
927
        {
918
- 

Return to bug 33364