From 40613eb3c870f941e941280ab7c222a20bf778aa Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 14 Oct 2019 16:20:31 +0100 Subject: [PATCH] Bug 23805: Update 'C' to 'CREDIT' for consistency Signed-off-by: Kyle Hall Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize --- Koha/Account.pm | 6 +++--- Koha/Account/Line.pm | 2 +- api/v1/swagger/definitions/patron_account_credit.json | 2 +- installer/data/mysql/account_credit_types.sql | 2 +- installer/data/mysql/atomicupdate/bug_23805_credit.perl | 9 ++++++++- koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc | 2 +- .../opac-tmpl/bootstrap/en/includes/account-table.inc | 2 +- reports/cash_register_stats.pl | 2 +- 8 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Koha/Account.pm b/Koha/Account.pm index 4d1947e7bb..f9d81050bb 100644 --- a/Koha/Account.pm +++ b/Koha/Account.pm @@ -322,7 +322,7 @@ my $credit_line = Koha::Account->new({ patron_id => $patron_id })->add_credit( ); $credit_type can be any of: - - 'credit' + - 'CREDIT' - 'payment' - 'forgiven' - 'lost_item_return' @@ -716,7 +716,7 @@ sub reconcile_balance { =cut our $offset_type = { - 'credit' => 'Manual Credit', + 'CREDIT' => 'Manual Credit', 'forgiven' => 'Writeoff', 'lost_item_return' => 'Lost Item', 'payment' => 'Payment', @@ -739,7 +739,7 @@ our $offset_type = { =cut our $account_type_credit = { - 'credit' => 'C', + 'CREDIT' => 'CREDIT', 'forgiven' => 'FOR', 'lost_item_return' => 'LOST_RETURN', 'payment' => 'Pay', diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm index 922e7a8a7a..8b7ff53c4b 100644 --- a/Koha/Account/Line.pm +++ b/Koha/Account/Line.pm @@ -338,7 +338,7 @@ sub adjust { { amount => $new_outstanding * -1, description => 'Overpayment refund', - type => 'credit', + type => 'CREDIT', interface => $interface, ( $update_type eq 'overdue_update' ? ( item_id => $self->itemnumber ) : ()), } diff --git a/api/v1/swagger/definitions/patron_account_credit.json b/api/v1/swagger/definitions/patron_account_credit.json index 1bde9c37a8..a2eee7adb7 100644 --- a/api/v1/swagger/definitions/patron_account_credit.json +++ b/api/v1/swagger/definitions/patron_account_credit.json @@ -3,7 +3,7 @@ "properties": { "credit_type": { "type": "string", - "description": "Type of credit ('credit', 'forgiven', 'lost_item_return', 'payment', 'writeoff' )" + "description": "Type of credit ('CREDIT', 'forgiven', 'lost_item_return', 'payment', 'writeoff' )" }, "amount": { "type": "number", diff --git a/installer/data/mysql/account_credit_types.sql b/installer/data/mysql/account_credit_types.sql index 7828d09199..021538e5d9 100644 --- a/installer/data/mysql/account_credit_types.sql +++ b/installer/data/mysql/account_credit_types.sql @@ -4,5 +4,5 @@ INSERT INTO account_debit_types ( code, description, can_be_added_manually, is_s ('W', 'Writeoff', 0, 1), ('WO', 'Writeoff', 0, 1), ('FOR', 'Forgiven', 1, 1), -('C', 'Credit', 1, 1), +('CREDIT', 'Credit', 1, 1), ('LOST_RETURN', 'Lost item fee refund', 0, 1); diff --git a/installer/data/mysql/atomicupdate/bug_23805_credit.perl b/installer/data/mysql/atomicupdate/bug_23805_credit.perl index 46b0d552b7..0ce6c07cc3 100644 --- a/installer/data/mysql/atomicupdate/bug_23805_credit.perl +++ b/installer/data/mysql/atomicupdate/bug_23805_credit.perl @@ -41,7 +41,7 @@ if ( CheckVersion($DBversion) ) { ('W', 'Writeoff', 0, 1), ('WO', 'Writeoff', 0, 1), ('FOR', 'Forgiven', 1, 1), - ('C', 'Credit', 1, 1), + ('CREDIT', 'Credit', 1, 1), ('LOST_RETURN', 'Lost item fee refund', 0, 1) } ); @@ -75,6 +75,13 @@ if ( CheckVersion($DBversion) ) { } ); + # Update accountype 'C' to 'CREDIT' + $dbh->do( + qq{ + UPDATE accountlines SET accounttype = 'CREDIT' WHERE accounttype = 'C' OR accounttype = 'CR' + } + ); + # Populating credit_type_code $dbh->do( qq{ diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc index 332b3508ad..010a89c655 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc @@ -7,7 +7,7 @@ [%- CASE 'FOR' -%]Forgiven [%- CASE 'PAY' -%]Payment [%- CASE 'WO' -%]Writeoff - [%- CASE 'C' -%]Credit + [%- CASE 'CREDIT' -%]Credit [%- CASE 'LOST_RETURN' -%]Lost item fee refund [%- CASE -%][% account.credit_type.description | html %] [%- END -%] 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 937eacd958..ecd1510b21 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc @@ -178,7 +178,7 @@ [%- CASE 'FOR' -%]Forgiven [%- CASE 'PAY' -%]Payment [%- CASE 'WO' -%]Writeoff - [%- CASE 'C' -%]Credit + [%- CASE 'CREDIT' -%]Credit [%- CASE 'LOST_RETURN' -%]Lost item fee refund [%- CASE -%][% account.credit_type.description | html %] [%- END -%] diff --git a/reports/cash_register_stats.pl b/reports/cash_register_stats.pl index d0889bf503..9c9ae2ef67 100755 --- a/reports/cash_register_stats.pl +++ b/reports/cash_register_stats.pl @@ -72,7 +72,7 @@ if ($do_it) { if ($transaction_type eq 'ALL') { #All Transactons $whereTType = q{}; } elsif ($transaction_type eq 'ACT') { #Active - $whereTType = q{ AND credit_type_code IN ('Pay','C') }; + $whereTType = q{ AND credit_type_code IN ('Pay','CREDIT') }; } elsif ($transaction_type eq 'FORW') { $whereTType = q{ AND credit_type_code IN ('FOR','W') }; } else { -- 2.39.5