From ace383ad96ade6eac8514a16dc68ea053dfe60c3 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) Update logic in AddReturn The new logic in AddReturn was flawed, we were missing return messages due to moving the if statement too high and catching more code than intended. Mentored-by: Martin Renvoize Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer --- C4/Circulation.pm | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 5f642c2f90..a83e59671c 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2535,29 +2535,29 @@ sub AddReturn { } if ( C4::Context->preference('ClaimReturnedLostValue') ) { - my $autoClaimReturnCheckin = C4::Context->preference('AutoClaimReturnStatusOnCheckin'); - if ($autoClaimReturnCheckin) { my $claim = Koha::Checkouts::ReturnClaims->find( { itemnumber => $item->id, resolution => undef, } ); - if ($claim) { - my $patron_id = $patron->borrowernumber; - my $resolution = $autoClaimReturnCheckin; + my $autoClaimReturnCheckin = C4::Context->preference('AutoClaimReturnStatusOnCheckin'); + if ($autoClaimReturnCheckin) { - $claim->resolve( - { - resolution => $resolution, - resolved_by => $patron_id, - } - ); - $messages->{ClaimAutoResolved} = $claim; - } else { - $messages->{ReturnClaims} = $claim if $claim; + my $patron_id = $patron->borrowernumber; + my $resolution = $autoClaimReturnCheckin; + + $claim->resolve( + { + resolution => $resolution, + resolved_by => $patron_id, + } + ); + $messages->{ClaimAutoResolved} = $claim; + } else { + $messages->{ReturnClaims} = $claim; } } } -- 2.39.5