|
Lines 42-48
BEGIN {
Link Here
|
| 42 |
&getnextacctno |
42 |
&getnextacctno |
| 43 |
&getcharges |
43 |
&getcharges |
| 44 |
&chargelostitem |
44 |
&chargelostitem |
| 45 |
&ReversePayment |
|
|
| 46 |
&purge_zero_balance_fees |
45 |
&purge_zero_balance_fees |
| 47 |
); |
46 |
); |
| 48 |
} |
47 |
} |
|
Lines 329-380
sub getcharges {
Link Here
|
| 329 |
return (@results); |
328 |
return (@results); |
| 330 |
} |
329 |
} |
| 331 |
|
330 |
|
| 332 |
#FIXME: ReversePayment should be replaced with a Void Payment feature |
|
|
| 333 |
sub ReversePayment { |
| 334 |
my ($accountlines_id) = @_; |
| 335 |
my $dbh = C4::Context->dbh; |
| 336 |
|
| 337 |
my $accountline = Koha::Account::Lines->find($accountlines_id); |
| 338 |
my $amount_outstanding = $accountline->amountoutstanding; |
| 339 |
|
| 340 |
my $new_amountoutstanding = |
| 341 |
$amount_outstanding <= 0 ? $accountline->amount * -1 : 0; |
| 342 |
|
| 343 |
$accountline->description( $accountline->description . " Reversed -" ); |
| 344 |
$accountline->amountoutstanding($new_amountoutstanding); |
| 345 |
$accountline->store(); |
| 346 |
|
| 347 |
my $account_offset = Koha::Account::Offset->new( |
| 348 |
{ |
| 349 |
credit_id => $accountline->id, |
| 350 |
type => 'Reverse Payment', |
| 351 |
amount => $amount_outstanding - $new_amountoutstanding, |
| 352 |
} |
| 353 |
)->store(); |
| 354 |
|
| 355 |
if ( C4::Context->preference("FinesLog") ) { |
| 356 |
my $manager_id = 0; |
| 357 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
| 358 |
|
| 359 |
logaction( |
| 360 |
"FINES", 'MODIFY', |
| 361 |
$accountline->borrowernumber, |
| 362 |
Dumper( |
| 363 |
{ |
| 364 |
action => 'reverse_fee_payment', |
| 365 |
borrowernumber => $accountline->borrowernumber, |
| 366 |
old_amountoutstanding => $amount_outstanding, |
| 367 |
new_amountoutstanding => $new_amountoutstanding, |
| 368 |
, |
| 369 |
accountlines_id => $accountline->id, |
| 370 |
accountno => $accountline->accountno, |
| 371 |
manager_id => $manager_id, |
| 372 |
} |
| 373 |
) |
| 374 |
); |
| 375 |
} |
| 376 |
} |
| 377 |
|
| 378 |
=head2 purge_zero_balance_fees |
331 |
=head2 purge_zero_balance_fees |
| 379 |
|
332 |
|
| 380 |
purge_zero_balance_fees( $days ); |
333 |
purge_zero_balance_fees( $days ); |