View | Details | Raw Unified | Return to bug 19336
Collapse All | Expand All

(-)a/misc/cronjobs/fines.pl (-7 / +6 lines)
Lines 38-44 use Carp qw( carp croak ); Link Here
38
use File::Spec;
38
use File::Spec;
39
use Try::Tiny qw( catch try );
39
use Try::Tiny qw( catch try );
40
40
41
use Koha::IssuingRules;
41
use Koha::CirculationRules;
42
use Koha::Calendar;
42
use Koha::Calendar;
43
use Koha::DateUtils qw( dt_from_string output_pref );
43
use Koha::DateUtils qw( dt_from_string output_pref );
44
use Koha::Patrons;
44
use Koha::Patrons;
Lines 158-174 for my $overdue ( @{$overdues} ) { Link Here
158
    my ( $amount, $unitcounttotal, $unitcount);
158
    my ( $amount, $unitcounttotal, $unitcount);
159
    if ( defined($maxfinesdays) && $maxfinesdays <= $datedue->delta_days( $today )->in_units( 'days' ) ) {
159
    if ( defined($maxfinesdays) && $maxfinesdays <= $datedue->delta_days( $today )->in_units( 'days' ) ) {
160
        my $itype = $overdue->{itemtype} || $overdue->{itype};
160
        my $itype = $overdue->{itemtype} || $overdue->{itype};
161
        my $data = Koha::IssuingRules->get_effective_issuing_rule( { categorycode => $borrower->{categorycode}, itemtype => $itype, branchcode => $branchcode } );
161
        my $data = Koha::CirculationRules->get_effective_rule( { rule_name => 'overduefinescap', categorycode => $patron->categorycode, itemtype => $itype, branchcode => $branchcode } );
162
        if ( defined($data->overduefinescap) ) {
162
        if ( defined($data->rule_value) ) {
163
            $amount = $data->overduefinescap;
163
            $amount = $data->rule_value;
164
            $unitcount = 'n/a';
164
            $unitcount = 'n/a';
165
        }
165
        }
166
        else {
166
        else {
167
            print "No overduefinescap defined for {branchcode = $branchcode, itemtype = $itype and categorycode = $borrower->{categorycode}}\n";
167
            print "No overduefinescap defined for {branchcode = $branchcode, itemtype = $itype and categorycode = $patron->categorycode}\n";
168
        }
168
        }
169
    }
169
    }
170
    if (!$amount) {
170
    if (!$amount) {
171
        ( $amount, $unitcounttotal, $unitcount ) = CalcFine( $overdue, $borrower->{categorycode}, $branchcode, $datedue, $today );
171
        ( $amount, $unitcounttotal, $unitcount ) = CalcFine( $overdue, $patron->categorycode, $branchcode, $datedue, $today );
172
    }
172
    }
173
173
174
174
175
- 

Return to bug 19336