Bugzilla – Attachment 118414 Details for
Bug 27835
Closed days offsets with one day
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27835: Revert "Bug 27180: (follow-up) Remove unused %is_holiday"
Bug-27835-Revert-Bug-27180-follow-up-Remove-unused.patch (text/plain), 2.52 KB, created by
Tomás Cohen Arazi
on 2021-03-17 16:20:17 UTC
(
hide
)
Description:
Bug 27835: Revert "Bug 27180: (follow-up) Remove unused %is_holiday"
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi
Created:
2021-03-17 16:20:17 UTC
Size:
2.52 KB
patch
obsolete
>From ffdf72f98ae378863685fddc3a43cda8a7afe1f3 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 16 Mar 2021 09:55:10 +0100 >Subject: [PATCH] Bug 27835: Revert "Bug 27180: (follow-up) Remove unused > %is_holiday" > >This reverts commit a26d529a2bc7faee3743b4cd1e603ba29411a0b9. > >Revert "Bug 27180: Update fines on holidays" > >This reverts commit 80e1b4e66f01a07cad9bf37625d879f649edf52a. > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > misc/cronjobs/fines.pl | 18 ++++++++++++++++-- > 1 file changed, 16 insertions(+), 2 deletions(-) > >diff --git a/misc/cronjobs/fines.pl b/misc/cronjobs/fines.pl >index f74c4b9e887..f3e1269f64e 100755 >--- a/misc/cronjobs/fines.pl >+++ b/misc/cronjobs/fines.pl >@@ -101,6 +101,7 @@ my $control = C4::Context->preference('CircControl'); > my $mode = C4::Context->preference('finesMode'); > my $delim = "\t"; # ? C4::Context->preference('CSVDelimiter') || "\t"; > >+my %is_holiday; > my $today = dt_from_string(); > my $filename; > if ($log or $output_dir) { >@@ -130,7 +131,11 @@ 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). >+ >+# 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 ); >+ } > > my $datedue = dt_from_string( $overdue->{date_due} ); > if ( DateTime->compare( $datedue, $today ) == 1 ) { >@@ -142,7 +147,9 @@ for my $overdue ( @{$overdues} ) { > CalcFine( $overdue, $patron->categorycode, > $branchcode, $datedue, $today ); > >- if ( $mode eq 'production' ) { >+ # 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( > { >@@ -186,6 +193,13 @@ 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.31.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27835
:
118032
|
118033
|
118288
|
118289
|
118290
|
118319
|
118320
|
118321
|
118322
|
118361
| 118414 |
118415
|
118416
|
118417
|
118418