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