[Koha-patches] [PATCH] Bug #2188: Fixed manualinvoice method in Accounts.pm to use GetAuthorisedValues of Koha.pm for type descriptions rather than hard-coded English ones. Default is English. Extra authorised_values records added in auth_val.sql under MANUAL_INV category. Updated maninvoice help with description of what authorized values may need to be added manually for internationalization.

Chris Cormack chrisc at catalyst.net.nz
Thu Feb 11 04:09:23 CET 2010


From: Will Stokes <will at catalyst.net.nz>

Signed-off-by: Chris Cormack <chrisc at catalyst.net.nz>
---
 C4/Accounts.pm                                     |   13 +++++++------
 installer/data/mysql/en/optional/auth_val.sql      |    7 +++++++
 .../prog/en/modules/help/members/maninvoice.tmpl   |   11 +++++++++++
 3 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/C4/Accounts.pm b/C4/Accounts.pm
index c40fc39..c0e8c94 100644
--- a/C4/Accounts.pm
+++ b/C4/Accounts.pm
@@ -24,6 +24,7 @@ use C4::Stats;
 use C4::Members;
 use C4::Items;
 use C4::Circulation qw(MarkIssueReturned);
+use C4::Koha;
 
 use vars qw($VERSION @ISA @EXPORT);
 
@@ -365,22 +366,22 @@ sub manualinvoice {
 #        $amountleft =
 #          fixcredit( $borrowernumber, $amount2, $itemnum, $type, $user );
 #    }
+    my %types = map { $_->{authorised_value} => $_->{lib} } @{C4::Koha::GetAuthorisedValues('MANUAL_INV', undef, undef)};
     if ( $type eq 'N' ) {
-        $desc .= " New Card";
+        $desc .= " ".( $types{$type} ) ? $types{$type} : "New Card";
     }
     if ( $type eq 'F' ) {
-        $desc .= " Fine";
+        $desc .= " ".( $types{$type} ) ? $types{$type} : "Fine";
     }
     if ( $type eq 'A' ) {
-        $desc .= " Account Management fee";
+        $desc .= " ".( $types{$type} ) ? $types{$type} : "Account Management Fee";
     }
     if ( $type eq 'M' ) {
-        $desc .= " Sundry";
+        $desc .= " ".( $types{$type} ) ? $types{$type} : "Sundry";
     }
 
     if ( $type eq 'L' && $desc eq '' ) {
-
-        $desc = " Lost Item";
+        $desc .= " ".( $types{$type} ) ? $types{$type} : "Lost Item";
     }
 #    if ( $type eq 'REF' ) {
 #        $desc .= " Cash Refund";
diff --git a/installer/data/mysql/en/optional/auth_val.sql b/installer/data/mysql/en/optional/auth_val.sql
index 5a39534..7a2897d 100644
--- a/installer/data/mysql/en/optional/auth_val.sql
+++ b/installer/data/mysql/en/optional/auth_val.sql
@@ -48,6 +48,13 @@ INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('RESTR
 
 -- manual invoice types
 INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('MANUAL_INV','Copier Fees','.25');
+INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('MANUAL_INV','C','Credit');
+INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('MANUAL_INV','N','New Card');
+INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('MANUAL_INV','F','Fine');
+INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('MANUAL_INV','A','Account Management Fee');
+INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('MANUAL_INV','M','Sundry');
+INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('MANUAL_INV','L','Lost Item');
+INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('MANUAL_INV','FOR','Forgiven');
 
 --custom borrower notes
 INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('BOR_NOTES','ADDR','Address Notes');
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/maninvoice.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/maninvoice.tmpl
index 97d6ebd..daa6277 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/maninvoice.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/maninvoice.tmpl
@@ -9,5 +9,16 @@
 			<ul><li style="color: #990000">IMPORTANT: Set the authorized value field as the description and the description field is the default fee, if any.</li></ul>
 			<li>Manual invoices can be paid the same way as automatic fines, by clicking on 'Pay fines'</li>
 		</ul>
+<h2>Internationalization</h2>
+If your install did not do this automatically and you require internationalization you will need to add the following authorized values in the MANUAL_INV category:
+	<ul>
+		<li>C, Credit</li>
+		<li>N, New Card</li>
+		<li>F, Fine</li>
+		<li>A, Account Management Fee</li>
+		<li>M, Sundry</li>
+		<li>L, Lost Item</li>
+		<li>FOR, Forgiven</li>
+	</ul>
 
 <!-- TMPL_INCLUDE NAME="help-bottom.inc" -->
\ No newline at end of file
-- 
1.6.3.3




More information about the Koha-patches mailing list