From a86bec58e94e1eb83f790d996b318ef7a106a11d Mon Sep 17 00:00:00 2001 From: Laura Escamilla Date: Tue, 12 Mar 2024 04:16:38 +0000 Subject: [PATCH] Bug 27753: Adding patch for AutoClaimReturnStatusOnCheckout syspref Signed-off-by: Michelle --- C4/Circulation.pm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 109809d4b9..6e79039546 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2547,6 +2547,8 @@ sub AddReturn { } if ( C4::Context->preference('ClaimReturnedLostValue') ) { + my $autoClaimReturnCheckin = C4::Context->preference('AutoClaimReturnStatusOnCheckin'); + my $claims = Koha::Checkouts::ReturnClaims->search( { itemnumber => $item->id, @@ -2555,9 +2557,24 @@ sub AddReturn { ); if ( $claims->count ) { + if ($autoClaimReturnCheckin) { + my $claim = $claims->next; + + my $patron_id = $patron->borrowernumber; + my $resolution = $autoClaimReturnCheckin; + + $claim->resolve( + { + resolution => $resolution, + resolved_by => $patron_id, + } + ); + $messages->{ClaimAutoResolved} = $claim; + } else { $messages->{ReturnClaims} = $claims; } } +} # Check for bundle status if ( $item->in_bundle ) { -- 2.30.2