From 80e1b4e66f01a07cad9bf37625d879f649edf52a Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 9 Dec 2020 15:39:09 +0000 Subject: [PATCH] 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 Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart --- misc/cronjobs/fines.pl | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/misc/cronjobs/fines.pl b/misc/cronjobs/fines.pl index 9f61c0f598..198ecdcde3 100755 --- a/misc/cronjobs/fines.pl +++ b/misc/cronjobs/fines.pl @@ -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 ) { -- 2.39.5