Browse Source

Bug 22610: Update SIP2 to use payment_type

The SIP2 interface has long used a set of accounttypes to denote payment
types. Now we have an authorised list of payment_types and a
payment_type field in accountlines this patch alters the logic to use
it.

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
remotes/origin/19.11.x
Martin Renvoize 5 years ago
parent
commit
0a14f4009d
Signed by: martin.renvoize GPG Key ID: 422B469130441A0F
  1. 1
      C4/Reserves.pm
  2. 6
      C4/SIP/ILS/Transaction/FeePayment.pm
  3. 12
      Koha/Account.pm
  4. 5
      koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc
  5. 3
      koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc

1
C4/Reserves.pm

@ -577,7 +577,6 @@ sub ChargeReserveFee {
user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef,
library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef,
interface => C4::Context->interface,
sip => undef,
invoice_type => undef,
type => 'reserve',
item_id => undef

6
C4/SIP/ILS/Transaction/FeePayment.pm

@ -50,7 +50,7 @@ sub pay {
my $is_writeoff = shift;
my $disallow_overpayment = shift;
my $type = $is_writeoff ? 'writeoff' : undef;
my $type = $is_writeoff ? 'writeoff' : 'payment';
warn("RECORD:$borrowernumber::$amt");
@ -66,8 +66,8 @@ sub pay {
$account->pay(
{
amount => $amt,
sip => $sip_type,
type => $type,
payment_type => 'SIP' . $sip_type,
lines => [$fee],
interface => C4::Context->interface
}
@ -82,8 +82,8 @@ sub pay {
$account->pay(
{
amount => $amt,
sip => $sip_type,
type => $type,
payment_type => 'SIP' . $sip_type,
interface => C4::Context->interface
}
);

12
Koha/Account.pm

@ -56,7 +56,6 @@ This method allows payments to be made against fees/fines
Koha::Account->new( { patron_id => $borrowernumber } )->pay(
{
amount => $amount,
sip => $sipmode,
note => $note,
description => $description,
library_id => $branchcode,
@ -72,7 +71,6 @@ sub pay {
my ( $self, $params ) = @_;
my $amount = $params->{amount};
my $sip = $params->{sip};
my $description = $params->{description};
my $note = $params->{note} || q{};
my $library_id = $params->{library_id};
@ -211,8 +209,8 @@ sub pay {
}
$account_type ||=
$type eq 'writeoff' ? 'W'
: defined($sip) ? "Pay$sip"
$type eq 'writeoff'
? 'W'
: 'Pay';
$description ||= $type eq 'writeoff' ? 'Writeoff' : q{};
@ -309,7 +307,6 @@ my $credit_line = Koha::Account->new({ patron_id => $patron_id })->add_credit(
user_id => $user_id,
interface => $interface,
library_id => $library_id,
sip => $sip,
payment_type => $payment_type,
type => $credit_type,
item_id => $item_id
@ -336,7 +333,6 @@ sub add_credit {
my $user_id = $params->{user_id};
my $interface = $params->{interface};
my $library_id = $params->{library_id};
my $sip = $params->{sip};
my $payment_type = $params->{payment_type};
my $type = $params->{type} || 'payment';
my $item_id = $params->{item_id};
@ -350,10 +346,6 @@ sub add_credit {
my $schema = Koha::Database->new->schema;
my $account_type = $Koha::Account::account_type_credit->{$type};
$account_type .= $sip
if defined $sip &&
$type eq 'payment';
my $line;
$schema->txn_do(

5
koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc

@ -1,9 +1,6 @@
[%- BLOCK account_type_description -%]
[%- SWITCH account.accounttype -%]
[%- CASE 'Pay' -%]<span>Payment
[%- CASE 'Pay00' -%]<span>Payment (cash via SIP2)
[%- CASE 'Pay01' -%]<span>Payment (VISA via SIP2)
[%- CASE 'Pay02' -%]<span>Payment (credit card via SIP2)
[%- CASE 'N' -%]<span>New card
[%- CASE 'OVERDUE' -%]<span>Fine
[%- CASE 'A' -%]<span>Account management fee
@ -22,7 +19,7 @@
[%- CASE 'C' -%]<span>Credit
[%- CASE 'LOST_RETURN' -%]<span>Lost item fee refund
[%- CASE 'Res' -%]<span>Hold fee
[%- CASE -%][% account.accounttype | html %]
[%- CASE -%]<span>[% account.accounttype | html %]
[%- END -%]
[%- PROCESS account_status_description account=account -%]</span>
[%- END -%]

3
koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc

@ -119,9 +119,6 @@
[%- BLOCK account_type_description -%]
[%- SWITCH account.accounttype -%]
[%- CASE 'Pay' -%]<span>Payment
[%- CASE 'Pay00' -%]<span>Payment (cash via SIP2)
[%- CASE 'Pay01' -%]<span>Payment (VISA via SIP2)
[%- CASE 'Pay02' -%]<span>Payment (credit card via SIP2)
[%- CASE 'VOID' -%]<span>Voided
[%- CASE 'N' -%]<span>New card
[%- CASE 'OVERDUE' -%]<span>Fine

Loading…
Cancel
Save