Bug 15903 - Remove use of recordpayment in paycollect.pl
authorKyle M Hall <kyle@bywatersolutions.com>
Wed, 24 Feb 2016 15:25:04 +0000 (15:25 +0000)
committerKyle M Hall <kyle@bywatersolutions.com>
Tue, 27 Sep 2016 13:54:14 +0000 (13:54 +0000)
Test Plan:
1) Apply this patch
2) Pay a fine via the "Pay amount" button
3) Payment should succeed.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
members/paycollect.pl

index db86b0a..1cb6ad9 100755 (executable)
@@ -29,6 +29,7 @@ use C4::Members::Attributes qw(GetBorrowerAttributes);
 use C4::Accounts;
 use C4::Koha;
 use Koha::Patron::Images;
+use Koha::Account;
 
 use Koha::Patron::Categories;
 
@@ -129,11 +130,10 @@ if ( $total_paid and $total_paid ne '0.00' ) {
                 recordpayment_selectaccts( $borrowernumber, $total_paid, \@acc, $note );
             } else {
                 my $note = $input->param('selected_accts_notes');
-                recordpayment( $borrowernumber, $total_paid, '', $note );
+                Koha::Account->new( { patron_id => $borrowernumber } )
+                  ->pay( { amount => $total_paid, note => $note } );
             }
 
-# recordpayment does not return success or failure so lets redisplay the boraccount
-
             print $input->redirect(
 "/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber"
             );