Bugzilla – Attachment 85914 Details for
Bug 19336
Add option to fines.pl to apply maximal fine amount after delay
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19336: Add --maxfinesday option to fines.pl
Bug-19336-Add---maxfinesday-option-to-finespl.patch (text/plain), 2.82 KB, created by
Mikaël Olangcay Brisebois
on 2019-03-01 21:04:38 UTC
(
hide
)
Description:
Bug 19336: Add --maxfinesday option to fines.pl
Filename:
MIME Type:
Creator:
Mikaël Olangcay Brisebois
Created:
2019-03-01 21:04:38 UTC
Size:
2.82 KB
patch
obsolete
>From 2a166eae9a011db9a7b609847da06d30139f042c Mon Sep 17 00:00:00 2001 >From: David Bourgault <david.bourgault@inlibro.com> >Date: Mon, 18 Sep 2017 13:24:13 -0400 >Subject: [PATCH] Bug 19336: Add --maxfinesday option to fines.pl > >This is a functionality we have for some of our clients we want to push >to the community. > >Adds the --maxfinesday argument to fines.pl which creates or updates a >fine with the maximum amount set in the circulation rules after the >delay has passed. > >e.g.: >./fines.pl --maxfinesdays 30 >All item over 30 days late will have the maximal fine applied. > >Here is a test plan I followed based on above. >Test plan: >1. Create circulation rule with Overdue fines cap set > >2. Set finesMode systempreference to 'Calculate and charge' > >3. Check out an item with the due date set 30 days ago > >4. In Koha shell run ./fines.pl --maxfinesdays 30 > >5. There should now be a new fine in the accountlines table of the >amount set in overdue fines cap > >Followed test plan, patch worked as intended > >Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz> >--- > misc/cronjobs/fines.pl | 18 ++++++++++++++---- > 1 file changed, 14 insertions(+), 4 deletions(-) > >diff --git a/misc/cronjobs/fines.pl b/misc/cronjobs/fines.pl >index 89ad4a2d3c..d815709256 100755 >--- a/misc/cronjobs/fines.pl >+++ b/misc/cronjobs/fines.pl >@@ -44,12 +44,14 @@ my $help; > my $verbose; > my $output_dir; > my $log; >+my $maxfinesdays; > > GetOptions( > 'h|help' => \$help, > 'v|verbose' => \$verbose, > 'l|log' => \$log, >- 'o|out:s' => \$output_dir, >+ 'o|out=s' => \$output_dir, >+ 'maxfinesdays=i' => \$maxfinesdays > ); > my $usage = << 'ENDUSAGE'; > >@@ -63,6 +65,7 @@ This script has the following parameters : > -l --log: log the output to a file (optional if the -o parameter is given) > -o --out: ouput directory for logs (defaults to env or /tmp if !exist) > -v --verbose >+ --maxfinesdays: number of days after which normal fine amount should jump to maximal amount > > ENDUSAGE > >@@ -122,9 +125,16 @@ for my $overdue ( @{$overdues} ) { > } > ++$counted; > >- my ( $amount, $unitcounttotal, $unitcount ) = >- CalcFine( $overdue, $borrower->{categorycode}, >- $branchcode, $datedue, $today ); >+ my ( $amount, $unitcounttotal, $unitcount); >+ if ( defined($maxfinesdays) && $maxfinesdays <= $datedue->delta_days( $today )) { >+ my $itype = $overdue->{itemtype} || $overdue->{itype}; >+ my $data = C4::Circulation::GetIssuingRule( $borrower->{categorycode}, $itype, $branchcode ); >+ $amount = $data->{overduefinescap}; >+ } >+ if (!$amount) { >+ ( $amount, $unitcounttotal, $unitcount ) = CalcFine( $overdue, $borrower->{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. >-- >2.17.1
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 19336
:
67191
|
68318
|
68335
|
68336
|
75379
|
75380
|
75381
|
85914
|
85915
|
85916
|
85917
|
85918
|
85919
|
85920
|
85921
|
85922
|
85923
|
124197
|
124198
|
124199
|
124200
|
124201
|
153504
|
153505
|
153506
|
153507
|
153508
|
168517
|
168518
|
168519
|
168520
|
168521
|
172982
|
172983
|
172984
|
172985
|
172986
|
172987