From 25047ce341500fa55903e88ef283e6508bd28423 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 14 Oct 2019 11:27:31 +0100 Subject: [PATCH] Bug 23805: Update references to accounttype to credit_type_code Signed-off-by: Kyle Hall Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize --- Koha/Account.pm | 18 +++++++++--------- Koha/Account/Line.pm | 2 +- Koha/REST/V1/Patrons/Account.pm | 4 ++-- .../prog/en/includes/accounts.inc | 6 +++--- .../en/modules/reports/cash_register_stats.tt | 2 +- .../bootstrap/en/includes/account-table.inc | 6 +++--- reports/cash_register_stats.pl | 16 ++++++++-------- 7 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Koha/Account.pm b/Koha/Account.pm index 2a8d557235..4d1947e7bb 100644 --- a/Koha/Account.pm +++ b/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, diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm index 14fdbd33b6..922e7a8a7a 100644 --- a/Koha/Account/Line.pm +++ b/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, diff --git a/Koha/REST/V1/Patrons/Account.pm b/Koha/REST/V1/Patrons/Account.pm index 5c7a7f3393..b5bd5ca4b4 100644 --- a/Koha/REST/V1/Patrons/Account.pm +++ b/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', diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc index 8a5c20b81a..332b3508ad 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc @@ -1,7 +1,7 @@ [%- BLOCK account_type_description -%] - [%- 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 -%] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt index c145ce3940..dc2b1c82c7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt @@ -159,7 +159,7 @@ [% loopresul.branchname | html %] [% loopresul.date | $KohaDates %] - [% IF loopresul.accounttype == "ACT" %] + [% IF loopresul.credit_type == "ACT" %] All payments to the library [% ELSE %] [%- PROCESS account_type_description account=loopresul -%] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc index 2d5093a030..937eacd958 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc @@ -171,8 +171,8 @@ [%- BLOCK account_type_description -%] - [%- 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 -%] diff --git a/reports/cash_register_stats.pl b/reports/cash_register_stats.pl index b4340c9f62..d0889bf503 100755 --- a/reports/cash_register_stats.pl +++ b/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}, -- 2.39.5