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 151-167 for my $overdue ( @{$overdues} ) { Link Here
151
    my ( $amount, $unitcounttotal, $unitcount);
151
    my ( $amount, $unitcounttotal, $unitcount);
152
    if ( defined($maxfinesdays) && $maxfinesdays <= $datedue->delta_days( $today )->in_units( 'days' ) ) {
152
    if ( defined($maxfinesdays) && $maxfinesdays <= $datedue->delta_days( $today )->in_units( 'days' ) ) {
153
        my $itype = $overdue->{itemtype} || $overdue->{itype};
153
        my $itype = $overdue->{itemtype} || $overdue->{itype};
154
        my $data = Koha::IssuingRules->get_effective_issuing_rule( { categorycode => $borrower->{categorycode}, itemtype => $itype, branchcode => $branchcode } );
154
        my $data = Koha::CirculationRules->get_effective_rule( { rule_name => 'overduefinescap', categorycode => $patron->categorycode, itemtype => $itype, branchcode => $branchcode } );
155
        if ( defined($data->overduefinescap) ) {
155
        if ( defined($data->rule_value) ) {
156
            $amount = $data->overduefinescap;
156
            $amount = $data->rule_value;
157
            $unitcount = 'n/a';
157
            $unitcount = 'n/a';
158
        }
158
        }
159
        else {
159
        else {
160
            print "No overduefinescap defined for {branchcode = $branchcode, itemtype = $itype and categorycode = $borrower->{categorycode}}\n";
160
            print "No overduefinescap defined for {branchcode = $branchcode, itemtype = $itype and categorycode = $patron->categorycode}\n";
161
        }
161
        }
162
    }
162
    }
163
    if (!$amount) {
163
    if (!$amount) {
164
        ( $amount, $unitcounttotal, $unitcount ) = CalcFine( $overdue, $borrower->{categorycode}, $branchcode, $datedue, $today );
164
        ( $amount, $unitcounttotal, $unitcount ) = CalcFine( $overdue, $patron->categorycode, $branchcode, $datedue, $today );
165
    }
165
    }
166
166
167
167
168
- 

Return to bug 19336