@@ -, +, @@ out targeted in the holds queue --- C4/Circulation.pm | 6 ++++++ t/db_dependent/HoldsQueue.t | 13 +++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) --- a/C4/Circulation.pm +++ a/C4/Circulation.pm @@ -1729,6 +1729,12 @@ sub AddIssue { %$issue_attributes, } )->store; + + # Ensure item is no longer listed in the holds queue + $dbh->do( + q{DELETE tmp_holdsqueue, hold_fill_targets FROM tmp_holdsqueue LEFT JOIN hold_fill_targets USING ( itemnumber ) WHERE itemnumber = ?}, + undef, $item_object->id + ); } $issue->discard_changes; $patron->update_lastseen('check_out'); --- a/t/db_dependent/HoldsQueue.t +++ a/t/db_dependent/HoldsQueue.t @@ -2114,8 +2114,7 @@ subtest 'Remove item from holds queue on checkout' => sub { } ); - my $item = $builder->build_sample_item( - { homebranch => $lib->branchcode, holdingbranch => $lib->branchcode } ); + my $item = $builder->build_sample_item( { homebranch => $lib->branchcode, holdingbranch => $lib->branchcode } ); t::lib::Mocks::mock_userenv( { branchcode => $lib->branchcode } ); @@ -2131,11 +2130,17 @@ subtest 'Remove item from holds queue on checkout' => sub { C4::HoldsQueue::CreateQueue(); - is( Koha::Hold::HoldsQueueItems->search({ itemnumber => $item->id })->count(), 1, "Item is found in the holds queue" ); + is( + Koha::Hold::HoldsQueueItems->search( { itemnumber => $item->id } )->count(), 1, + "Item is found in the holds queue" + ); AddIssue( $patron1, $item->barcode, dt_from_string ); - is( Koha::Hold::HoldsQueueItems->search({ itemnumber => $item->id })->count(), 0, "Item is no longer found in the holds queue" ); + is( + Koha::Hold::HoldsQueueItems->search( { itemnumber => $item->id } )->count(), 0, + "Item is no longer found in the holds queue" + ); $schema->storage->txn_rollback; }; --