Browse Source

Bug 23805: Update references to accounttype to credit_type_code

Signed-off-by: Kyle Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
remotes/origin/19.11.x
Martin Renvoize 3 years ago
parent
commit
25047ce341
Signed by: martin.renvoize GPG Key ID: 422B469130441A0F
  1. 18
      Koha/Account.pm
  2. 2
      Koha/Account/Line.pm
  3. 4
      Koha/REST/V1/Patrons/Account.pm
  4. 6
      koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc
  5. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt
  6. 6
      koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc
  7. 16
      reports/cash_register_stats.pl

18
Koha/Account.pm

@ -60,8 +60,8 @@ Koha::Account->new( { patron_id => $borrowernumber } )->pay(
note => $note,
description => $description,
library_id => $branchcode,
lines => $lines, # Arrayref of Koha::Account::Line objects to pay
account_type => $type, # accounttype code
lines => $lines, # Arrayref of Koha::Account::Line objects to pay
credit_type => $type, # credit_type_code code
offset_type => $offset_type, # offset type code
}
);
@ -78,7 +78,7 @@ sub pay {
my $lines = $params->{lines};
my $type = $params->{type} || 'payment';
my $payment_type = $params->{payment_type} || undef;
my $account_type = $params->{account_type};
my $credit_type = $params->{credit_type};
my $offset_type = $params->{offset_type} || $type eq 'writeoff' ? 'Writeoff' : 'Payment';
my $cash_register = $params->{cash_register};
@ -215,7 +215,7 @@ sub pay {
last unless $balance_remaining > 0;
}
$account_type ||=
$credit_type ||=
$type eq 'writeoff'
? 'W'
: 'Pay';
@ -228,7 +228,7 @@ sub pay {
date => dt_from_string(),
amount => 0 - $amount,
description => $description,
accounttype => $account_type,
credit_type_code => $credit_type,
payment_type => $payment_type,
amountoutstanding => 0 - $balance_remaining,
manager_id => $manager_id,
@ -263,7 +263,7 @@ sub pay {
borrowernumber => $self->{patron_id},
amount => 0 - $amount,
amountoutstanding => 0 - $balance_remaining,
accounttype => $account_type,
credit_type_code => $credit_type,
accountlines_paid => \@fines_paid,
manager_id => $manager_id,
}
@ -360,7 +360,7 @@ sub add_credit {
my $schema = Koha::Database->new->schema;
my $account_type = $Koha::Account::account_type_credit->{$type};
my $credit_type = $Koha::Account::account_type_credit->{$type};
my $line;
$schema->txn_do(
@ -372,7 +372,7 @@ sub add_credit {
date => \'NOW()',
amount => $amount,
description => $description,
accounttype => $account_type,
credit_type_code => $credit_type,
amountoutstanding => $amount,
payment_type => $payment_type,
note => $note,
@ -410,7 +410,7 @@ sub add_credit {
amount => $amount,
description => $description,
amountoutstanding => $amount,
accounttype => $account_type,
credit_type_code => $credit_type,
note => $note,
itemnumber => $item_id,
manager_id => $user_id,

2
Koha/Account/Line.pm

@ -150,7 +150,7 @@ sub void {
amount => $self->amount,
amountoutstanding => $self->amountoutstanding,
description => $self->description,
accounttype => $self->accounttype,
credit_type_code => $self->credit_type_code,
payment_type => $self->payment_type,
note => $self->note,
itemnumber => $self->itemnumber,

4
Koha/REST/V1/Patrons/Account.pm

@ -225,7 +225,7 @@ sub _to_model {
our $to_api_mapping = {
accountlines_id => 'account_line_id',
accounttype => 'account_type',
credit_type_code => 'credit_type',
debit_type_code => 'debit_type',
amountoutstanding => 'amount_outstanding',
borrowernumber => 'patron_id',
@ -242,7 +242,7 @@ our $to_api_mapping = {
our $to_model_mapping = {
account_line_id => 'accountlines_id',
account_type => 'accounttype',
credit_type => 'credit_type_code',
debit_type => 'debit_type_code',
amount_outstanding => 'amountoutstanding',
checkout_id => 'issue_id',

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

@ -1,7 +1,7 @@
[%- BLOCK account_type_description -%]
<span>
[%- IF account.accounttype -%]
[%- SWITCH account.accounttype -%]
[%- IF account.credit_type_code -%]
[%- SWITCH account.credit_type_code -%]
[%- CASE 'Pay' -%]Payment
[%- CASE 'W' -%]Writeoff
[%- CASE 'FOR' -%]Forgiven
@ -9,7 +9,7 @@
[%- CASE 'WO' -%]Writeoff
[%- CASE 'C' -%]Credit
[%- CASE 'LOST_RETURN' -%]Lost item fee refund
[%- CASE -%][% account.accounttype | html %]
[%- CASE -%][% account.credit_type.description | html %]
[%- END -%]
[%- ELSIF account.debit_type_code -%]
[%- SWITCH account.debit_type_code -%]

2
koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt

@ -159,7 +159,7 @@
<td>[% loopresul.branchname | html %]</td>
<td>[% loopresul.date | $KohaDates %]</td>
<td>
[% IF loopresul.accounttype == "ACT" %]
[% IF loopresul.credit_type == "ACT" %]
<span>All payments to the library</span>
[% ELSE %]
[%- PROCESS account_type_description account=loopresul -%]

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

@ -171,8 +171,8 @@
[%- BLOCK account_type_description -%]
<span>
[%- IF account.accounttype -%]
[%- SWITCH account.accounttype -%]
[%- IF account.credit_type_code -%]
[%- SWITCH account.credit_type_code -%]
[%- CASE 'Pay' -%]Payment
[%- CASE 'W' -%]Writeoff
[%- CASE 'FOR' -%]Forgiven
@ -180,7 +180,7 @@
[%- CASE 'WO' -%]Writeoff
[%- CASE 'C' -%]Credit
[%- CASE 'LOST_RETURN' -%]Lost item fee refund
[%- CASE -%][% account.accounttype | html %]
[%- CASE -%][% account.credit_type.description | html %]
[%- END -%]
[%- ELSIF account.debit_type_code -%]
[%- SWITCH account.debit_type_code -%]

16
reports/cash_register_stats.pl

@ -72,15 +72,15 @@ if ($do_it) {
if ($transaction_type eq 'ALL') { #All Transactons
$whereTType = q{};
} elsif ($transaction_type eq 'ACT') { #Active
$whereTType = q{ AND accounttype IN ('Pay','C') };
$whereTType = q{ AND credit_type_code IN ('Pay','C') };
} elsif ($transaction_type eq 'FORW') {
$whereTType = q{ AND accounttype IN ('FOR','W') };
$whereTType = q{ AND credit_type_code IN ('FOR','W') };
} else {
if ( any { $transaction_type eq $_->code } @debit_types ) {
$whereTType = q{ AND debit_type_code = ? };
push @extra_params, $transaction_type;
} else {
$whereTType = q{ AND accounttype = ? };
$whereTType = q{ AND credit_type_code = ? };
push @extra_params, $transaction_type;
}
}
@ -96,7 +96,7 @@ if ($do_it) {
SELECT round(amount,2) AS amount, description,
bo.surname AS bsurname, bo.firstname AS bfirstname, m.surname AS msurname, m.firstname AS mfirstname,
bo.cardnumber, br.branchname, bo.borrowernumber,
al.borrowernumber, DATE(al.date) as date, al.accounttype, al.debit_type_code, al.amountoutstanding, al.note,
al.borrowernumber, DATE(al.date) as date, al.credit_type_code, al.debit_type_code, al.amountoutstanding, al.note,
bi.title, bi.biblionumber, i.barcode, i.itype
FROM accountlines al
LEFT JOIN borrowers bo ON (al.borrowernumber = bo.borrowernumber)
@ -121,14 +121,14 @@ if ($do_it) {
$row->{date} = dt_from_string($row->{date}, 'sql');
push (@loopresult, $row);
if($transaction_type eq 'ACT' && ($row->{accounttype} !~ /^C$|^CR$|^Pay$/)){
if($transaction_type eq 'ACT' && ($row->{credit_type_code} !~ /^C$|^CR$|^Pay$/)){
pop @loopresult;
next;
}
if($row->{accounttype} =~ /^C$|^CR$/){
if($row->{credit_type_code} =~ /^C$|^CR$/){
$grantotal -= abs($row->{amount});
$row->{amount} = '-' . $row->{amount};
}elsif($row->{accounttype} eq 'FORW' || $row->{accounttype} eq 'W'){
}elsif($row->{credit_type_code} eq 'FORW' || $row->{credit_type_code} eq 'W'){
}else{
$grantotal += abs($row->{amount});
}
@ -155,7 +155,7 @@ if ($do_it) {
$row->{bfirstname} . ' ' . $row->{bsurname},
$row->{branchname},
$row->{date},
$row->{accounttype},
$row->{credit_type},
$row->{debit_type},
$row->{note},
$row->{amount},

Loading…
Cancel
Save