@@ -, +, @@ --- misc/cronjobs/fines.pl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) --- a/misc/cronjobs/fines.pl +++ a/misc/cronjobs/fines.pl @@ -36,6 +36,7 @@ use Getopt::Long; use Carp; use File::Spec; +use Koha::IssuingRules; use Koha::Calendar; use Koha::DateUtils; use C4::Log; @@ -126,10 +127,15 @@ for my $overdue ( @{$overdues} ) { ++$counted; my ( $amount, $unitcounttotal, $unitcount); - if ( defined($maxfinesdays) && $maxfinesdays <= $datedue->delta_days( $today )) { + if ( defined($maxfinesdays) && $maxfinesdays <= $datedue->delta_days( $today )->in_units( 'days' ) ) { my $itype = $overdue->{itemtype} || $overdue->{itype}; - my $data = C4::Circulation::GetIssuingRule( $borrower->{categorycode}, $itype, $branchcode ); - $amount = $data->{overduefinescap}; + my $data = Koha::IssuingRules->get_effective_issuing_rule( { categorycode => $borrower->{categorycode}, itemtype => $itype, branchcode => $branchcode } ); + if ( defined($data->overduefinescap) ) { + $amount = $data->overduefinescap; + } + else { + print "No overduefinescap defined for {branchcode = $branchcode, itemtype = $itype and categorycode = $borrower->{categorycode}}\n"; + } } if (!$amount) { ( $amount, $unitcounttotal, $unitcount ) = CalcFine( $overdue, $borrower->{categorycode}, $branchcode, $datedue, $today ); --