From 280dae897e29bbd3307cf4d1cac0ee29dae4dfa5 Mon Sep 17 00:00:00 2001 From: Laura Escamilla Date: Tue, 30 Apr 2024 14:21:35 +0000 Subject: [PATCH] Bug 27753: Follow up updates to C4/Circulation.pm --- C4/Circulation.pm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index df148d9253..6d69483486 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2544,8 +2544,34 @@ sub AddReturn { if ( $claims->count ) { $messages->{ReturnClaims} = $claims; + + my $claim = Koha::Checkouts::ReturnClaims->find( + { + itemnumber => $item->id, + resolution => undef, + } + ); + if ($claim) { + my $autoClaimReturnCheckin = C4::Context->preference('AutoClaimReturnStatusOnCheckin'); + if ($autoClaimReturnCheckin) { + + my $patron_id = $patron->borrowernumber; + my $resolution = $autoClaimReturnCheckin; + + $claim->resolve( + { + resolution => $resolution, + resolved_by => $patron_id, + } + ); + $messages->{ClaimAutoResolved} = $claim; + } else { + $messages->{ReturnClaims} = $claim; + + } } } +} # Check for bundle status if ( $item->in_bundle ) { -- 2.30.2