From 0185ff2058f1e3c324669e8a62c44b0f2f7d6a96 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 24 Mar 2021 16:38:32 +0000 Subject: [PATCH] Bug 25508: Do not attempt renewals if syspref is disabled In the case where 'RenewAccruingItemWhenPaid' is disabled we were still testing whether the fine item was renewable ragerdless. This has two issued: 1. A minor performance issue with us running more code than required. 2. The return value from renew_item when the syspref is disabled was empty, but it would still get appended to the 'renew_outcomes' array which results in some 'dirty' messages in the UI. Test plan 1 - Make sure FinesMode is on, RenewAccruingItemWhenPaid is off 2 - Checkout an item to a patron and make it overdue (can backdate the checkout) 3 - Make sure the itemtype has fines that will be charged 4 - Charge the fines: Set finesMode = production perl misc/cronjobs/fines.pl -v 5 - Check the fine appears on the patrons account 6 - Pay off the fine 7 - Receive alert after payment that reads: "The fines on the following items were paid off, renewal results are displayed below: No title ( ): Not renewed - Unknown error" 8 - Apply the patch 9 - Repeat steps 1 through 6 and note that you no longer trigger the error message. --- Koha/Account.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/Account.pm b/Koha/Account.pm index b4838bcdf2..7167808db0 100644 --- a/Koha/Account.pm +++ b/Koha/Account.pm @@ -203,7 +203,7 @@ sub pay { # If we need to make a note of the item associated with this line, # in order that we can potentially renew it, do so. my $amt = $old_amountoutstanding - $amount_to_pay; - if ($fine->renewable) { + if ( C4::Context->preference('RenewAccruingItemWhenPaid') && $fine->renewable ) { my $outcome = $fine->renew_item; push @{$renew_outcomes}, $outcome; } -- 2.20.1