From 513fb7fb683f8e43a368099916500e170a79fcb2 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 16 Mar 2021 10:16:55 +0100 Subject: [PATCH] Bug 27835: Add a syspref to control fines calculation on closed days Bug 27180 added a patch to not update fines on holidays if finesCalendar was set to ignore. At least it's what it advertised, but not what it did. It seems that we need to add a new pref to control the calculation of fines on closed days to answer the different use cases. Test plan: With this patch applied you can run the fines.pl cronjob and play with the new pref ChargeFinesOnCloseDay to generate fines on close days. Signed-off-by: Nick Clemens Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 151966d0967786ab235158b4c1a84e19788610b2) Signed-off-by: Fridolin Somers --- misc/cronjobs/fines.pl | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/misc/cronjobs/fines.pl b/misc/cronjobs/fines.pl index 9f61c0f598..c1d1a54d3a 100755 --- a/misc/cronjobs/fines.pl +++ b/misc/cronjobs/fines.pl @@ -149,18 +149,23 @@ for my $overdue ( @{$overdues} ) { # Don't update the fine if today is a holiday. # This ensures that dropbox mode will remove the correct amount of fine. - if ( $mode eq 'production' && !$is_holiday{$branchcode} ) { - if ( $amount && $amount > 0 ) { - UpdateFine( - { - issue_id => $overdue->{issue_id}, - itemnumber => $overdue->{itemnumber}, - borrowernumber => $overdue->{borrowernumber}, - amount => $amount, - due => output_pref($datedue), - } - ); - } + if ( + $mode eq 'production' + && ( !$is_holiday{$branchcode} + || C4::Context->preference('ChargeFinesOnCloseDay') ) + && ( $amount && $amount > 0 ) + ) + { + warn 'charge'; + UpdateFine( + { + issue_id => $overdue->{issue_id}, + itemnumber => $overdue->{itemnumber}, + borrowernumber => $overdue->{borrowernumber}, + amount => $amount, + due => output_pref($datedue), + } + ); } my $borrower = $patron->unblessed; if ($filename) { -- 2.39.5