From 2c0c1f22780e13dbf30734f0d1edfa50da989b6a Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 25 Jun 2014 13:47:57 -0400 Subject: [PATCH] Bug 6427 [Part 35] - Add type to note for SIP2 payments --- C4/SIP/ILS/Transaction/FeePayment.pm | 13 +++++-------- Koha/Accounts.pm | 9 ++------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/C4/SIP/ILS/Transaction/FeePayment.pm b/C4/SIP/ILS/Transaction/FeePayment.pm index 8b70fd0..a34505f 100644 --- a/C4/SIP/ILS/Transaction/FeePayment.pm +++ b/C4/SIP/ILS/Transaction/FeePayment.pm @@ -21,6 +21,7 @@ use strict; # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. use Koha::Accounts qw(AddCredit); +use Koha::Accounts::CreditTypes; use Koha::Database; use ILS; use parent qw(ILS::Transaction); @@ -51,16 +52,12 @@ sub pay { warn("RECORD:$borrowernumber::$amount"); - my $borrower = - Koha::Database->new()->schema->resultset('Borrower') - ->find($borrowernumber); - AddCredit( { - borrower => $borrower, - amount => $amount, - notes => 'via SIP2', - type => $type, + borrower => Koha::Database->new()->schema->resultset('Borrower')->find($borrowernumber), + amount => $amount, + notes => "via SIP2. Type:$type", + type => Koha::Accounts::CreditTypes::Payment, } ); } diff --git a/Koha/Accounts.pm b/Koha/Accounts.pm index 90677e2..dc1b218 100644 --- a/Koha/Accounts.pm +++ b/Koha/Accounts.pm @@ -306,13 +306,8 @@ sub AddCredit { croak("Required parameter amount not passed in"); } - unless ( Koha::Accounts::CreditTypes::IsValid($type) ) { - carp("Invalid credit type! Returning without creating credit."); - return; - } - - unless ($type) { - carp("No type passed in, assuming Payment"); + unless ($type && Koha::Accounts::CreditTypes::IsValid($type) ) { + carp("Invalid type $type passed in, assuming Payment"); $type = Koha::Accounts::CreditTypes::Payment; } -- 1.7.2.5