From bbfc41f48c5ba3a8085d6bbe90fe8aac096264cd Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Mon, 17 Apr 2023 02:45:24 +0000 Subject: [PATCH] Bug 33364: [22.05] Prevent Holds to Pull from including items with pending recalls This patch changes the check for pending recalls to include items in transit, as well as items awaiting pickup, to fill a recall request. It then ensures the Holds to Pull report excludes items that have pending recalls. To test: 1. Enable UseRecalls and set the recalls-related circulation rules 2. Check out an item to Patron A 3. Place a hold on the item for Patron B 4. Log into the OPAC as Patron C and search for the item. Place a recall on the item. 5. Go back to the staff interface. Go to Circulation -> Holds to pull 6. Confirm the item shows in the Holds to pull table, with the hold for Patron B 7. Check in the item and confirm the recall as waiting 8. Go back to the Holds to pull page. You may need to manually regenerate the page by running the cronjob in the terminal misc/cronjobs/holds/build_holds_queue.pl 9. Notice that even though the item is allocated for a recall, the hold is showing. It should not be showing in this page. 10. Apply the patch and refresh the page 11. The item allocated to a recall should no longer be showing in the Holds to pull report 12. Go to the record detail page and go to the Recalls tab 13. Revert the recall from its waiting status 14. The record will now show on the Holds to pull page 15. Go to the Circulation -> Check in page 16. Go to the menu in the top-right of the page and click Set library 17. Change your library to a different one 18. Check in the item to confirm the recall as waiting and trigger a transfer 19. Go back to the Holds to pull page, regenerate if needed 20. The item should no longer show on the Holds to pull report 21. Confirm tests pass t/db_dependent/Koha/Item.t Sponsored-by: Auckland University of Technology Signed-off-by: David Nind --- circ/pendingreserves.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl index a438557ed1..771f77427c 100755 --- a/circ/pendingreserves.pl +++ b/circ/pendingreserves.pl @@ -196,7 +196,10 @@ my @biblionumbers = $holds->get_column('biblionumber'); my $all_items; if ( $holds->count ) { foreach my $item ( $holds->get_items_that_can_fill->as_list ) { - push @{ $all_items->{ $item->biblionumber } }, $item; + my $pending_recalls = Koha::Recalls->search({ item_id => $item->id, status => [ 'waiting', 'in_transit' ] })->count; + unless ( $pending_recalls > 0 ) { + push @{ $all_items->{ $item->biblionumber } }, $item; + } } } -- 2.30.2