Bugzilla – Attachment 109818 Details for
Bug 25596
"Overpayment refund" is not translatable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25596: Identify overpayment refunds for translation
Bug-25596-Identify-overpayment-refunds-for-transla.patch (text/plain), 6.25 KB, created by
Martin Renvoize (ashimema)
on 2020-09-09 14:05:16 UTC
(
hide
)
Description:
Bug 25596: Identify overpayment refunds for translation
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-09-09 14:05:16 UTC
Size:
6.25 KB
patch
obsolete
>From 3ce29890bb0fe534da1d6f0d1495e9f962b3061a Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 9 Sep 2020 14:34:34 +0100 >Subject: [PATCH] Bug 25596: Identify overpayment refunds for translation > >This patch ensure we can uniquely identify automatic overpayment refund >credits from the accountlines by introducing a new account credit type >and adding appropriate translations for the new code. >--- > Koha/Account.pm | 4 ++- > Koha/Account/Line.pm | 3 +-- > installer/data/mysql/account_credit_types.sql | 1 + > installer/data/mysql/account_offset_types.sql | 1 + > .../data/mysql/atomicupdate/bug_25596.perl | 25 +++++++++++++++++++ > .../prog/en/includes/accounts.inc | 1 + > .../bootstrap/en/includes/account-table.inc | 1 + > t/db_dependent/Koha/Account/Line.t | 2 +- > 8 files changed, 34 insertions(+), 4 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_25596.perl > >diff --git a/Koha/Account.pm b/Koha/Account.pm >index 2a63856b52..6ebe703447 100644 >--- a/Koha/Account.pm >+++ b/Koha/Account.pm >@@ -358,9 +358,10 @@ my $credit_line = Koha::Account->new({ patron_id => $patron_id })->add_credit( > > $credit_type can be any of: > - 'CREDIT' >- - 'PAYMENT' > - 'FORGIVEN' > - 'LOST_FOUND' >+ - 'OVERPAYMENT' >+ - 'PAYMENT' > - 'WRITEOFF' > > =cut >@@ -776,6 +777,7 @@ our $offset_type = { > 'CREDIT' => 'Manual Credit', > 'FORGIVEN' => 'Writeoff', > 'LOST_FOUND' => 'Lost Item Found', >+ 'OVERPAYMENT' => 'Overpayment', > 'PAYMENT' => 'Payment', > 'WRITEOFF' => 'Writeoff', > 'ACCOUNT' => 'Account Fee', >diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm >index 98d7ef3c15..8772942f82 100644 >--- a/Koha/Account/Line.pm >+++ b/Koha/Account/Line.pm >@@ -695,8 +695,7 @@ sub adjust { > my $credit = $account->add_credit( > { > amount => $new_outstanding * -1, >- description => 'Overpayment refund', >- type => 'CREDIT', >+ type => 'OVERPAYMENT', > interface => $interface, > ( $update_type eq 'overdue_update' ? ( item_id => $self->itemnumber ) : ()), > } >diff --git a/installer/data/mysql/account_credit_types.sql b/installer/data/mysql/account_credit_types.sql >index 178b98b1c6..d7d8a5b047 100644 >--- a/installer/data/mysql/account_credit_types.sql >+++ b/installer/data/mysql/account_credit_types.sql >@@ -1,4 +1,5 @@ > INSERT INTO account_credit_types ( code, description, can_be_added_manually, is_system ) VALUES >+('OVERPAYMENT', 'Overpayment refund', 0, 1), > ('PAYMENT', 'Payment', 0, 1), > ('WRITEOFF', 'Writeoff', 0, 1), > ('FORGIVEN', 'Forgiven', 1, 1), >diff --git a/installer/data/mysql/account_offset_types.sql b/installer/data/mysql/account_offset_types.sql >index c27a68996f..1f4f24cf34 100644 >--- a/installer/data/mysql/account_offset_types.sql >+++ b/installer/data/mysql/account_offset_types.sql >@@ -14,6 +14,7 @@ INSERT INTO account_offset_types ( type ) VALUES > ('Rental Fee'), > ('Reserve Fee'), > ('Hold Expired'), >+('Overpayment'), > ('OVERDUE_INCREASE'), > ('OVERDUE_DECREASE'), > ('OVERDUE'), >diff --git a/installer/data/mysql/atomicupdate/bug_25596.perl b/installer/data/mysql/atomicupdate/bug_25596.perl >new file mode 100644 >index 0000000000..ac2ea30998 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_25596.perl >@@ -0,0 +1,25 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if ( CheckVersion($DBversion) ) { >+ >+ $dbh->do( >+ qq{ >+ INSERT IGNORE INTO account_credit_types (code, description, can_be_added_manually, is_system) >+ VALUES >+ ('OVERPAYMENT', 'Overpayment refund', 0, 1) >+ } >+ ); >+ >+ $dbh->do( >+ qq{ >+ INSERT IGNORE INTO account_offset_types ( type ) VALUES ('Overpayment'); >+ } >+ ); >+ >+ $dbh->do( >+ qq{ >+ UPDATE accountlines SET credit_type = 'OVERPAYMENT' WHERE credit_type = 'CREDIT' AND description = 'Overpayment refund' >+ } >+ ); >+ >+ NewVersion( $DBversion, 25596, "Add OVERPAYMENT credit type" ); >+} >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc >index 3e37c8d407..0eff7387fb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc >@@ -7,6 +7,7 @@ > [%- CASE 'FORGIVEN' -%]Forgiven > [%- CASE 'CREDIT' -%]Credit > [%- CASE 'LOST_FOUND' -%]Lost item fee refund >+ [%- CASE 'OVERPAYMENT' -%]Overpayment refund > [%- CASE 'Refund' -%]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 dc3444da34..e24dbe774d 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc >@@ -179,6 +179,7 @@ > [%- CASE 'FORGIVEN' -%]Forgiven > [%- CASE 'CREDIT' -%]Credit > [%- CASE 'LOST_FOUND' -%]Lost item fee refund >+ [%- CASE 'OVERPAYMENT' -%]Overpayment refund > [%- CASE -%][% account.credit_type.description | html %] > [%- END -%] > [%- ELSIF account.debit_type_code -%] >diff --git a/t/db_dependent/Koha/Account/Line.t b/t/db_dependent/Koha/Account/Line.t >index fe0376388c..c78a6dcd25 100644 >--- a/t/db_dependent/Koha/Account/Line.t >+++ b/t/db_dependent/Koha/Account/Line.t >@@ -570,7 +570,7 @@ subtest 'adjust() tests' => sub { > > my $overpayment_refund = $account->lines->last; > is( $overpayment_refund->amount * 1, -10, 'A new credit has been added' ); >- is( $overpayment_refund->description, 'Overpayment refund', 'Credit generated with the expected description' ); >+ is( $overpayment_refund->credit_type_code, 'OVERPAYMENT', 'Credit generated with the expected credit_type_code' ); > > $schema->storage->txn_rollback; > }; >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 25596
:
109794
|
109818
|
110551
|
111940
|
111992
|
112078