View | Details | Raw Unified | Return to bug 15908
Collapse All | Expand All

(-)a/C4/Accounts.pm (-42 lines)
Lines 45-51 BEGIN { Link Here
45
		&getrefunds
45
		&getrefunds
46
		&chargelostitem
46
		&chargelostitem
47
		&ReversePayment
47
		&ReversePayment
48
        &recordpayment_selectaccts
49
        &WriteOffFee
48
        &WriteOffFee
50
        &purge_zero_balance_fees
49
        &purge_zero_balance_fees
51
	);
50
	);
Lines 406-452 sub ReversePayment { Link Here
406
405
407
}
406
}
408
407
409
=head2 recordpayment_selectaccts
410
411
  recordpayment_selectaccts($borrowernumber, $payment,$accts);
412
413
Record payment by a patron. C<$borrowernumber> is the patron's
414
borrower number. C<$payment> is a floating-point number, giving the
415
amount that was paid. C<$accts> is an array ref to a list of
416
accountnos which the payment can be recorded against
417
418
Amounts owed are paid off oldest first. That is, if the patron has a
419
$1 fine from Feb. 1, another $1 fine from Mar. 1, and makes a payment
420
of $1.50, then the oldest fine will be paid off in full, and $0.50
421
will be credited to the next one.
422
423
=cut
424
425
sub recordpayment_selectaccts {
426
    my ( $borrowernumber, $amount, $accts, $note ) = @_;
427
428
    my @lines = Koha::Account::Lines->search(
429
        {
430
            borrowernumber    => $borrowernumber,
431
            amountoutstanding => { '<>' => 0 },
432
            accountno         => { 'IN' => $accts },
433
        },
434
        { order_by => 'date' }
435
    );
436
437
    return Koha::Account->new(
438
        {
439
            patron_id => $borrowernumber,
440
        }
441
      )->pay(
442
        {
443
            amount => $amount,
444
            lines  => \@lines,
445
            note   => $note,
446
        }
447
      );
448
}
449
450
=head2 WriteOffFee
408
=head2 WriteOffFee
451
409
452
  WriteOffFee( $borrowernumber, $accountline_id, $itemnum, $accounttype, $amount, $branch, $payment_note );
410
  WriteOffFee( $borrowernumber, $accountline_id, $itemnum, $accounttype, $amount, $branch, $payment_note );
(-)a/t/db_dependent/Accounts.t (-2 lines)
Lines 45-51 can_ok( 'C4::Accounts', Link Here
45
        getcredits
45
        getcredits
46
        getrefunds
46
        getrefunds
47
        ReversePayment
47
        ReversePayment
48
        recordpayment_selectaccts
49
        WriteOffFee
48
        WriteOffFee
50
        purge_zero_balance_fees )
49
        purge_zero_balance_fees )
51
);
50
);
52
- 

Return to bug 15908