From 5cc760f1f5846685b153a0f3bc0080ca43c0521e Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Tue, 14 Mar 2023 04:19:31 +0000 Subject: [PATCH] Bug 33220: Fix recalls to pull to not show in transit or allocated items This patch fixes the Recalls to pull circulation report so that it does not show items that are already allocated to another recall. This requires the UseRecalls system preference to be enabled and recalls circulation and fines rules to be configured. To test: 1. Cancel any recalls on Item A/Biblio A. 2. Check out Item A to Patron A. Item A should be the only item on Biblio A (pick a record with only one item, or create a record with one item). 2. Log into the OPAC as Patron B. 3. Place a recall on Item A for Patron B. Change the pickup library so it isn't your default library. 4. Log into the OPAC as Patron C. 5. Place a recall on Item A for Patron C. Item A should now be checked out to Patron A, with two recalls on it for Patrons B and C. 6. Log back into the staff interface. 7. Check in Item A. Confirm the recall and transfer for Patron B. 8. Go to Circulation -> Recalls to pull. Notice the recall for Patron C shows here, even though the one item that could fill this recall has already been allocated to Patron B and is in transit 9. Apply the patch and restart services 10. Refresh the Recalls to pull page 11. Confirm the recall no longer shows on the Recalls to pull page --> SUCCESS 12. Go to Biblio A and add a second item - Item B 13. Go back to Recalls to pull and refresh the page 14. Confirm the recall for Patron C now shows and can be filled by Item B Sponsored-by: Auckland University of Technology --- recalls/recalls_to_pull.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recalls/recalls_to_pull.pl b/recalls/recalls_to_pull.pl index e34be38275f..42e2b89d232 100755 --- a/recalls/recalls_to_pull.pl +++ b/recalls/recalls_to_pull.pl @@ -50,7 +50,7 @@ if ( $op eq 'cancel' ) { } if ( $op eq 'list' ) { - my @recalls = Koha::Recalls->search({ status => [ 'requested','overdue','in_transit' ] })->as_list; + my @recalls = Koha::Recalls->search({ status => [ 'requested','overdue' ] })->as_list; my @pull_list; my %seen_bib; foreach my $recall ( @recalls ) { @@ -64,7 +64,7 @@ if ( $op eq 'list' ) { # get recall data about this biblio my $biblio = $recall->biblio; my @this_bib_recalls = $biblio->recalls->search( - { status => [ 'requested', 'overdue', 'in_transit' ] }, + { status => [ 'requested','overdue' ] }, { order_by => { -asc => 'created_date' } } )->as_list; my $recalls_count = scalar @this_bib_recalls; @@ -82,7 +82,7 @@ if ( $op eq 'list' ) { my @items = $biblio->items->as_list; foreach my $item ( @items ) { - if ( $item->can_be_waiting_recall and !$item->checkout ) { + if ( $item->can_be_waiting_recall and !$item->checkout and Koha::Recalls->search({ item_id => $item->id, status => [ 'waiting','in_transit' ], completed => 0 })->count == 0 ) { # if item can be pulled to fulfill recall, collect item data $items_count++; push( @callnumbers, $item->itemcallnumber ) if ( $item->itemcallnumber ); -- 2.20.1