From c44558540f47df0c4966a4903858a93656187413 Mon Sep 17 00:00:00 2001 From: Aleksa Vujicic Date: Mon, 16 Jan 2012 16:18:55 +1300 Subject: [PATCH] Bug 4078: Added sub in Budgets.pm that places the active currency symbol on an amount. Added this to most prices. --- C4/Budgets.pm | 24 ++++++++++++++++++++ acqui/acqui-home.pl | 22 ++++++++++------- acqui/basket.pl | 18 +++++++------- acqui/histsearch.pl | 6 ++++- acqui/parcel.pl | 17 +++++++------ admin/aqbudgetperiods.pl | 2 +- admin/aqbudgets.pl | 14 ++++++++++- admin/aqplan.pl | 6 ++-- admin/itemtypes.pl | 3 +- catalogue/moredetail.pl | 4 ++- cataloguing/additem.pl | 11 ++++++++- circ/billing.pl | 7 +++++- circ/circulation.pl | 7 ++++- circ/overdue.pl | 3 +- .../prog/en/modules/members/member.tt | 2 +- .../intranet-tmpl/prog/en/modules/members/pay.tt | 12 +++++----- .../prog/en/modules/members/paycollect.tt | 12 +++++----- members/boraccount.pl | 9 +++++-- members/member.pl | 4 +- members/moremember.pl | 9 ++++--- members/pay.pl | 13 ++++++++++ members/paycollect.pl | 9 ++++--- opac/opac-account.pl | 5 +++- opac/opac-user.pl | 3 +- 24 files changed, 154 insertions(+), 68 deletions(-) diff --git a/C4/Budgets.pm b/C4/Budgets.pm index 7c867e0..50982b5 100644 --- a/C4/Budgets.pm +++ b/C4/Budgets.pm @@ -54,6 +54,8 @@ BEGIN { &ModBudgetPlan + &PlaceCurrencySymbol + &GetCurrency &GetCurrencies &ModCurrencies @@ -651,6 +653,28 @@ sub GetBudgets { my ($filters,$orderby) = @_; return SearchInTable("aqbudgets",$filters, $orderby, undef,undef, undef, "wide"); } +# ------------------------------------------------------------------- + +=head2 PlaceCurrencySymbol + + &PlaceCurrencySymbol($amount); + +Places the active currency symbol on the amount. + +=cut + +sub PlaceCurrencySymbol { + my $amount = shift; + my $curr_symbol = GetCurrency()->{symbol}; + if ($curr_symbol && $amount) { + if ($amount =~ /^\-/) { + $amount =~ s/^\-/\-$curr_symbol/; + } else { + $amount = $curr_symbol.$amount; + } + } + return $amount; +} # ------------------------------------------------------------------- diff --git a/acqui/acqui-home.pl b/acqui/acqui-home.pl index 69482a8..0f143b5 100755 --- a/acqui/acqui-home.pl +++ b/acqui/acqui-home.pl @@ -136,21 +136,25 @@ foreach my $budget ( @{$budget_arr} ) { for my $field (qw( budget_amount budget_spent budget_ordered budget_avail ) ) { $budget->{$field} = $num_formatter->format_price( $budget->{$field} ); } + $budget->{'budget_amount'} = PlaceCurrencySymbol($budget->{'budget_amount'}); + $budget->{'budget_spent'} = PlaceCurrencySymbol($budget->{'budget_spent'}); + $budget->{'budget_ordered'} = PlaceCurrencySymbol($budget->{'budget_ordered'}); + $budget->{'budget_avail'} = PlaceCurrencySymbol($budget->{'budget_avail'}); } $template->param( type => 'intranet', loop_budget => $budget_arr, branchname => $branchname, - total => $num_formatter->format_price($total), - totspent => $num_formatter->format_price($totspent), - totordered => $num_formatter->format_price($totordered), - totcomtd => $num_formatter->format_price($totcomtd), - totavail => $num_formatter->format_price($totavail), - total_active => $num_formatter->format_price($total_active), - totspent_active => $num_formatter->format_price($totspent_active), - totordered_active => $num_formatter->format_price($totordered_active), - totavail_active => $num_formatter->format_price($totavail_active), + total => PlaceCurrencySymbol($num_formatter->format_price($total)), + totspent => PlaceCurrencySymbol($num_formatter->format_price($totspent)), + totordered => PlaceCurrencySymbol($num_formatter->format_price($totordered)), + totcomtd => PlaceCurrencySymbol($num_formatter->format_price($totcomtd)), + totavail => PlaceCurrencySymbol($num_formatter->format_price($totavail)), + total_active => PlaceCurrencySymbol($num_formatter->format_price($total_active)), + totspent_active => PlaceCurrencySymbol($num_formatter->format_price($totspent_active)), + totordered_active => PlaceCurrencySymbol($num_formatter->format_price($totordered_active)), + totavail_active => PlaceCurrencySymbol($num_formatter->format_price($totavail_active)), suggestions_count => $suggestions_count, ); diff --git a/acqui/basket.pl b/acqui/basket.pl index c528156..c526824 100755 --- a/acqui/basket.pl +++ b/acqui/basket.pl @@ -288,9 +288,9 @@ if ( $op eq 'delete_confirm' ) { $line{order_received} = ( $qty == $order->{'quantityreceived'} ); $line{basketno} = $basketno; $line{budget_name} = $budget->{budget_name}; - $line{rrp} = sprintf( "%.2f", $line{'rrp'} ); - $line{ecost} = sprintf( "%.2f", $line{'ecost'} ); - $line{line_total} = sprintf( "%.2f", $line_total ); + $line{rrp} = PlaceCurrencySymbol(sprintf( "%.2f", $line{'rrp'} )); + $line{ecost} = PlaceCurrencySymbol(sprintf( "%.2f", $line{'ecost'} )); + $line{line_total} = PlaceCurrencySymbol(sprintf( "%.2f", $line_total )); if ($line{uncertainprice}) { $template->param( uncertainprices => 1 ); $line{rrp} .= ' (Uncertain)'; @@ -366,12 +366,12 @@ my $total_est_gste; books_loop => \@books_loop, cancelledorders_loop => \@cancelledorders, gist_rate => sprintf( "%.2f", $gist * 100 ) . '%', - total_rrp_gste => sprintf( "%.2f", $total_rrp_gste ), - total_est_gste => sprintf( "%.2f", $total_est_gste ), - gist_est => sprintf( "%.2f", $gist_est ), - gist_rrp => sprintf( "%.2f", $gist_rrp ), - total_rrp_gsti => sprintf( "%.2f", $total_rrp_gsti ), - total_est_gsti => sprintf( "%.2f", $total_est_gsti ), + total_rrp_gste => PlaceCurrencySymbol(sprintf( "%.2f", $total_rrp_gste )), + total_est_gste => PlaceCurrencySymbol(sprintf( "%.2f", $total_est_gste )), + gist_est => PlaceCurrencySymbol(sprintf( "%.2f", $gist_est )), + gist_rrp => PlaceCurrencySymbol(sprintf( "%.2f", $gist_rrp )), + total_rrp_gsti => PlaceCurrencySymbol(sprintf( "%.2f", $total_rrp_gsti )), + total_est_gsti => PlaceCurrencySymbol(sprintf( "%.2f", $total_est_gsti )), # currency => $bookseller->{'listprice'}, currency => $cur->{'currency'}, qty_total => $qty_total, diff --git a/acqui/histsearch.pl b/acqui/histsearch.pl index ff68599..443db4d 100755 --- a/acqui/histsearch.pl +++ b/acqui/histsearch.pl @@ -57,6 +57,7 @@ use C4::Output; use C4::Acquisition; use C4::Dates; use C4::Debug; +use C4::Budgets qw(PlaceCurrencySymbol); my $input = new CGI; my $title = $input->param( 'title'); @@ -105,6 +106,9 @@ if ($do_search) { basket => $basket, booksellerinvoicenumber => $booksellerinvoicenumber, ); + foreach my $order (@$order_loop) { + $order->{ecost} = PlaceCurrencySymbol($order->{ecost}); + } } my $from_date = $from_placed_on ? $from_placed_on->output('syspref') : undef; @@ -114,7 +118,7 @@ $template->param( suggestions_loop => $order_loop, total_qty => $total_qty, total_qtyreceived => $total_qtyreceived, - total_price => sprintf( "%.2f", $total_price ), + total_price => PlaceCurrencySymbol(sprintf( "%.2f", $total_price )), numresults => $order_loop ? scalar(@$order_loop) : undef, title => $title, author => $author, diff --git a/acqui/parcel.pl b/acqui/parcel.pl index c256c60..31a8cf3 100755 --- a/acqui/parcel.pl +++ b/acqui/parcel.pl @@ -208,13 +208,14 @@ for (my $i = 0 ; $i < $countpendings ; $i++) { $totalPqtyrcvd +=$line{quantityreceived}; $totalPecost += $line{ecost}; $line{ecost} = sprintf("%.2f",$line{ecost}); - $line{ordertotal} = sprintf("%.2f",$line{ecost}*$line{quantity}); - $line{unitprice} = sprintf("%.2f",$line{unitprice}); + $line{ordertotal} = PlaceCurrencySymbol(sprintf("%.2f",$line{ecost}*$line{quantity})); + $line{unitprice} = PlaceCurrencySymbol(sprintf("%.2f",$line{unitprice})); $line{invoice} = $invoice; $line{gst} = $gst; $line{total} = $total; $line{supplierid} = $supplierid; $ordergrandtotal += $line{ecost} * $line{quantity}; + $line{ecost} = PlaceCurrencySymbol($line{ecost}); my $biblionumber = $line{'biblionumber'}; my $countbiblio = CountBiblioInOrders($biblionumber); @@ -299,17 +300,17 @@ $template->param( loop_received => \@loop_received, countpending => $countpendings, loop_orders => \@loop_orders, - totalprice => sprintf($cfstr, $totalprice), + totalprice => PlaceCurrencySymbol(sprintf($cfstr, $totalprice)), totalfreight => $totalfreight, totalquantity => $totalquantity, - tototal => sprintf($cfstr, $tototal), - ordergrandtotal => sprintf($cfstr, $ordergrandtotal), + tototal => PlaceCurrencySymbol(sprintf($cfstr, $tototal)), + ordergrandtotal => PlaceCurrencySymbol(sprintf($cfstr, $ordergrandtotal)), gst => $gst, - grandtot => sprintf($cfstr, $tototal + $gst), - totalPunitprice => sprintf("%.2f", $totalPunitprice), + grandtot => PlaceCurrencySymbol(sprintf($cfstr, $tototal + $gst)), + totalPunitprice => PlaceCurrencySymbol(sprintf("%.2f", $totalPunitprice)), totalPquantity => $totalPquantity, totalPqtyrcvd => $totalPqtyrcvd, - totalPecost => sprintf("%.2f", $totalPecost), + totalPecost => PlaceCurrencySymbol(sprintf("%.2f", $totalPecost)), resultsperpage => $resultsperpage, ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/admin/aqbudgetperiods.pl b/admin/aqbudgetperiods.pl index e74935e..315771f 100755 --- a/admin/aqbudgetperiods.pl +++ b/admin/aqbudgetperiods.pl @@ -184,7 +184,7 @@ elsif ( $op eq 'delete_confirmed' ) { foreach my $result ( @{$results}[ $first .. $last ] ) { my $budgetperiod = $result; FormatData($budgetperiod); - $budgetperiod->{'budget_period_total'} = $num->format_price( $budgetperiod->{'budget_period_total'} ); + $budgetperiod->{'budget_period_total'} = PlaceCurrencySymbol( $num->format_price($budgetperiod->{'budget_period_total'}) ); $budgetperiod->{budget_active} = 1; push( @period_loop, $budgetperiod ); } diff --git a/admin/aqbudgets.pl b/admin/aqbudgets.pl index db99759..10c7e51 100755 --- a/admin/aqbudgets.pl +++ b/admin/aqbudgets.pl @@ -239,6 +239,8 @@ if ($op eq 'add_form') { #This Looks WEIRD to me : should budgets be filtered in such a way ppl who donot own it would not see the amount spent on the budget by others ? + my $curr_symbol = C4::Budgets->GetCurrency()->{symbol}; + foreach my $budget (@budgets) { #Level and sublevels total spent $budget->{'total_levels_spent'} = GetChildBudgetsSpent($budget->{"budget_id"}); @@ -312,6 +314,10 @@ if ($op eq 'add_form') { } push @budget_hierarchy, { element_name => $period->{"budget_period_description"} }; @budget_hierarchy = reverse(@budget_hierarchy); + + foreach my $amount (\$budget->{'budget_amount_total'}, \$budget->{'budget_amount'}, \$budget->{'budget_spent'}, \$budget->{'total_levels_spent'}, \$budget->{'budget_remaining'}) { + $$amount = PlaceCurrencySymbol($$amount); + } push( @loop, { %{$budget}, branchname => $branches->{ $budget->{branchcode} }->{branchname}, @@ -325,12 +331,16 @@ if ($op eq 'add_form') { $budget_period_total = $num->format_price( $period->{budget_period_total} ); } + foreach my $amount (\$budget_period_total, \$period_alloc_total, \$base_spent_total) { + $$amount = $num->format_price($$amount); + $$amount = PlaceCurrencySymbol($$amount); + } $template->param( else => 1, budget => \@loop, budget_period_total => $budget_period_total, - period_alloc_total => $num->format_price($period_alloc_total), - base_spent_total => $num->format_price($base_spent_total), + period_alloc_total => $period_alloc_total, + base_spent_total => $base_spent_total, branchloop => \@branchloop2, ); diff --git a/admin/aqplan.pl b/admin/aqplan.pl index 9c75431..6b44e0a 100755 --- a/admin/aqplan.pl +++ b/admin/aqplan.pl @@ -412,11 +412,11 @@ foreach my $budget (@budgets) { %budget_line = ( lines => \@cells_line, budget_name_indent => $budget->{budget_name_indent}, - budget_amount_formatted => $num->format_price( $budget->{budget_amount} ), + budget_amount_formatted => PlaceCurrencySymbol($num->format_price( $budget->{budget_amount} )), budget_amount => $budget->{budget_amount}, budget_alloc => $budget->{budget_alloc}, - budget_act_remain => sprintf( "%.2f", $budget_act_remain ), - budget_est_remain => sprintf( "%.2f", $budget_est_remain ), + budget_act_remain => PlaceCurrencySymbol(sprintf( "%.2f", $budget_act_remain )), + budget_est_remain => PlaceCurrencySymbol(sprintf( "%.2f", $budget_est_remain )), budget_id => $budget->{budget_id}, budget_lock => $budget_lock, ); diff --git a/admin/itemtypes.pl b/admin/itemtypes.pl index 3219da3..07a5fe1 100755 --- a/admin/itemtypes.pl +++ b/admin/itemtypes.pl @@ -51,6 +51,7 @@ use C4::Koha; use C4::Context; use C4::Auth; use C4::Output; +use C4::Budgets qw(PlaceCurrencySymbol); sub StringSearch { my ( $searchstring, $type ) = @_; @@ -234,7 +235,7 @@ else { # DEFAULT my @loop; foreach my $itemtype ( @{$results} ) { $itemtype->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtype->{imageurl} ); - $itemtype->{rentalcharge} = sprintf( '%.2f', $itemtype->{rentalcharge} ); + $itemtype->{rentalcharge} = PlaceCurrencySymbol(sprintf( '%.2f', $itemtype->{rentalcharge} )); push( @loop, $itemtype ); } diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl index f5bb904..cfd08a1 100755 --- a/catalogue/moredetail.pl +++ b/catalogue/moredetail.pl @@ -35,6 +35,7 @@ use C4::Circulation; # to use itemissues use C4::Members; # to use GetMember use C4::Search; # enabled_staff_search_views use C4::Members qw/GetHideLostItemsPreference/; +use C4::Budgets qw(PlaceCurrencySymbol); my $query=new CGI; @@ -130,7 +131,7 @@ foreach my $item (@items){ $item->{itemdamagedloop}= GetAuthorisedValues(GetAuthValCode('items.damaged',$fw),$item->{damaged}) if GetAuthValCode('items.damaged',$fw); $item->{'collection'} = $ccodes->{ $item->{ccode} } if ($ccodes); $item->{'itype'} = $itemtypes->{ $item->{'itype'} }->{'description'}; - $item->{'replacementprice'} = sprintf( "%.2f", $item->{'replacementprice'} ); + $item->{'replacementprice'} = PlaceCurrencySymbol(sprintf( "%.2f", $item->{'replacementprice'} )); $item->{$_} = format_date( $item->{$_} ) foreach qw/datelastborrowed dateaccessioned datelastseen lastreneweddate/; $item->{'copyvol'} = $item->{'copynumber'}; @@ -184,6 +185,7 @@ $template->param( itemnumber => $itemnumber, z3950_search_params => C4::Search::z3950_search_args(GetBiblioData($biblionumber)), subtitle => $subtitle, + rentalcharge => PlaceCurrencySymbol(sprintf( "%.2f", %$template->{'VARS'}{rentalcharge})), ); $template->param(ONLY_ONE => 1) if ( $itemnumber && $showncount != @items ); diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 248c0de..0da35b1 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -31,6 +31,7 @@ use C4::Koha; # XXX subfield_is_koha_internal_p use C4::Branch; # XXX subfield_is_koha_internal_p use C4::ClassSource; use C4::Dates; +use C4::Budgets; use List::MoreUtils qw/any/; use MARC::File::XML; @@ -640,7 +641,15 @@ my @header_value_loop; for my $row ( @big_array ) { my %row_data; my @item_fields = map +{ field => $_ || '' }, @$row{ sort keys(%witness) }; - $row_data{item_value} = [ @item_fields ]; + + foreach my $item (@item_fields) { + $$item{field} = PlaceCurrencySymbol($$item{field}) if ($$item{field} =~ /^\d+\.\d\d$/); + } # Check for a 'price-like' field and add currency symbol + # OR + # Add currency directly to the field currently used for cost + # $item_fields[12]->{field} = PlaceCurrencySymbol($item_fields[12]->{field}); + + $row_data{item_value} = [ @item_fields ]; $row_data{itemnumber} = $row->{itemnumber}; #reporting this_row values $row_data{'nomod'} = $row->{'nomod'}; diff --git a/circ/billing.pl b/circ/billing.pl index 9c47b75..aaa50bf 100755 --- a/circ/billing.pl +++ b/circ/billing.pl @@ -26,6 +26,7 @@ use C4::Auth; use C4::Dates qw/format_date format_date_in_iso/; use C4::Debug; use Date::Calc qw/Today Add_Delta_YM/; +use C4::Budgets qw(PlaceCurrencySymbol); my $input = new CGI; my $order = $input->param('order') || ''; @@ -137,6 +138,10 @@ $sth->execute(@query_params); my @billingdata; while ( my $data = $sth->fetchrow_hashref ) { + my @amounts = split(/\/, $data->{l_amountoutstanding}); + $_ = PlaceCurrencySymbol($_) foreach @amounts; + $data->{l_amountoutstanding} = join('
',@amounts); + push @billingdata, { l_accountype => $data->{l_accounttype}, l_description => $data->{l_description}, @@ -147,7 +152,7 @@ while ( my $data = $sth->fetchrow_hashref ) { l_title => $data->{l_title}, cnt => $data->{cnt}, maxdate => $data->{maxdate}, - sum_amount => $data->{sum_amount}, + sum_amount => PlaceCurrencySymbol($data->{sum_amount}), borrowernumber => $data->{borrowernumber}, surname => $data->{surname}, firstname => $data->{firstname}, diff --git a/circ/circulation.pl b/circ/circulation.pl index 1b6c619..c6da05b 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -37,6 +37,7 @@ use C4::Reserves; use C4::Context; use CGI::Session; use C4::Members::Attributes qw(GetBorrowerAttributes); +use C4::Budgets qw(PlaceCurrencySymbol); use Date::Calc qw( Today @@ -457,6 +458,8 @@ sub build_issue_data { $it->{'od'} = ( $it->{'date_due'} lt $todaysdate ) ? 1 : 0 ; ($it->{'author'} eq '') and $it->{'author'} = ' '; $it->{'renew_failed'} = $renew_failed{$it->{'itemnumber'}}; + $it->{'replacementprice'} = PlaceCurrencySymbol($it->{'replacementprice'}); + $it->{'charge'} = PlaceCurrencySymbol($it->{'charge'}); if ( $todaysdate eq $it->{'issuedate'} or $todaysdate eq $it->{'lastreneweddate'} ) { (!$relatives) ? push @todaysissues, $it : push @relissues, $it; @@ -690,8 +693,8 @@ $template->param( duedatespec => $duedatespec, message => $message, CGIselectborrower => $CGIselectborrower, - totalprice => sprintf('%.2f', $totalprice), - totaldue => sprintf('%.2f', $total), + totalprice => PlaceCurrencySymbol(sprintf('%.2f', $totalprice)), + totaldue => PlaceCurrencySymbol(sprintf('%.2f', $total)), todayissues => \@todaysissues, previssues => \@previousissues, relissues => \@relissues, diff --git a/circ/overdue.pl b/circ/overdue.pl index a7207b7..ab7c623 100755 --- a/circ/overdue.pl +++ b/circ/overdue.pl @@ -30,6 +30,7 @@ use C4::Debug; use C4::Dates qw/format_date format_date_in_iso/; use Date::Calc qw/Today/; use Text::CSV_XS; +use C4::Budgets qw(PlaceCurrencySymbol); my $input = new CGI; my $order = $input->param('order') || ''; @@ -341,7 +342,7 @@ if ($noreport) { author => $data->{author}, branchcode => $data->{branchcode}, itemcallnumber => $data->{itemcallnumber}, - replacementprice => $data->{replacementprice}, + replacementprice => PlaceCurrencySymbol($data->{replacementprice}), patron_attr_value_loop => \@patron_attr_value_loop, }; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt index f625220..6719dfe 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt @@ -67,7 +67,7 @@ [% resultsloo.branchcode %] [% resultsloo.dateexpiry %] [% IF ( resultsloo.overdues ) %][% resultsloo.overdues %][% ELSE %][% resultsloo.overdues %][% END %]/[% resultsloo.issues %] - [% IF ( resultsloo.fines < 0 ) %][% resultsloo.fines %] [% ELSIF resultsloo.fines > 0 %] [% resultsloo.fines %] [% ELSE %] [% resultsloo.fines %] [% END %] + [% resultsfines = resultsloo.fines.match('(\d*\.\d\d)$') %][% IF ( resultsfines.0 < 0 ) %][% resultsloo.fines %] [% ELSIF resultsfines.0 > 0 %] [% resultsloo.fines %] [% ELSE %] [% resultsloo.fines %] [% END %] [% resultsloo.borrowernotes %] [% IF ( resultsloo.category_type ) %] Edit diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt index 6dfd8f9..12568e4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt @@ -45,7 +45,7 @@ [% FOREACH line IN account_grp.accountlines %] - [% IF ( line.amountoutstanding > 0 ) %] + [% IF ( line.amountoutstanding.remove('^[^0-9\.]*') > 0 ) %] [% END %] @@ -61,7 +61,7 @@ - [% IF ( line.amountoutstanding > 0 ) %] + [% IF ( line.amountoutstanding.remove('^[^0-9\.]*') > 0 ) %] [% END %] @@ -69,21 +69,21 @@ [% line.accounttype %] [% line.notify_id %] [% line.notify_level %] - [% line.amount | format('%.2f') %] - [% line.amountoutstanding | format('%.2f') %] + [% line.amount %] + [% line.amountoutstanding %] [% END %] [% IF ( account_grp.total ) %] Sub Total: - [% account_grp.total | format('%.2f') %] + [% account_grp.total %] [% END %] [% END %] Total Due: - [% total | format('%.2f') %] + [% total %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt index 08ee909..8d6779a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt @@ -118,12 +118,12 @@ function moneyFormat(textObj) { [% accounttype %] [% notify_id %] [% notify_level %] - [% amount | format('%.2f') %] - [% amountoutstanding | format('%.2f') %] + [% amount %] + [% amountoutstanding %] Total Amount Payable : - [% amountoutstanding | format('%.2f') %] + [% amountoutstanding %] @@ -170,8 +170,8 @@ function moneyFormat(textObj) { [% accounttype %] [% notify_id %] [% notify_level %] - [% amount | format('%.2f') %] - [% amountoutstanding | format('%.2f') %] + [% amount %] + [% amountoutstanding %] Writeoff This Charge? @@ -195,7 +195,7 @@ function moneyFormat(textObj) { - + diff --git a/members/boraccount.pl b/members/boraccount.pl index 2805f27..4fb41bc 100755 --- a/members/boraccount.pl +++ b/members/boraccount.pl @@ -33,6 +33,7 @@ use C4::Members; use C4::Branch; use C4::Accounts; use C4::Members::Attributes qw(GetBorrowerAttributes); +use C4::Budgets qw(PlaceCurrencySymbol); my $input=new CGI; @@ -82,8 +83,10 @@ foreach my $accountline ( @{$accts}) { } $accountline->{date} = format_date($accountline->{date}); - $accountline->{amount} = sprintf '%.2f', $accountline->{amount}; - $accountline->{amountoutstanding} = sprintf '%.2f', $accountline->{amountoutstanding}; + + $accountline->{amount} = PlaceCurrencySymbol(sprintf('%.2f', $accountline->{amount})); + $accountline->{amountoutstanding} = PlaceCurrencySymbol(sprintf('%.2f', $accountline->{amountoutstanding})); + if ($accountline->{accounttype} eq 'Pay') { $accountline->{payment} = 1; $reverse_col = 1; @@ -123,7 +126,7 @@ $template->param( email => $data->{'email'}, branchcode => $data->{'branchcode'}, branchname => GetBranchName($data->{'branchcode'}), - total => sprintf("%.2f",$total), + total => PlaceCurrencySymbol(sprintf("%.2f",$total)), totalcredit => $totalcredit, is_child => ($data->{'category_type'} eq 'C'), reverse_col => $reverse_col, diff --git a/members/member.pl b/members/member.pl index d759c31..cc7837e 100755 --- a/members/member.pl +++ b/members/member.pl @@ -32,6 +32,7 @@ use C4::Members; use C4::Branch; use C4::Category; use File::Basename; +use C4::Budgets qw(PlaceCurrencySymbol); my $input = new CGI; my $quicksearch = $input->param('quicksearch'); @@ -128,7 +129,6 @@ foreach my $borrower(@$results[$from..$to-1]){ my ($od,$issue,$fines)=GetMemberIssuesAndFines($$borrower{'borrowernumber'}); $$borrower{'dateexpiry'}= C4::Dates->new($$borrower{'dateexpiry'},'iso')->output('syspref'); - my %row = ( count => $index++, %$borrower, @@ -136,7 +136,7 @@ foreach my $borrower(@$results[$from..$to-1]){ overdues => $od, issues => $issue, odissue => "$od/$issue", - fines => sprintf("%.2f",$fines), + fines => PlaceCurrencySymbol(sprintf("%.2f",$fines)), ); push(@resultsdata, \%row); } diff --git a/members/moremember.pl b/members/moremember.pl index 6e5407c..1cfd5d5 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -54,6 +54,7 @@ use C4::Form::MessagingPreferences; use C4::NewsChannels; #get slip news use List::MoreUtils qw/uniq/; use C4::Members::Attributes qw(GetBorrowerAttributes); +use C4::Budgets qw(PlaceCurrencySymbol); #use Smart::Comments; #use Data::Dumper; @@ -275,7 +276,7 @@ sub build_issue_data { $issue->[$i]{'issuingbranchname'} = GetBranchName($issue->[$i]{'branchcode'}); my %row = %{ $issue->[$i] }; $totalprice += $issue->[$i]{'replacementprice'}; - $row{'replacementprice'} = $issue->[$i]{'replacementprice'}; + $row{'replacementprice'} = PlaceCurrencySymbol($issue->[$i]{'replacementprice'}); # item lost, damaged loops if ($row{'itemlost'}) { my $fw = GetFrameworkCode($issue->[$i]{'biblionumber'}); @@ -316,7 +317,7 @@ sub build_issue_data { $row{'itemtype_description'} = $itemtypeinfo->{description}; $row{'itemtype_image'} = $itemtypeinfo->{imageurl}; - $row{'charge'} = sprintf( "%.2f", $charge ); + $row{'charge'} = PlaceCurrencySymbol(sprintf( "%.2f", $charge )); my ( $renewokay,$renewerror ) = CanBookBeRenewed( $issue->[$i]{'borrowernumber'}, $issue->[$i]{'itemnumber'}, $override_limit ); $row{'norenew'} = !$renewokay; @@ -464,8 +465,8 @@ $template->param( reregistration => $reregistration, branch => $branch, todaysdate => C4::Dates->today(), - totalprice => sprintf("%.2f", $totalprice), - totaldue => sprintf("%.2f", $total), + totalprice => PlaceCurrencySymbol(sprintf("%.2f", $totalprice)), + totaldue => PlaceCurrencySymbol(sprintf("%.2f", $total)), totaldue_raw => $total, issueloop => @issuedata, relissueloop => @relissuedata, diff --git a/members/pay.pl b/members/pay.pl index 6bc18fc..90831db 100755 --- a/members/pay.pl +++ b/members/pay.pl @@ -40,6 +40,7 @@ use C4::Koha; use C4::Overdues; use C4::Branch; use C4::Members::Attributes qw(GetBorrowerAttributes); +use C4::Budgets qw(PlaceCurrencySymbol); my $input = CGI->new; @@ -133,8 +134,17 @@ sub add_accounts_to_template { for my $notify_id (@notify) { my ( $acct_total, $accountlines, undef ) = GetBorNotifyAcctRecord( $borrowernumber, $notify_id ); + + foreach my $accountline (@$accountlines) { + $accountline->{amount} = PlaceCurrencySymbol(sprintf( "%.2f",$accountline->{amount})); + $accountline->{amountoutstanding} = PlaceCurrencySymbol(sprintf( "%.2f",$accountline->{amountoutstanding})); + } + if ( @{$accountlines} ) { + my $totalnotify = AmountNotify( $notify_id, $borrowernumber ); + $totalnotify = PlaceCurrencySymbol(sprintf( "%.2f",$totalnotify)); + push @{$accounts}, { accountlines => $accountlines, notify => $notify_id, @@ -142,6 +152,9 @@ sub add_accounts_to_template { }; } } + + $total = PlaceCurrencySymbol(sprintf( "%.2f",$total)); + borrower_add_additional_fields($borrower); $template->param( accounts => $accounts, diff --git a/members/paycollect.pl b/members/paycollect.pl index cbddc05..e9d01f5 100755 --- a/members/paycollect.pl +++ b/members/paycollect.pl @@ -27,6 +27,7 @@ use C4::Members; use C4::Accounts; use C4::Koha; use C4::Branch; +use C4::Budgets qw(PlaceCurrencySymbol); my $input = CGI->new(); @@ -75,8 +76,8 @@ if ( $individual || $writeoff ) { $template->param( accounttype => $accounttype, accountno => $accountno, - amount => $amount, - amountoutstanding => $amountoutstanding, + amount => PlaceCurrencySymbol(sprintf( "%.2f",$amount)), + amountoutstanding => PlaceCurrencySymbol(sprintf( "%.2f",$amountoutstanding)), title => $title, description => $description, notify_id => $notify_id, @@ -86,7 +87,7 @@ if ( $individual || $writeoff ) { $total_due = $input->param('amt'); $template->param( selected_accts => $select_lines, - amt => $total_due + amt => PlaceCurrencySymbol($total_due) ); } @@ -137,7 +138,7 @@ $template->param( #borrowenumber => $borrower->{borrowernumber}, # some templates require global borrowenumber => $borrowernumber, # some templates require global borrower => $borrower, - total => $total_due + total => PlaceCurrencySymbol(sprintf( "%.2f",$total_due)), ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/opac/opac-account.pl b/opac/opac-account.pl index 22d83b8..1e61972 100755 --- a/opac/opac-account.pl +++ b/opac/opac-account.pl @@ -25,6 +25,7 @@ use C4::Circulation; use C4::Auth; use C4::Output; use C4::Dates qw/format_date/; +use C4::Budgets qw(PlaceCurrencySymbol); use warnings; my $query = new CGI; @@ -60,6 +61,8 @@ for ( my $i = 0 ; $i < $numaccts ; $i++ ) { if ( $accts->[$i]{'amountoutstanding'} >= 0 ) { $accts->[$i]{'amountoutstandingcredit'} = 1; } + $accts->[$i]{'amountoutstanding'} = PlaceCurrencySymbol($accts->[$i]{'amountoutstanding'}); + $accts->[$i]{'amount'} = PlaceCurrencySymbol($accts->[$i]{'amount'}); } # add the row parity @@ -72,7 +75,7 @@ foreach my $row (@$accts) { $template->param ( ACCOUNT_LINES => $accts, - total => sprintf( "%.2f", $total ), + total => PlaceCurrencySymbol(sprintf( "%.2f", $total )), accountview => 1 ); diff --git a/opac/opac-user.pl b/opac/opac-user.pl index f6ed484..4a47d7c 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -36,6 +36,7 @@ use C4::Items; use C4::Dates qw/format_date/; use C4::Letters; use C4::Branch; # GetBranches +use C4::Budgets qw(PlaceCurrencySymbol); use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE'; @@ -115,7 +116,7 @@ if ( $borr->{'amountoutstanding'} < 0 ) { $borr->{'amountoutstanding'} = -1 * ( $borr->{'amountoutstanding'} ); } -$borr->{'amountoutstanding'} = sprintf "%.02f", $borr->{'amountoutstanding'}; +$borr->{'amountoutstanding'} = PlaceCurrencySymbol(sprintf "%.02f", $borr->{'amountoutstanding'}); my @bordat; $bordat[0] = $borr; -- 1.7.5.4
Total Amount Outstanding : [% total | format('%.2f') %][% total %]