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 <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 151966d096)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 513fb7fb68)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2021-03-16 10:16:55 +01:00 committed by Andrew Fuerste-Henry
parent 5e0f70cb38
commit 54b35cab23
1 changed files with 17 additions and 12 deletions

View File

@ -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) {