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 297-348
sub getcharges {
Link Here
|
297 |
return (@results); |
296 |
return (@results); |
298 |
} |
297 |
} |
299 |
|
298 |
|
300 |
#FIXME: ReversePayment should be replaced with a Void Payment feature |
|
|
301 |
sub ReversePayment { |
302 |
my ($accountlines_id) = @_; |
303 |
my $dbh = C4::Context->dbh; |
304 |
|
305 |
my $accountline = Koha::Account::Lines->find($accountlines_id); |
306 |
my $amount_outstanding = $accountline->amountoutstanding; |
307 |
|
308 |
my $new_amountoutstanding = |
309 |
$amount_outstanding <= 0 ? $accountline->amount * -1 : 0; |
310 |
|
311 |
$accountline->description( $accountline->description . " Reversed -" ); |
312 |
$accountline->amountoutstanding($new_amountoutstanding); |
313 |
$accountline->store(); |
314 |
|
315 |
my $account_offset = Koha::Account::Offset->new( |
316 |
{ |
317 |
credit_id => $accountline->id, |
318 |
type => 'Reverse Payment', |
319 |
amount => $amount_outstanding - $new_amountoutstanding, |
320 |
} |
321 |
)->store(); |
322 |
|
323 |
if ( C4::Context->preference("FinesLog") ) { |
324 |
my $manager_id = 0; |
325 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
326 |
|
327 |
logaction( |
328 |
"FINES", 'MODIFY', |
329 |
$accountline->borrowernumber, |
330 |
Dumper( |
331 |
{ |
332 |
action => 'reverse_fee_payment', |
333 |
borrowernumber => $accountline->borrowernumber, |
334 |
old_amountoutstanding => $amount_outstanding, |
335 |
new_amountoutstanding => $new_amountoutstanding, |
336 |
, |
337 |
accountlines_id => $accountline->id, |
338 |
accountno => $accountline->accountno, |
339 |
manager_id => $manager_id, |
340 |
} |
341 |
) |
342 |
); |
343 |
} |
344 |
} |
345 |
|
346 |
=head2 purge_zero_balance_fees |
299 |
=head2 purge_zero_balance_fees |
347 |
|
300 |
|
348 |
purge_zero_balance_fees( $days ); |
301 |
purge_zero_balance_fees( $days ); |