@@ -, +, @@ --- misc/cronjobs/fines.pl | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) --- a/misc/cronjobs/fines.pl +++ a/misc/cronjobs/fines.pl @@ -48,6 +48,7 @@ my $verbose; my $output_dir; my $log; my $maxdays; +my $maxfinesdays; GetOptions( 'h|help' => \$help, @@ -55,6 +56,7 @@ GetOptions( 'l|log' => \$log, 'o|out:s' => \$output_dir, 'm|maxdays:i' => \$maxdays, + 'maxfinesdays=i' => \$maxfinesdays ); my $usage = << 'ENDUSAGE'; @@ -69,6 +71,7 @@ This script has the following parameters : -o --out: ouput directory for logs (defaults to env or /tmp if !exist) -v --verbose -m --maxdays: how many days back of overdues to process + --maxfinesdays: number of days after which normal fine amount should jump to maximal amount ENDUSAGE @@ -144,9 +147,16 @@ for my $overdue ( @{$overdues} ) { } ++$counted; - my ( $amount, $unitcounttotal, $unitcount ) = - CalcFine( $overdue, $patron->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. --