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

(-)a/C4/Accounts.pm (-42 lines)
Lines 46-52 BEGIN { Link Here
46
		&chargelostitem
46
		&chargelostitem
47
		&ReversePayment
47
		&ReversePayment
48
        &makepartialpayment
48
        &makepartialpayment
49
        &recordpayment_selectaccts
50
        &WriteOffFee
49
        &WriteOffFee
51
        &purge_zero_balance_fees
50
        &purge_zero_balance_fees
52
	);
51
	);
Lines 353-399 sub ReversePayment { Link Here
353
352
354
}
353
}
355
354
356
=head2 recordpayment_selectaccts
357
358
  recordpayment_selectaccts($borrowernumber, $payment,$accts);
359
360
Record payment by a patron. C<$borrowernumber> is the patron's
361
borrower number. C<$payment> is a floating-point number, giving the
362
amount that was paid. C<$accts> is an array ref to a list of
363
accountnos which the payment can be recorded against
364
365
Amounts owed are paid off oldest first. That is, if the patron has a
366
$1 fine from Feb. 1, another $1 fine from Mar. 1, and makes a payment
367
of $1.50, then the oldest fine will be paid off in full, and $0.50
368
will be credited to the next one.
369
370
=cut
371
372
sub recordpayment_selectaccts {
373
    my ( $borrowernumber, $amount, $accts, $note ) = @_;
374
375
    my @lines = Koha::Account::Lines->search(
376
        {
377
            borrowernumber    => $borrowernumber,
378
            amountoutstanding => { '<>' => 0 },
379
            accountno         => { 'IN' => $accts },
380
        },
381
        { order_by => 'date' }
382
    );
383
384
    return Koha::Account->new(
385
        {
386
            patron_id => $borrowernumber,
387
        }
388
      )->pay(
389
        {
390
            amount => $amount,
391
            lines  => \@lines,
392
            note   => $note,
393
        }
394
      );
395
}
396
397
sub makepartialpayment {
355
sub makepartialpayment {
398
    my ( $accountlines_id, $borrowernumber, $accountno, $amount, $user, $branch, $payment_note ) = @_;
356
    my ( $accountlines_id, $borrowernumber, $accountno, $amount, $user, $branch, $payment_note ) = @_;
399
357
(-)a/members/paycollect.pl (-2 / +22 lines)
Lines 132-139 if ( $total_paid and $total_paid ne '0.00' ) { Link Here
132
                }
132
                }
133
                my @acc = split /,/, $select;
133
                my @acc = split /,/, $select;
134
                my $note = $input->param('selected_accts_notes');
134
                my $note = $input->param('selected_accts_notes');
135
                recordpayment_selectaccts( $borrowernumber, $total_paid, \@acc, $note );
135
136
            } else {
136
                my @lines = Koha::Account::Lines->search(
137
                    {
138
                        borrowernumber    => $borrowernumber,
139
                        accountno         => { 'IN' => \@acc },
140
                    },
141
                    { order_by => 'date' }
142
                );
143
144
                return Koha::Account->new(
145
                    {
146
                        patron_id => $borrowernumber,
147
                    }
148
                  )->pay(
149
                    {
150
                        amount => $total_paid,
151
                        lines  => \@lines,
152
                        note   => $note,
153
                    }
154
                  );
155
            }
156
            else {
137
                my $note = $input->param('selected_accts_notes');
157
                my $note = $input->param('selected_accts_notes');
138
                Koha::Account->new( { patron_id => $borrowernumber } )
158
                Koha::Account->new( { patron_id => $borrowernumber } )
139
                  ->pay( { amount => $total_paid, note => $note } );
159
                  ->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
        makepartialpayment
48
        makepartialpayment
50
        WriteOffFee
49
        WriteOffFee
51
        purge_zero_balance_fees )
50
        purge_zero_balance_fees )
52
- 

Return to bug 15908