From 6821165ad84d679840839f857cb8329f0d84569f Mon Sep 17 00:00:00 2001
From: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Date: Mon, 7 Sep 2020 13:08:46 +0100
Subject: [PATCH] Bug 26398: Restore translations for credit/debit type
 dropdown

1) run ./translate update xx-XX
2) Translate this big chunk in your xx-XX-staff-prog.po or make sure it's translated

msgid ""
"%s %s %sPayment %sWriteoff %sForgiven %sCredit %sLost item fee refund "
"%sRefund %s%s %s %s %s %sAccount creation fee %sAccount renewal fee %sLost "
"item %sManual fee %sNew card %sFine %sLost item processing fee %sRental fee "
"%sDaily rental fee %sRenewal of rental item %sRenewal of daily rental item "
"%sHold fee %sHold waiting too long %sPayout %s%s %s %s %s "

(tip: I search the po file for "Forgiven", there are only two occurrences)

3) run ./translate install xx-XX
4) In your staff interface in your other language, go to a patron's account > Accounting > Create manual Credit
5) Check that the values in the credit drop down are in English
6) Apply patch
7) redo steps 1-4 (careful, the string to be translated changes)
8) Do a hard refresh (Ctrl+F5) (I guess you'd have to restart plack if you have it)
9) Values in the credit drop down are translated

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
---
 .../prog/en/includes/accounts.inc             | 62 +++++++++++--------
 .../prog/en/modules/members/mancredit.tt      |  5 +-
 .../prog/en/modules/members/maninvoice.tt     |  7 ++-
 3 files changed, 44 insertions(+), 30 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc
index 2fb08abe9a..5ffb423006 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc
@@ -1,34 +1,9 @@
 [%- BLOCK account_type_description -%]
     <span>
     [%- IF account.credit_type_code -%]
-        [%- SWITCH account.credit_type_code -%]
-            [%- CASE 'PAYMENT'          -%]Payment
-            [%- CASE 'WRITEOFF'         -%]Writeoff
-            [%- 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 -%]
+        [%- PROCESS credit_type_description credit_type = account.credit_type -%]
     [%- ELSIF account.debit_type_code -%]
-       [%- SWITCH account.debit_type_code -%]
-           [%- CASE 'ACCOUNT'          -%]Account creation fee
-           [%- CASE 'ACCOUNT_RENEW'    -%]Account renewal fee
-           [%- CASE 'LOST'             -%]Lost item
-           [%- CASE 'MANUAL'           -%]Manual fee
-           [%- CASE 'NEW_CARD'         -%]New card
-           [%- CASE 'OVERDUE'          -%]Fine
-           [%- CASE 'PROCESSING'       -%]Lost item processing fee
-           [%- CASE 'RENT'             -%]Rental fee
-           [%- CASE 'RENT_DAILY'       -%]Daily rental fee
-           [%- CASE 'RENT_RENEW'       -%]Renewal of rental item
-           [%- CASE 'RENT_DAILY_RENEW' -%]Renewal of daily rental item
-           [%- CASE 'RESERVE'          -%]Hold fee
-           [%- CASE 'RESERVE_EXPIRED'  -%]Hold waiting too long
-           [%- CASE 'Payout'           -%]Payout
-           [%- CASE                    -%][% account.debit_type.description | html %]
-       [%- END -%]
+        [%- PROCESS debit_type_description debit_type = account.debit_type -%]
     [%- END -%]
     [%- PROCESS account_status_description account=account -%]
     </span>
@@ -59,3 +34,36 @@
         [%- CASE              -%]
     [%- END -%]
 [%- END -%]
+
+[%- BLOCK debit_type_description -%]
+    [%- SWITCH debit_type.code -%]
+        [%- CASE 'ACCOUNT'          -%]Account creation fee
+        [%- CASE 'ACCOUNT_RENEW'    -%]Account renewal fee
+        [%- CASE 'LOST'             -%]Lost item
+        [%- CASE 'MANUAL'           -%]Manual fee
+        [%- CASE 'NEW_CARD'         -%]New card
+        [%- CASE 'OVERDUE'          -%]Fine
+        [%- CASE 'PROCESSING'       -%]Lost item processing fee
+        [%- CASE 'RENT'             -%]Rental fee
+        [%- CASE 'RENT_DAILY'       -%]Daily rental fee
+        [%- CASE 'RENT_RENEW'       -%]Renewal of rental item
+        [%- CASE 'RENT_DAILY_RENEW' -%]Renewal of daily rental item
+        [%- CASE 'RESERVE'          -%]Hold fee
+        [%- CASE 'RESERVE_EXPIRED'  -%]Hold waiting too long
+        [%- CASE 'Payout'           -%]Payout
+        [%- CASE                    -%][% debit_type.description | html %]
+    [%- END -%]
+[%- END -%]
+
+[%- BLOCK credit_type_description -%]
+    [%- SWITCH credit_type.code -%]
+        [%- CASE 'PAYMENT'          -%]Payment
+        [%- CASE 'WRITEOFF'         -%]Writeoff
+        [%- CASE 'FORGIVEN'         -%]Forgiven
+        [%- CASE 'CREDIT'           -%]Credit
+        [%- CASE 'LOST_FOUND'       -%]Lost item fee refund
+        [%- CASE 'OVERPAYMENT'      -%]Overpayment refund
+        [%- CASE 'REFUND'           -%]Refund
+        [%- CASE                    -%][% credit_type.description | html %]
+    [%- END -%]
+[%- END -%]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt
index 997ff495f5..2befd05878 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt
@@ -3,6 +3,9 @@
 [% USE Koha %]
 [% USE Branches %]
 [% SET footerjs = 1 %]
+
+[% PROCESS 'accounts.inc' %]
+
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Patrons &rsaquo; Create manual credit</title>
 [% INCLUDE 'doc-head-close.inc' %]
@@ -46,7 +49,7 @@
                                 <label for="type">Credit type: </label>
                                 <select name="type" id="type">
                                     [% FOREACH credit_type IN credit_types %]
-                                    <option value="[% credit_type.code | html %]">[% credit_type.description | html %]</option>
+                                    <option value="[% credit_type.code | html %]">[%- PROCESS credit_type_description credit_type=credit_type -%]</option>
                                     [% END %]
                                 </select>
                             </li>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt
index 1490f1c745..07c866d5d2 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt
@@ -4,6 +4,9 @@
 [% USE Price %]
 [% USE Branches %]
 [% SET footerjs = 1 %]
+
+[% PROCESS 'accounts.inc' %]
+
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Patrons &rsaquo; Create manual invoice</title>
 [% INCLUDE 'doc-head-close.inc' %]
@@ -56,9 +59,9 @@
                                 <select name="type" id="type">
                                     [% FOREACH debit_type IN debit_types %]
                                     [% IF debit_type.code == type %]
-                                    <option value="[% debit_type.code | html %]" selected="selected">[% debit_type.description | html %]</option>
+                                    <option value="[% debit_type.code | html %]" selected="selected">[%- PROCESS debit_type_description debit_type=debit_type -%]</option>
                                     [% ELSE %]
-                                    <option value="[% debit_type.code | html %]">[% debit_type.description | html %]</option>
+                                    <option value="[% debit_type.code | html %]">[%- PROCESS debit_type_description debit_type=debit_type -%]</option>
                                     [% END %]
                                     [% END %]
                                 </select>
-- 
2.20.1