From 0e6f15207720edeacbc34bc1d54c98b01d9ec537 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 27 May 2022 10:38:29 -0300 Subject: [PATCH] Bug 22456: (follow-up) Cancel holds at checkin This patch makes checkin process the cancellation requested holds actually cancel them before moving forward. To test: 1. Have a waiting hold with a patron generated cancellation request 2. At circulation, check the item in => SUCCESS: The workflow follows as if the cancellation requested hold was already cancelled => SUCCESS: The hold is actually cancelled => SUCCESS: Not shown in the OPAC anymore Sponsored-by: Montgomery County Public Libraries Signed-off-by: Tomas Cohen Arazi Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- circ/returns.pl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/circ/returns.pl b/circ/returns.pl index c118260cb4..ac3260a5e9 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -346,6 +346,15 @@ if ($barcode) { $template->param( 'confirm_items_bundle_returned' => 1 ) if $query->param('confirm_items_bundle_return'); + # is there a waiting hold for the item, for which cancellation + # has been requested? + my $waiting_holds_to_be_cancelled = + Koha::Holds->waiting->search( { itemnumber => $item->id } ) + ->filter_by_has_cancellation_requests; + while ( my $hold = $waiting_holds_to_be_cancelled->next ) { + $hold->cancel; + } + # do the return ( $returned, $messages, $issue, $borrower ) = AddReturn( $barcode, $userenv_branch, $exemptfine, $return_date ) -- 2.39.5