From dba9090c2121cf48791d6b99dfefcee2ccc7cbe5 Mon Sep 17 00:00:00 2001 From: Jon Knight Date: Wed, 28 Mar 2018 09:41:16 +0000 Subject: [PATCH] Bug 19479: Display price in basket group formatted according to CurrencyFormat syspref using templates and currency symbols. On the page acqui/basketgroup.pl the prices of baskets should be shown formatted according to the selected CurrencyFormat syspref, using the currency symbol rather than three letter currency code. Test plan: 1) Create a basket with items in it worth more than 1000 currency units. 2) Close the basket. 3) Go to acqui/basketgroup.pl page and check that the price format matches the current CurrencyFormat syspref. 4) Go to Administration and change CurrencyFormat syspref to one of the other available options and recheck step 3. --- acqui/basketgroup.pl | 6 +++++- koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl index 8c0e4c4..1f195cb 100755 --- a/acqui/basketgroup.pl +++ b/acqui/basketgroup.pl @@ -82,7 +82,7 @@ sub BasketTotal { $total = $total + ( $order->{ecost_tax_excluded} * $order->{quantity} ); } } - $total .= " " . ($bookseller->invoiceprice // 0); +# $total .= " " . ($bookseller->invoiceprice // 0); return $total; } @@ -97,6 +97,8 @@ sub displaybasketgroups { my $basketsqty = 0; while($i < scalar(@$baskets)){ my $basket = @$baskets[$i]; + my $active_currency = Koha::Acquisition::Currencies->get_active; + $basket->{currency} = $active_currency->currency; if($basket->{'basketgroupid'} && $basket->{'basketgroupid'} == $basketgroup->{'id'}){ $basket->{total} = BasketTotal($basket->{basketno}, $bookseller); push(@{$basketgroup->{'baskets'}}, $basket); @@ -254,6 +256,8 @@ if ( $op eq "add" ) { my $selecteds = GetBasketsByBasketgroup($basketgroupid); foreach my $basket(@{$selecteds}){ $basket->{total} = BasketTotal($basket->{basketno}, $bookseller); + my $active_currency = Koha::Acquisition::Currencies->get_active; + $basket->{currency} = $active_currency->currency; } $template->param(basketgroupid => $basketgroupid, selectedbaskets => $selecteds); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt index df6f723..d7413ae 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt @@ -1,4 +1,5 @@ [% USE Branches %] +[% USE Price %] [% INCLUDE 'doc-head-open.inc' %] Koha › Basket grouping for [% booksellername |html %] @@ -173,7 +174,7 @@ function submitForm(form) { No name, basketnumber: [% basket.basketno %] [% END %] ,
- Total: [% basket.total %] + Total: [% basket.total | $Price with_symbol => 1 %] [% END %] @@ -259,7 +260,7 @@ function submitForm(form) { No name, basketnumber: [% selectedbasket.basketno %] [% END %] ,
- Total: [% selectedbasket.total %] + Total: [% selectedbasket.total | $Price %] ([% selectedbasket.currency %]) [% END %] -- 2.1.4