Lines 2440-2448
sub _FixOverduesOnReturn {
Link Here
|
2440 |
return 0 unless $accountlines->count; # no warning, there's just nothing to fix |
2440 |
return 0 unless $accountlines->count; # no warning, there's just nothing to fix |
2441 |
|
2441 |
|
2442 |
my $accountline = $accountlines->next; |
2442 |
my $accountline = $accountlines->next; |
|
|
2443 |
my $payments = $accountline->credits; |
2443 |
|
2444 |
|
2444 |
my $amountoutstanding = $accountline->amountoutstanding; |
2445 |
my $amountoutstanding = $accountline->amountoutstanding; |
2445 |
if ($exemptfine && ($amountoutstanding != 0)) { |
2446 |
if ( $accountline->amount == 0 && $payments->count == 0 ) { |
|
|
2447 |
$accountline->delete; |
2448 |
} elsif ($exemptfine && ($amountoutstanding != 0)) { |
2446 |
my $account = Koha::Account->new({patron_id => $borrowernumber}); |
2449 |
my $account = Koha::Account->new({patron_id => $borrowernumber}); |
2447 |
my $credit = $account->add_credit( |
2450 |
my $credit = $account->add_credit( |
2448 |
{ |
2451 |
{ |
Lines 2458-2472
sub _FixOverduesOnReturn {
Link Here
|
2458 |
$credit->apply({ debits => [ $accountline ], offset_type => 'Forgiven' }); |
2461 |
$credit->apply({ debits => [ $accountline ], offset_type => 'Forgiven' }); |
2459 |
|
2462 |
|
2460 |
$accountline->status('FORGIVEN'); |
2463 |
$accountline->status('FORGIVEN'); |
|
|
2464 |
$accountline->store(); |
2461 |
|
2465 |
|
2462 |
if (C4::Context->preference("FinesLog")) { |
2466 |
if (C4::Context->preference("FinesLog")) { |
2463 |
&logaction("FINES", 'MODIFY',$borrowernumber,"Overdue forgiven: item $item"); |
2467 |
&logaction("FINES", 'MODIFY',$borrowernumber,"Overdue forgiven: item $item"); |
2464 |
} |
2468 |
} |
2465 |
} else { |
2469 |
} else { |
2466 |
$accountline->status($status); |
2470 |
$accountline->status($status); |
|
|
2471 |
$accountline->store(); |
2467 |
} |
2472 |
} |
2468 |
|
|
|
2469 |
return $accountline->store(); |
2470 |
} |
2473 |
} |
2471 |
); |
2474 |
); |
2472 |
|
2475 |
|
2473 |
- |
|
|