From 5ac444ba05153a7224e62012e91506cf478cb5dd 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 --- .../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 1ac29c9..f57ef72 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tt @@ -3,6 +3,7 @@ [% USE Koha %] [% USE KohaDates %] [% USE Branches %] +[% USE Price %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Print receipt for [% patron.cardnumber | html %] @@ -36,7 +37,7 @@ Received with thanks from [% patron.firstname | html %] [% patron.surname | html %]
- Card number : [% patron.cardnumber | html %]
+ Card number: [% patron.cardnumber | html %]
@@ -51,29 +52,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 | html %] + [% 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 | html %][% END %] [% account.note | html %] - [% IF ( account.amountcredit ) %][% ELSE %][% END %][% account.amount | html %] + [% IF ( account.amountcredit ) %][% ELSE %][% END %][% account.amount | $Price %] [% END %] - Total outstanding dues as on date : - [% IF ( totalcredit ) %][% ELSE %][% END %][% total | html %] + 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 2b1e066..5e0ff19 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt @@ -3,6 +3,7 @@ [% USE Koha %] [% USE Branches %] [% USE KohaDates %] +[% USE Price %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Print receipt for [% patron.cardnumber | html %] @@ -51,30 +52,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 | html %] + [% 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 | html %][% END %] [% account.note | html %] [% IF ( account.amountcredit ) %][% ELSE %][% END %][% account.amount | html %] - [% IF ( account.amountoutstandingcredit ) %][% ELSE %][% END %][% account.amountoutstanding | html %] + [% IF ( account.amountoutstandingcredit ) %][% ELSE %][% END %][% account.amountoutstanding | $Price %] [% END %] Total outstanding dues as on date: - [% IF ( totalcredit ) %][% ELSE %][% END %][% total | html %] + [% IF ( totalcredit ) %][% ELSE %][% END %][% total | $Price %] diff --git a/members/printfeercpt.pl b/members/printfeercpt.pl index a6f5fb1..4aa8bd0 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.1.4