From c5e12002292f2200fc41e5e53a28efa203afae30 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 --- 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 f3e1269f64..554c30fc49 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.11.0