Bug 15900 - Remove use of recordpayment in ProcessOfflinePayment
authorKyle M Hall <kyle@bywatersolutions.com>
Wed, 24 Feb 2016 15:11:53 +0000 (15:11 +0000)
committerKyle M Hall <kyle@bywatersolutions.com>
Tue, 27 Sep 2016 13:51:38 +0000 (13:51 +0000)
Test plan:
1) Apply this patch
2) prove t/db_dependent/Circulation.t

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
C4/Circulation.pm

index 4d0e7d5..470febc 100644 (file)
@@ -44,6 +44,7 @@ use C4::RotatingCollections qw(GetCollectionItemBranches);
 use Algorithm::CheckDigits;
 
 use Data::Dumper;
+use Koha::Account;
 use Koha::DateUtils;
 use Koha::Calendar;
 use Koha::Items;
@@ -3835,10 +3836,10 @@ sub ProcessOfflineIssue {
 sub ProcessOfflinePayment {
     my $operation = shift;
 
-    my $borrower = C4::Members::GetMemberDetails( undef, $operation->{cardnumber} ); # Get borrower from operation cardnumber
+    my $patron = Koha::Borrowers->find( { cardnumber => $operation->{cardnumber} });
     my $amount = $operation->{amount};
 
-    recordpayment( $borrower->{borrowernumber}, $amount );
+    Koha::Account->new( { patron_id => $patron->id } )->pay( { amount => $amount } );
 
     return "Success."
 }