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

(-)a/C4/Accounts.pm (-42 lines)
Lines 44-50 BEGIN { Link Here
44
		&getrefunds
44
		&getrefunds
45
		&chargelostitem
45
		&chargelostitem
46
		&ReversePayment
46
		&ReversePayment
47
        &recordpayment_selectaccts
48
        &WriteOffFee
47
        &WriteOffFee
49
        &purge_zero_balance_fees
48
        &purge_zero_balance_fees
50
	);
49
	);
Lines 378-424 sub ReversePayment { Link Here
378
377
379
}
378
}
380
379
381
=head2 recordpayment_selectaccts
382
383
  recordpayment_selectaccts($borrowernumber, $payment,$accts);
384
385
Record payment by a patron. C<$borrowernumber> is the patron's
386
borrower number. C<$payment> is a floating-point number, giving the
387
amount that was paid. C<$accts> is an array ref to a list of
388
accountnos which the payment can be recorded against
389
390
Amounts owed are paid off oldest first. That is, if the patron has a
391
$1 fine from Feb. 1, another $1 fine from Mar. 1, and makes a payment
392
of $1.50, then the oldest fine will be paid off in full, and $0.50
393
will be credited to the next one.
394
395
=cut
396
397
sub recordpayment_selectaccts {
398
    my ( $borrowernumber, $amount, $accts, $note ) = @_;
399
400
    my @lines = Koha::Account::Lines->search(
401
        {
402
            borrowernumber    => $borrowernumber,
403
            amountoutstanding => { '<>' => 0 },
404
            accountno         => { 'IN' => $accts },
405
        },
406
        { order_by => 'date' }
407
    );
408
409
    return Koha::Account->new(
410
        {
411
            patron_id => $borrowernumber,
412
        }
413
      )->pay(
414
        {
415
            amount => $amount,
416
            lines  => \@lines,
417
            note   => $note,
418
        }
419
      );
420
}
421
422
=head2 WriteOffFee
380
=head2 WriteOffFee
423
381
424
  WriteOffFee( $borrowernumber, $accountline_id, $itemnum, $accounttype, $amount, $branch, $payment_note );
382
  WriteOffFee( $borrowernumber, $accountline_id, $itemnum, $accounttype, $amount, $branch, $payment_note );
(-)a/members/paycollect.pl (-2 / +23 lines)
Lines 143-150 if ( $total_paid and $total_paid ne '0.00' ) { Link Here
143
                }
143
                }
144
                my @acc = split /,/, $select;
144
                my @acc = split /,/, $select;
145
                my $note = $input->param('selected_accts_notes');
145
                my $note = $input->param('selected_accts_notes');
146
                recordpayment_selectaccts( $borrowernumber, $total_paid, \@acc, $note );
146
147
            } else {
147
                my @lines = Koha::Account::Lines->search(
148
                    {
149
                        borrowernumber    => $borrowernumber,
150
                        amountoutstanding => { '<>' => 0 },
151
                        accountno         => { 'IN' => \@acc },
152
                    },
153
                    { order_by => 'date' }
154
                );
155
156
                return Koha::Account->new(
157
                    {
158
                        patron_id => $borrowernumber,
159
                    }
160
                  )->pay(
161
                    {
162
                        amount => $total_paid,
163
                        lines  => \@lines,
164
                        note   => $note,
165
                    }
166
                  );
167
            }
168
            else {
148
                my $note = $input->param('selected_accts_notes');
169
                my $note = $input->param('selected_accts_notes');
149
                Koha::Account->new( { patron_id => $borrowernumber } )
170
                Koha::Account->new( { patron_id => $borrowernumber } )
150
                  ->pay( { amount => $total_paid, note => $note } );
171
                  ->pay( { amount => $total_paid, note => $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