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

Return to bug 19336