From 158f1a888bd83500181fa3441ded9ca6f77c05d5 Mon Sep 17 00:00:00 2001
From: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Date: Fri, 19 Nov 2021 09:59:18 +0000
Subject: [PATCH] Bug 18855: (follow-up) Restore CalculateFinesOnReturn
 behaviour

This patch removes the check for a disabled 'CalculateFinesOnReturn'
to restore the behaviour prior to this patch series.

If a patron has returned the item during the fines cron run, they may
well have been charged a reduced fine at check-in time.  However, I feel
that the fine should not then increment/decrement behind the scenes
after the check-in. This is to reduce confusion for end users and
librarians alike.
---
 C4/Overdues.pm | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/C4/Overdues.pm b/C4/Overdues.pm
index 69421f3a8d..4c26b42407 100644
--- a/C4/Overdues.pm
+++ b/C4/Overdues.pm
@@ -565,8 +565,12 @@ sub UpdateFine {
 
     if ( $accountline ) {
         # a book may be returned while cronjob/fines.pl is running
-        if ( ( $accountline->status eq 'UNRETURNED' || ! C4::Context->preference('CalculateFinesOnReturn') )
-             && Koha::Number::Price->new($accountline->amount)->round != Koha::Number::Price->new($amount)->round ) {
+        if (
+            $accountline->status eq 'UNRETURNED'
+            && ( Koha::Number::Price->new( $accountline->amount )->round !=
+                Koha::Number::Price->new($amount)->round )
+          )
+        {
             $accountline->adjust(
                 {
                     amount    => $amount,
-- 
2.20.1