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