From 794e3af801bd38d134bca26395b3ad0b2ac7f1a7 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Wed, 8 Aug 2018 19:26:47 +0000 Subject: [PATCH] Bug 21167: Fix price formatting on printed fee invoice and receipt The prices were not formatted correctly on the printed receipts for fines and payments in the patron account. This patch introduces the use of the Price TT plugin to those templates. Also: - Fixes a few capitalization errors - Removes spaces in front of : - Updates accounttype-to-description list to the one used in other templats as a lot of values were missing (Credit etc.) To test: - Create several fines, use some .00 and some with other values - Pay some fines - Create a manual credit - Use print button for all of those (credit, fee, payment) - Verify that: - prices ending in .00 are displayed without the decimal part - instead of Credit only C is shown in the description - Apply patch - Print invoices and receipts again - Verify that: - prices are now formatted according to CurrencyFormat system preference, decimal part always included - verify that correct description for Credit is shown Signed-off-by: Brendan Gallagher Signed-off-by: Josef Moravec Signed-off-by: Martin Renvoize Signed-off-by: Nick Clemens (cherry picked from commit 184c44ee31bf54ad179f9fb9fd501114902a0176) Signed-off-by: Martin Renvoize --- .../prog/en/modules/members/printfeercpt.tt | 41 ++++++++++++------- .../prog/en/modules/members/printinvoice.tt | 37 +++++++++++------ members/printfeercpt.pl | 7 ++-- 3 files changed, 53 insertions(+), 32 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tt index 1e9ad5b274..3e28a61afa 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tt @@ -2,6 +2,7 @@ [% USE Koha %] [% USE KohaDates %] [% USE Branches %] +[% USE Price %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Print receipt for [% patron.cardnumber %] @@ -35,7 +36,7 @@ Received with thanks from [% patron.firstname %] [% patron.surname %]
- Card number : [% patron.cardnumber %]
+ Card number: [% patron.cardnumber %]
@@ -50,29 +51,39 @@ [% account.date | $KohaDates %] [% SWITCH account.accounttype %] - [% CASE 'Pay' %]Payment, thanks - [% CASE 'Pay00' %]Payment, thanks (cash via SIP2) - [% CASE 'Pay01' %]Payment, thanks (VISA via SIP2) - [% CASE 'Pay02' %]Payment, thanks (credit card via SIP2) - [% CASE 'N' %]New Card - [% CASE 'F' %]Fine - [% CASE 'A' %]Account management fee - [% CASE 'M' %]Sundry - [% CASE 'L' %]Lost Item - [% CASE 'W' %]Writeoff - [% CASE %][% account.accounttype %] + [% CASE 'Pay' %]Payment, thanks + [% CASE 'Pay00' %]Payment, thanks (cash via SIP2) + [% CASE 'Pay01' %]Payment, thanks (VISA via SIP2) + [% CASE 'Pay02' %]Payment, thanks (credit card via SIP2) + [% CASE 'N' %]New card + [% CASE 'F' %]Fine + [% CASE 'A' %]Account management fee + [% CASE 'M' %]Sundry + [% CASE 'L' %]Lost item + [% CASE 'W' %]Writeoff + [% CASE 'FU' %]Accruing fine + [% CASE 'HE' %]Hold waiting too long + [% CASE 'Rent' %]Rental fee + [% CASE 'FOR' %]Forgiven + [% CASE 'LR' %]Lost item fee refund + [% CASE 'PF' %]Processing fee + [% CASE 'PAY' %]Payment + [% CASE 'WO' %]Writeoff + [% CASE 'C' %]Credit + [% CASE 'CR' %]Credit + [% CASE %][% account.accounttype | html %] [%- END -%] [%- IF account.description %], [% account.description %][% END %] [% account.note %] - [% IF ( account.amountcredit ) %][% ELSE %][% END %][% account.amount %] + [% IF ( account.amountcredit ) %][% ELSE %][% END %][% account.amount | $Price %] [% END %] - Total outstanding dues as on date : - [% IF ( totalcredit ) %][% ELSE %][% END %][% total %] + Total outstanding dues as on date: + [% IF ( totalcredit ) %][% ELSE %][% END %][% total | $Price %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt index ec3ddf6331..281c7d347d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt @@ -2,6 +2,7 @@ [% USE Koha %] [% USE Branches %] [% USE KohaDates %] +[% USE Price %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Print receipt for [% patron.cardnumber %] @@ -50,30 +51,40 @@ [% account.date | $KohaDates%] [% SWITCH account.accounttype %] - [% CASE 'Pay' %]Payment, thanks - [% CASE 'Pay00' %]Payment, thanks (cash via SIP2) - [% CASE 'Pay01' %]Payment, thanks (VISA via SIP2) - [% CASE 'Pay02' %]Payment, thanks (credit card via SIP2) - [% CASE 'N' %]New Card - [% CASE 'F' %]Fine - [% CASE 'A' %]Account management fee - [% CASE 'M' %]Sundry - [% CASE 'L' %]Lost Item - [% CASE 'W' %]Writeoff - [% CASE %][% account.accounttype %] + [% CASE 'Pay' %]Payment, thanks + [% CASE 'Pay00' %]Payment, thanks (cash via SIP2) + [% CASE 'Pay01' %]Payment, thanks (VISA via SIP2) + [% CASE 'Pay02' %]Payment, thanks (credit card via SIP2) + [% CASE 'N' %]New card + [% CASE 'F' %]Fine + [% CASE 'A' %]Account management fee + [% CASE 'M' %]Sundry + [% CASE 'L' %]Lost item + [% CASE 'W' %]Writeoff + [% CASE 'FU' %]Accruing fine + [% CASE 'HE' %]Hold waiting too long + [% CASE 'Rent' %]Rental fee + [% CASE 'FOR' %]Forgiven + [% CASE 'LR' %]Lost item fee refund + [% CASE 'PF' %]Processing fee + [% CASE 'PAY' %]Payment + [% CASE 'WO' %]Writeoff + [% CASE 'C' %]Credit + [% CASE 'CR' %]Credit + [% CASE %][% account.accounttype %] [%- END -%] [%- IF account.description %], [% account.description %][% END %] [% account.note %] [% IF ( account.amountcredit ) %][% ELSE %][% END %][% account.amount %] - [% IF ( account.amountoutstandingcredit ) %][% ELSE %][% END %][% account.amountoutstanding %] + [% IF ( account.amountoutstandingcredit ) %][% ELSE %][% END %][% account.amountoutstanding | $Price %] [% END %] Total outstanding dues as on date: - [% IF ( totalcredit ) %][% ELSE %][% END %][% total %] + [% IF ( totalcredit ) %][% ELSE %][% END %][% total | $Price %] diff --git a/members/printfeercpt.pl b/members/printfeercpt.pl index a6f5fb15c8..4aa8bd0794 100755 --- a/members/printfeercpt.pl +++ b/members/printfeercpt.pl @@ -84,9 +84,8 @@ my %row = ( 'amountcredit' => $accountline->{'amountcredit'}, 'amountoutstandingcredit' => $accountline->{'amountoutstandingcredit'}, 'description' => $accountline->{'description'}, - 'amount' => sprintf( "%.2f", $accountline->{'amount'} ), - 'amountoutstanding' => - sprintf( "%.2f", $accountline->{'amountoutstanding'} ), + 'amount' => $accountline->{'amount'}, + 'amountoutstanding' => $accountline->{'amountoutstanding'}, 'accountno' => $accountline->{'accountno'}, accounttype => $accountline->{accounttype}, 'note' => $accountline->{'note'}, @@ -96,7 +95,7 @@ my %row = ( $template->param( patron => $patron, finesview => 1, - total => sprintf("%.2f",$total), + total => $total, totalcredit => $totalcredit, accounts => [$accountline], # FIXME There is always only 1 row! ); -- 2.39.5