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

Return to bug 19336