From 705639220cac0bd4f7cb303556d8fa7cb7866d67 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 13 Nov 2025 15:44:03 +0100 Subject: [PATCH] Bug 19814: Confirm hold or transfer Content-Type: text/plain; charset=utf-8 Test plan: --- circ/returns.pl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/circ/returns.pl b/circ/returns.pl index 5caa379c19..28ec00107e 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -342,8 +342,13 @@ if ( $batch_barcodes && $op eq 'cud-checkin' ) { # Do the actual return unless confirmation needed unless ( $needs_confirm || $bundle_confirm ) { + + # Call AddReturn, check if we want to confirm a transfer automatically + my $original_override = $ENV{"OVERRIDE_SYSPREF_AutomaticItemReturn"}; + $ENV{"OVERRIDE_SYSPREF_AutomaticItemReturn"} = 1 if $query->param('confirm_transfer'); my ( $batch_returned, $batch_messages, $batch_issue, $batch_borrower ) = AddReturn( $batch_barcode, $userenv_branch, $exemptfine, $return_date ); + $ENV{"OVERRIDE_SYSPREF_AutomaticItemReturn"} = $original_override || q{}; $batch_result{success} = $batch_returned; $batch_result{messages} = $batch_messages; @@ -365,6 +370,15 @@ if ( $batch_barcodes && $op eq 'cud-checkin' ) { not_returned => 1, }; } + + # Confirm a hold? + my $resFound = $batch_messages->{ResFound}; + if ( $query->param('confirm_hold') && $resFound ) { + my $hold = Koha::Holds->find( $resFound->{reserve_id} ); # TODO Not found + my $diffBranchSend; + $diffBranchSend = $resFound->{branchcode} if $userenv_branch ne $resFound->{branchcode}; + confirm_hold( $batch_item, $hold, $diffBranchSend, $desk_id ) if $hold; + } } else { $batch_result{needs_confirm} = $needs_confirm; $batch_result{bundle_confirm} = $bundle_confirm; -- 2.39.5