From 39005cbe9532f17528210286beec777fb8461bac Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Thu, 27 Sep 2018 12:29:59 +0100 Subject: [PATCH] Bug 21427: Format prices on ordered/spent lists Improvements to the display of lists of ordered and received orders: - Format prices according to CurrencyFormat system preference To test: - Make sure you have some pending and received orders - Access the Spent and Ordered pages by clicking on the amount ordered or spent on the acq start page - Verify that - All price information is shown according to CurrencyFormat Signed-off-by: Martin Renvoize --- acqui/ordered.pl | 4 +--- acqui/spent.pl | 7 ++----- koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt | 7 ++++--- koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt | 7 ++++--- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/acqui/ordered.pl b/acqui/ordered.pl index cc3f04918d..27fe71bd9d 100755 --- a/acqui/ordered.pl +++ b/acqui/ordered.pl @@ -93,7 +93,7 @@ while ( my $data = $sth->fetchrow_hashref ) { } if ( $left && $left > 0 ) { my $subtotal = $left * $data->{'ecost'}; - $data->{subtotal} = sprintf( "%.2f", $subtotal ); + $data->{subtotal} = $subtotal; $data->{'left'} = $left; push @ordered, $data; $total += $subtotal; @@ -105,8 +105,6 @@ while ( my $adj = $adjustments->next ){ $total += $adj->adjustment; } -$total = sprintf( "%.2f", $total ); - $template->{VARS}->{'fund'} = $fund_id; $template->{VARS}->{'ordered'} = \@ordered; $template->{VARS}->{'total'} = $total; diff --git a/acqui/spent.pl b/acqui/spent.pl index 8909eb03e0..b376973e8d 100755 --- a/acqui/spent.pl +++ b/acqui/spent.pl @@ -96,8 +96,7 @@ while ( my $data = $sth->fetchrow_hashref ) { my $recv = $data->{'quantityreceived'}; if ( $recv > 0 ) { my $rowtotal = $recv * $data->{'unitprice'}; - $data->{'rowtotal'} = sprintf( "%.2f", $rowtotal ); - $data->{'unitprice'} = sprintf( "%.2f", $data->{'unitprice'} ); + $data->{'rowtotal'} = $rowtotal; $subtotal += $rowtotal; push @spent, $data; } @@ -115,7 +114,7 @@ $sth->execute($bookfund); my @shipmentcosts; while (my $data = $sth->fetchrow_hashref) { push @shipmentcosts, { - shipmentcost => sprintf("%.2f", $data->{shipmentcost}), + shipmentcost => $data->{shipmentcost}, invoicenumber => $data->{invoicenumber} }; $total += $data->{shipmentcost}; @@ -127,8 +126,6 @@ while ( my $adj = $adjustments->next ){ $total += $adj->adjustment; } -$total = sprintf( "%.2f", $total ); - $template->param( fund => $bookfund, spent => \@spent, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt index 179ba33bb7..233ea0529a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt @@ -2,6 +2,7 @@ [% USE Asset %] [% USE KohaDates %] [% USE ItemTypes %] +[% USE Price %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Acquisitions › Ordered @@ -61,13 +62,13 @@ [% order.left | html %] - [% order.ecost | html %] + [% order.ecost | $Price %] [% order.entrydate | $KohaDates %] - [% order.subtotal | html %] + [% order.subtotal | $Price %] [% END %] @@ -92,7 +93,7 @@ - [% total | html %] + [% total | $Price %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt index 67289b1379..816f264fac 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt @@ -2,6 +2,7 @@ [% USE Asset %] [% USE KohaDates %] [% USE ItemTypes %] +[% USE Price %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Acquisitions › Spent @@ -62,7 +63,7 @@ [% order.quantityreceived | html %] - [% order.unitprice | html %] + [% order.unitprice | $Price %] [% order.entrydate | $KohaDates %] @@ -71,7 +72,7 @@ [% order.datereceived | $KohaDates %] - [% order.rowtotal | html %] + [% order.rowtotal | $Price %] [% END %] @@ -103,7 +104,7 @@ [% END %] TOTAL - [% total | html %] + [% total | $Price %] -- 2.18.0