- recordpayment_selectaccts( $borrowernumber, $total_paid,
- \@acc );
- } else {
- recordpayment( $borrowernumber, $total_paid );
+ my $note = $input->param('selected_accts_notes');
+
+ my @lines = Koha::Account::Lines->search(
+ {
+ borrowernumber => $borrowernumber,
+ amountoutstanding => { '<>' => 0 },
+ accountlines_id => { 'IN' => \@acc },
+ },
+ { order_by => 'date' }
+ );
+
+ Koha::Account->new(
+ {
+ patron_id => $borrowernumber,
+ }
+ )->pay(
+ {
+ amount => $total_paid,
+ lines => \@lines,
+ note => $note,
+ payment_type => $payment_type,
+ }
+ );
+ }
+ else {
+ my $note = $input->param('selected_accts_notes');
+ Koha::Account->new( { patron_id => $borrowernumber } )->pay(
+ {
+ amount => $total_paid,
+ note => $note,
+ payment_type => $payment_type,
+ }
+ );