From 580977ef4ad9fa9a9e4a0ee20d3bf23f479c92b9 Mon Sep 17 00:00:00 2001 From: Shi Yao Wang Date: Tue, 17 May 2022 11:08:06 -0400 Subject: [PATCH] Bug 30730: Holds to Pull should not list items with a notforloan status Remove items with a notforloan value other than 0 because items that are potentially holdable (with negative notforloan status) are not wanted in holds to pull. Test plan: 1- Have a bib with 2 items, both holdable. Give one of these items a notforloan status with a negative value (like Ordered in the testing docker data). 2- Place a title-level hold on your bib 3- Confirm your bib is showing on Holds to Pull as expected, prompting staff to pull the item that does not have a not for loan status (correct!) 4- Take the item that does not have a not for loan status and check it out to a different patron, make sure not to fill or cancel your hold 5- Reload Holds to Pull, see your title is still listed and now Koha is directing staff to the item with a notforloan status 6- Apply the patch 7- Reload Holds to Pull, see your title with a notforloan status is gone 8- Run `prove t/db_dependent/Koha/Holds.t` and all tests should pass Signed-off-by: David Nind Signed-off-by: Martin Renvoize --- Koha/Holds.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Koha/Holds.pm b/Koha/Holds.pm index 0d062d0620..69899cac8f 100644 --- a/Koha/Holds.pm +++ b/Koha/Holds.pm @@ -134,11 +134,18 @@ sub get_items_that_can_fill { collapse => 1, } )->get_column('itemnumber'); + my @notforloan = Koha::Items->search( + { notforloan => { '!=' => 0 } }, + { + columns => ['itemnumber'], + collapse => 1, + } + )->get_column('itemnumber'); return Koha::Items->search( { -or => \@bibs_or_items, - itemnumber => { -not_in => [ @branchtransfers, @waiting_holds ] }, + itemnumber => { -not_in => [ @branchtransfers, @waiting_holds, @notforloan ] }, onloan => undef, } )->filter_by_for_hold(); -- 2.20.1