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

(-)a/C4/SIP/ILS/Transaction/FeePayment.pm (-8 / +5 lines)
Lines 21-26 use strict; Link Here
21
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22
22
23
use Koha::Accounts qw(AddCredit);
23
use Koha::Accounts qw(AddCredit);
24
use Koha::Accounts::CreditTypes;
24
use Koha::Database;
25
use Koha::Database;
25
use ILS;
26
use ILS;
26
use parent qw(ILS::Transaction);
27
use parent qw(ILS::Transaction);
Lines 51-66 sub pay { Link Here
51
52
52
    warn("RECORD:$borrowernumber::$amount");
53
    warn("RECORD:$borrowernumber::$amount");
53
54
54
    my $borrower =
55
      Koha::Database->new()->schema->resultset('Borrower')
56
      ->find($borrowernumber);
57
58
    AddCredit(
55
    AddCredit(
59
        {
56
        {
60
            borrower => $borrower,
57
            borrower => Koha::Database->new()->schema->resultset('Borrower')->find($borrowernumber),
61
            amount   => $amount,
58
            amount => $amount,
62
            notes    => 'via SIP2',
59
            notes  => "via SIP2. Type:$type",
63
            type     => $type,
60
            type   => Koha::Accounts::CreditTypes::Payment,
64
        }
61
        }
65
    );
62
    );
66
}
63
}
(-)a/Koha/Accounts.pm (-8 / +2 lines)
Lines 306-318 sub AddCredit { Link Here
306
        croak("Required parameter amount not passed in");
306
        croak("Required parameter amount not passed in");
307
    }
307
    }
308
308
309
    unless ( Koha::Accounts::CreditTypes::IsValid($type) ) {
309
    unless ($type && Koha::Accounts::CreditTypes::IsValid($type) ) {
310
        carp("Invalid credit type! Returning without creating credit.");
310
        carp("Invalid type $type passed in, assuming Payment");
311
        return;
312
    }
313
314
    unless ($type) {
315
        carp("No type passed in, assuming Payment");
316
        $type = Koha::Accounts::CreditTypes::Payment;
311
        $type = Koha::Accounts::CreditTypes::Payment;
317
    }
312
    }
318
313
319
- 

Return to bug 6427