From 2a755a6f5315a6525a3a884e336f6634cbb45cf8 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Fri, 10 Aug 2018 16:52:52 +0000 Subject: [PATCH] Bug 19271: Show vendor name and format prices on ordered/spent lists Improvements to the display of lists of ordered and received orders: - Format prices according to CurrencyFormat system preference - Show the vendor's name instead of the internal number 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 - Vendor name shows --- acqui/ordered.pl | 7 ++++--- acqui/spent.pl | 12 ++++++------ koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt | 9 +++++---- koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt | 9 +++++---- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/acqui/ordered.pl b/acqui/ordered.pl index e39349092e..27fe71bd9d 100755 --- a/acqui/ordered.pl +++ b/acqui/ordered.pl @@ -56,6 +56,7 @@ SELECT quantity-quantityreceived AS tleft, ecost, budgetdate, entrydate, aqbasket.booksellerid, + aqbooksellers.name as vendorname, itype, title FROM (aqorders, aqbasket) @@ -65,6 +66,8 @@ LEFT JOIN aqorders_items ON aqorders.ordernumber=aqorders_items.ordernumber LEFT JOIN items ON items.itemnumber=aqorders_items.itemnumber +LEFT JOIN aqbooksellers ON + aqbasket.booksellerid = aqbooksellers.id WHERE aqorders.basketno=aqbasket.basketno AND budget_id=? AND @@ -90,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; @@ -102,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 988b8c28ee..b376973e8d 100755 --- a/acqui/spent.pl +++ b/acqui/spent.pl @@ -64,7 +64,8 @@ SELECT aqinvoices.invoicenumber, quantityreceived, unitprice, - datereceived + datereceived, + aqbooksellers.name as vendorname FROM (aqorders, aqbasket) LEFT JOIN biblio ON biblio.biblionumber=aqorders.biblionumber @@ -74,6 +75,8 @@ LEFT JOIN items ON aqorders_items.itemnumber = items.itemnumber LEFT JOIN aqinvoices ON aqorders.invoiceid = aqinvoices.invoiceid +LEFT JOIN aqbooksellers ON + aqbasket.booksellerid = aqbooksellers.id WHERE aqorders.basketno=aqbasket.basketno AND budget_id=? AND @@ -93,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; } @@ -112,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}; @@ -124,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 44f256a766..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 @@ -52,7 +53,7 @@ [% END %] - [% order.booksellerid | html %] + [% order.vendorname | html %] [% ItemTypes.GetDescription( order.itype ) | html %] @@ -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 d3cae4fb4a..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 @@ -50,7 +51,7 @@ [% order.ordernumber | html %] - [% order.booksellerid | html %] + [% order.vendorname | html %] [% order.invoicenumber | html %] @@ -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.11.0