Bug 27180: Update fines on holidays

This patch removes code that prevents fines from being update on holidays.
The fines are already being calculated, and that takes the calendar into account if
needed, so fines won't be assessed on holidays if they shouldn't.

To test:
 1 - set finesCalendar to 'ignore'
 2 - Checkout an item due yesterday
 3 - Ensure circ rules have a fine amount set
 4 - Make today a holiday
 5 - run fines.pl
 6 - No fine assessed
 7 - Apply patch
 8 - run fines.pl
 9 - Fine assessed!
10 - set finesCalendar to 'use'
11 - checkout an item, due yesterday
12 - run fines.pl
13 - no fine assessed

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Nick Clemens 2020-12-09 15:39:09 +00:00 committed by Jonathan Druart
parent 5f595aab02
commit 80e1b4e66f
1 changed files with 2 additions and 15 deletions

View File

@ -131,11 +131,7 @@ for my $overdue ( @{$overdues} ) {
( $control eq 'ItemHomeLibrary' ) ? $overdue->{homebranch}
: ( $control eq 'PatronLibrary' ) ? $patron->branchcode
: $overdue->{branchcode};
# In final case, CircControl must be PickupLibrary. (branchcode comes from issues table here).
if ( !exists $is_holiday{$branchcode} ) {
$is_holiday{$branchcode} = set_holiday( $branchcode, $today );
}
# In final case, CircControl must be PickupLibrary. (branchcode comes from issues table here).
my $datedue = dt_from_string( $overdue->{date_due} );
if ( DateTime->compare( $datedue, $today ) == 1 ) {
@ -147,9 +143,7 @@ for my $overdue ( @{$overdues} ) {
CalcFine( $overdue, $patron->categorycode,
$branchcode, $datedue, $today );
# 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 ( $mode eq 'production' ) {
if ( $amount && $amount > 0 ) {
UpdateFine(
{
@ -193,13 +187,6 @@ Number of Overdue Items:
EOM
}
sub set_holiday {
my ( $branch, $dt ) = @_;
my $calendar = Koha::Calendar->new( branchcode => $branch );
return $calendar->is_holiday($dt);
}
sub get_filename {
my $directory = shift;
if ( !$directory ) {