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

(-)a/C4/Circulation.pm (-4 / +6 lines)
Lines 2430-2438 sub _FixOverduesOnReturn { Link Here
2430
            return 0 unless $accountlines->count; # no warning, there's just nothing to fix
2430
            return 0 unless $accountlines->count; # no warning, there's just nothing to fix
2431
2431
2432
            my $accountline = $accountlines->next;
2432
            my $accountline = $accountlines->next;
2433
            my $payments = $accountline->credits;
2433
2434
2434
            my $amountoutstanding = $accountline->amountoutstanding;
2435
            my $amountoutstanding = $accountline->amountoutstanding;
2435
            if ($exemptfine && ($amountoutstanding != 0)) {
2436
            if ( $accountline->amount == 0 && $payments->count == 0 ) {
2437
                $accountline->delete;
2438
            } elsif ($exemptfine && ($amountoutstanding != 0)) {
2436
                my $account = Koha::Account->new({patron_id => $borrowernumber});
2439
                my $account = Koha::Account->new({patron_id => $borrowernumber});
2437
                my $credit = $account->add_credit(
2440
                my $credit = $account->add_credit(
2438
                    {
2441
                    {
Lines 2448-2462 sub _FixOverduesOnReturn { Link Here
2448
                $credit->apply({ debits => [ $accountline ], offset_type => 'Forgiven' });
2451
                $credit->apply({ debits => [ $accountline ], offset_type => 'Forgiven' });
2449
2452
2450
                $accountline->status('FORGIVEN');
2453
                $accountline->status('FORGIVEN');
2454
                $accountline->store();
2451
2455
2452
                if (C4::Context->preference("FinesLog")) {
2456
                if (C4::Context->preference("FinesLog")) {
2453
                    &logaction("FINES", 'MODIFY',$borrowernumber,"Overdue forgiven: item $item");
2457
                    &logaction("FINES", 'MODIFY',$borrowernumber,"Overdue forgiven: item $item");
2454
                }
2458
                }
2455
            } else {
2459
            } else {
2456
                $accountline->status($status);
2460
                $accountline->status($status);
2461
                $accountline->store();
2457
            }
2462
            }
2458
2459
            return $accountline->store();
2460
        }
2463
        }
2461
    );
2464
    );
2462
2465
2463
- 

Return to bug 8338