From a8c6d86c1270737e64069d08ee6bb021e920e4aa 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 --- circ/returns.pl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/circ/returns.pl b/circ/returns.pl index 340efb4779..ecee8048a2 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -338,6 +338,16 @@ if ($barcode) { $template->param( 'multiple_confirmed' => 1 ) if $query->param('multiple_confirm'); + # 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.34.1