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

(-)a/Koha/Patron/Debarments.pm (-15 / +21 lines)
Lines 289-310 sub DelDebarmentsAfterPayment { Link Here
289
    my $total_due = $lines->total_outstanding;
289
    my $total_due = $lines->total_outstanding;
290
    
290
    
291
    foreach my $debarment (@{ $debarments }){
291
    foreach my $debarment (@{ $debarments }){
292
        if (exists $liftDebarmentRules->{$debarment->{'comment'}}) {
292
        my $rule;
293
            # Delete debarment IF:
293
294
            # 1. there is no maximum outstanding fines defined for the liftDebarmentRule
294
        foreach my $liftRule (keys %{ $liftDebarmentRules }){
295
            #    and there is no outstanding fines.
295
            my $comment = $debarment->{'comment'};
296
            # 2. there is a maximum outstanding fines amount defined
296
            $rule = $liftRule if $comment =~ $liftRule;
297
            #    and total_due is smaller or equal than the defined maximum outstanding amount
297
        }
298
            # Otherwise, do not lift the debarment.
298
        next unless $rule;
299
            if (not defined $liftDebarmentRules->{$debarment->{'comment'}}->{'outstanding'}){
299
300
                if ($total_due <= 0) {
300
        # Delete debarment IF:
301
                    DelDebarment($debarment->{'borrower_debarment_id'});
301
        # 1. there is no maximum outstanding fines defined for the liftDebarmentRule
302
                }
302
        #    and there is no outstanding fines.
303
        # 2. there is a maximum outstanding fines amount defined
304
        #    and total_due is smaller or equal than the defined maximum outstanding amount
305
        # Otherwise, do not lift the debarment.
306
        if (not defined $liftDebarmentRules->{$rule}->{'outstanding'}){
307
            if ($total_due <= 0) {
308
                DelDebarment($debarment->{'borrower_debarment_id'});
303
            }
309
            }
304
            else {
310
        }
305
                if ($total_due <= $liftDebarmentRules->{$debarment->{'comment'}}->{'outstanding'}) {
311
        else {
306
                    DelDebarment($debarment->{'borrower_debarment_id'});
312
            if ($total_due <= $liftDebarmentRules->{$rule}->{'outstanding'}) {
307
                }
313
                DelDebarment($debarment->{'borrower_debarment_id'});
308
            }
314
            }
309
        }
315
        }
310
    }
316
    }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (-5 / +5 lines)
Lines 70-82 Patrons: Link Here
70
         - pref: DebarmentsToLiftAfterPayment
70
         - pref: DebarmentsToLiftAfterPayment
71
           type: textarea
71
           type: textarea
72
           class: code
72
           class: code
73
         - Lift these debarments after Borrower has paid his/her fees
73
         - Lift these debarments after Borrower has paid his/her fees. Matches dynamic content in debarment comment.
74
         - "<p>Example, debarment is lifted after all fees are paid:</p>"
74
         - "<p>Example, debarments with comment (either exact match or dynamic content, e.g. 'Debarment message for Patron 123') that match 'Debarment message' are lifted after all fees are paid:</p>"
75
         - "<pre>Debarment message:</pre>
75
         - "<pre>Debarment message:</pre>
76
            <pre>  outstanding: 0</pre>"
76
            <pre>  outstanding: 0</pre>"
77
         - "<p>Example, debarment is lifted after payment with outstanding fees less or equal than 5:</p>"
77
         - "<p>Example, debarment with message of exactly 'Debarment message' is lifted after payment with outstanding fees less or equal than 5:</p>"
78
         - "<pre>Another debarment:</pre>
78
         - "<pre>^Debarment message$:</pre>
79
            <pre>  outstanding: 5.00</pre>"
79
            <pre>  outstanding: 5.00</pre>"
80
         - You can use regex in the definitions to match your needs.
80
     -
81
     -
81
         - pref: EnhancedMessagingPreferences
82
         - pref: EnhancedMessagingPreferences
82
           choices:
83
           choices:
83
- 

Return to bug 16223