From e8c76f54e623176a2e0e034aea05b3b5e993f6bf 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 --- 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