This patch use the new module into pl and tt script.
Note that we could use it in the acqui/pdfformat/layout*.pm files.
Test plan:
1/ Verify that the acquisition home page displayes the prices as before.
2/ Verify that the budgets page displayes the prices as before.
3/ Verify that the funds page displayes the prices as before.
4/ Verify that the planning page displayes the prices as before. (Note
that 1 price is now formatted: 'Fund remaining').
5/ Create an order from a staged file. This stage file should contain a
formatted price.
Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
my $user = GetMember( 'borrowernumber' => $loggedinuser );
my $branchname = GetBranchName($user->{branchcode});
-
-my $num_formatter;
-
-my $cur_format = C4::Context->preference("CurrencyFormat");
-if ( $cur_format eq 'FR' ) {
- $num_formatter = Number::Format->new(
- 'decimal_fill' => '2',
- 'decimal_point' => ',',
- 'int_curr_symbol' => '',
- 'mon_thousands_sep' => ' ',
- 'thousands_sep' => ' ',
- 'mon_decimal_point' => ','
- );
-} else { # US by default..
- $num_formatter = Number::Format->new(
- 'int_curr_symbol' => '',
- 'mon_thousands_sep' => ',',
- 'mon_decimal_point' => '.'
- );
-}
-
my $status = $query->param('status') || "ASKED";
my $suggestions_count = CountSuggestion($status);
$totavail_active += $budget->{'budget_avail'};
}
- for my $field (qw( budget_amount budget_spent budget_ordered budget_avail ) ) {
- $budget->{"formatted_$field"} = $num_formatter->format_price( $budget->{$field} );
- }
-
push @budget_loop, $budget;
}
type => 'intranet',
loop_budget => \@budget_loop,
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 => $total,
+ totspent => $totspent,
+ totordered => $totordered,
+ totcomtd => $totcomtd,
+ totavail => $totavail,
+ total_active => $total_active,
+ totspent_active => $totspent_active,
+ totordered_active => $totordered_active,
+ totavail_active => $totavail_active,
suggestions_count => $suggestions_count,
);
# 3rd step = import the records
#
} elsif ( $op eq 'import_records' ) {
- my $num=FormatNumber();
#import selected lines
$template->param('basketno' => $cgiparams->{'basketno'});
# Budget_id is mandatory for adding an order, we just add a default, the user needs to modify this aftewards
# in France, the cents separator is the , but sometimes, ppl use a .
# in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation
$price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR";
- $price = $num->unformat_number($price);
+ $price = Koha::Number::Price->new($price)->unformat;
$orderinfo{gstrate} = $bookseller->{gstrate};
my $c = $c_discount ? $c_discount : $bookseller->{discount} / 100;
if ( $bookseller->{listincgst} ) {
);
+# This is used in incbudgets-active-currency.inc
my $cur = GetCurrency();
$template->param( symbol => $cur->{symbol},
currency => $cur->{currency}
);
-my $cur_format = C4::Context->preference("CurrencyFormat");
-my $num;
-
-if ( $cur_format eq 'US' ) {
- $num = new Number::Format(
- 'int_curr_symbol' => '',
- 'mon_thousands_sep' => ',',
- 'mon_decimal_point' => '.'
- );
-} elsif ( $cur_format eq 'FR' ) {
- $num = new Number::Format(
- 'decimal_fill' => '2',
- 'decimal_point' => ',',
- 'int_curr_symbol' => '',
- 'mon_thousands_sep' => ' ',
- 'thousands_sep' => ' ',
- 'mon_decimal_point' => ','
- );
-}
-
# ADD OR MODIFY A BUDGET PERIOD - BUILD SCREEN
if ( $op eq 'add_form' ) {
my $total = 0;
my $data = GetBudgetPeriod( $budget_period_id);
- $$data{'budget_period_total'}=$num->format_price( $data->{'budget_period_total'});
$template->param(
%$data
);
foreach my $result ( @{$results}[ $first .. $last ] ) {
my $budgetperiod = $result;
- $budgetperiod->{'budget_period_total'} = $num->format_price( $budgetperiod->{'budget_period_total'} );
$budgetperiod->{budget_active} = 1;
push( @period_active_loop, $budgetperiod );
}
my @period_inactive_loop;
foreach my $result ( @{$results}[ $first .. $last ] ) {
my $budgetperiod = $result;
- $budgetperiod->{'budget_period_total'} = $num->format_price( $budgetperiod->{'budget_period_total'} );
$budgetperiod->{budget_active} = 1;
push( @period_inactive_loop, $budgetperiod );
}
{
$op = 'list';
}
-my $num=FormatNumber;
# get only the columns of aqbudgets in budget_hash
my @columns = Koha::Database->new()->schema->source('Aqbudget')->columns;
budget_id => $budget->{'budget_id'},
budget_code => $budget->{'budget_code'},
budget_name => $budget->{'budget_name'},
- budget_amount => $num->format_price( $budget->{'budget_amount'} ),
+ budget_amount => $budget->{'budget_amount'},
);
# END $OP eq DELETE_CONFIRM
# called by delete_confirm, used to effectively confirm deletion of data in DB
if (!defined $budget->{'budget_unalloc_sublevel'}
or $budget->{'budget_unalloc_sublevel'} == 0);
- for (grep {/total_spent|budget_spent|total_ordered|budget_ordered|budget_amount/} keys %$budget){
- $budget->{$_} = $num->format_price( $budget->{$_} ) if defined($budget->{$_})
- }
- for (qw/budget_remaining total_remaining/) {
- if (defined $budget->{$_}) {
- $budget->{$_.'_display'} = $num->format_price($budget->{$_});
- }
- }
-
# Value of budget_spent equals 0 instead of undefined value
- $budget->{"budget_spent"} = $num->format_price(0) unless defined($budget->{"budget_spent"});
- $budget->{budget_ordered} = $num->format_price(0) unless defined($budget->{"budget_ordered"});
+ $budget->{budget_spent} = 0 unless defined($budget->{budget_spent});
+ $budget->{budget_ordered} = 0 unless defined($budget->{budget_ordered});
#Make a list of parents of the bugdet
my @budget_hierarchy;
my $budget_period_total = $period->{budget_period_total};
- foreach ($budget_period_total, $period_alloc_total, $spent_total, $ordered_total, $available_total) {
- $_ = $num->format_price($_);
- }
-
my $periods = GetBudgetPeriods();
$template->param(
my @hide_cols = $input->param('hide_cols');
-my $cur_format = C4::Context->preference("CurrencyFormat");
-my $num;
-
-if ( $cur_format eq 'FR' ) {
- $num = new Number::Format(
- 'decimal_fill' => '2',
- 'decimal_point' => ',',
- 'int_curr_symbol' => '',
- 'mon_thousands_sep' => ' ',
- 'thousands_sep' => ' ',
- 'mon_decimal_point' => ','
- );
-} else { # US by default..
- $num = new Number::Format(
- 'int_curr_symbol' => '',
- 'mon_thousands_sep' => ',',
- 'mon_decimal_point' => '.'
- );
-}
-
if ( $budget_period_locked == 1 && not defined $show_actual ) {
$show_actual = 1;
}
%budget_line = (
lines => \@cells_line,
budget_name_indent => $budget->{budget_name_indent},
- budget_amount_formatted => $num->format_price( $budget->{budget_amount} ),
budget_amount => $budget->{budget_amount},
budget_alloc => $budget->{budget_alloc},
budget_act_remain => sprintf( "%.2f", $budget_act_remain ),
show_actual => $show_actual,
show_percent => $show_percent,
show_mine => $show_mine,
- cur_format => $cur_format,
CGIextChoice => $CGIextChoice,
CGIsepChoice => $CGIsepChoice,
+[% USE Price %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Acquisitions</title>
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
<th class="b_inactive"> </th>
<th> </th>
<th> </th>
- <th class="data"><span class="bu_active">[% total %]</span><span class="bu_inactive" >[% total_active %]</span></th>
- <th class="data"><span class="bu_active">[% totordered %]</span><span class="bu_inactive" >[% totordered_active %]</span></th>
- <th class="data"><span class="bu_active">[% totspent %]</span><span class="bu_inactive" >[% totspent_active %]</span></th>
- <th class="data"><span class="bu_active">[% totavail %]</span><span class="bu_inactive" >[% totavail_active %]</span></th>
+ <th class="data"><span class="bu_active">[% total %]</span><span class="bu_inactive" >[% total_active | $Price %]</span></th>
+ <th class="data"><span class="bu_active">[% totordered %]</span><span class="bu_inactive" >[% totordered_active | $Price %]</span></th>
+ <th class="data"><span class="bu_active">[% totspent %]</span><span class="bu_inactive" >[% totspent_active | $Price %]</span></th>
+ <th class="data"><span class="bu_active">[% totavail %]</span><span class="bu_inactive" >[% totavail_active | $Price %]</span></th>
</tr>
</tfoot>
<tbody>
[% END %]
</td>
<td>[% loop_budge.budget_branchname %]</td>
- <td class="data"><span title="[% loop_budge.budget_amount %]">[% loop_budge.formatted_budget_amount %]</span></td>
- <td class="data"><span title="[% loop_budge.budget_ordered %]"><a href="ordered.pl?fund=[% loop_budge.budget_id %]&fund_code=[% loop_budge.budget_code %]">[% loop_budge.formatted_budget_ordered %]</a></span></td>
- <td class="data"><span title="[% loop_budge.budget_spent %]"><a href="spent.pl?fund=[% loop_budge.budget_id %]&fund_code=[% loop_budge.budget_code %]">[% loop_budge.formatted_budget_spent %]</span></a></td>
- <td class="data"><span title="[% loop_budge.budget_avail %]">[% loop_budge.formatted_budget_avail %]</td>
+ <td class="data"><span title="[% loop_budge.budget_amount %]">[% loop_budge.budget_amount | $Price %]</span></td>
+ <td class="data"><span title="[% loop_budge.budget_ordered %]"><a href="ordered.pl?fund=[% loop_budge.budget_id %]&fund_code=[% loop_budge.budget_code %]">[% loop_budge.budget_ordered | $Price %]</a></span></td>
+ <td class="data"><span title="[% loop_budge.budget_spent %]"><a href="spent.pl?fund=[% loop_budge.budget_id %]&fund_code=[% loop_budge.budget_code %]">[% loop_budge.budget_spent | $Price %]</span></a></td>
+ <td class="data"><span title="[% loop_budge.budget_avail %]">[% loop_budge.budget_avail | $Price %]</td>
</tr>
[% ELSE %]
<tr class="b_inactive">
[% END %]
</td>
<td>[% loop_budge.budget_branchname %]</td>
- <td class="data"><span title="[% loop_budge.budget_amount %]">[% loop_budge.formatted_budget_amount %]</span></td>
- <td class="data"><span title="[% loop_budge.budget_ordered %]"><a href="ordered.pl?fund=[% loop_budge.budget_id %]&fund_code=[% loop_budge.budget_code %]">[% loop_budge.formatted_budget_ordered %]</a></span></td>
- <td class="data"><span title="[% loop_budge.budget_spent %]"><a href="spent.pl?fund=[% loop_budge.budget_id %]&fund_code=[% loop_budge.budget_code %]">[% loop_budge.formatted_budget_spent %]</span></a></td>
- <td class="data"><span title="[% loop_budge.budget_avail %]">[% loop_budge.formatted_budget_avail %]</td>
+ <td class="data"><span title="[% loop_budge.budget_amount %]">[% loop_budge.budget_amount | $Price %]</span></td>
+ <td class="data"><span title="[% loop_budge.budget_ordered %]"><a href="ordered.pl?fund=[% loop_budge.budget_id %]&fund_code=[% loop_budge.budget_code %]">[% loop_budge.budget_ordered | $Price %]</a></span></td>
+ <td class="data"><span title="[% loop_budge.budget_spent %]"><a href="spent.pl?fund=[% loop_budge.budget_id %]&fund_code=[% loop_budge.budget_code %]">[% loop_budge.budget_spent | $Price %]</span></a></td>
+ <td class="data"><span title="[% loop_budge.budget_avail %]">[% loop_budge.budget_avail | $Price %]</td>
</tr>
[% END %]
[% END %]
[% USE KohaDates %]
[% USE format %]
+[% USE Price %]
+
[%- BLOCK action_menu %]
<div class="dropdown">
<a class="btn btn-mini dropdown-toggle" id="budgetmenu_[% block_budget_id %]" role="button" data-toggle="dropdown" href="#">
</ul>
</div>
[% END -%]
+
[% INCLUDE 'doc-head-open.inc' %]
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
[% INCLUDE 'doc-head-close.inc' %]
<span style="color:green;">Locked</span>
[% END %]
</td>
- <td class="data">[% period_active.budget_period_total %]</td>
+ <td class="data">[% period_active.budget_period_total | $Price %]</td>
<td>
[% PROCESS action_menu block_budget_id=period_active.budget_period_id %]
</td>
<td><span title="[% period_loo.budget_period_startdate %]">[% period_loo.budget_period_startdate | $KohaDates %]</span></td>
<td><span title="[% period_loo.budget_period_enddate %]">[% period_loo.budget_period_enddate | $KohaDates %]</span></td>
<td> [% IF ( period_loo.budget_period_locked ) %]<span style="color:green;">Locked</span> [% ELSE %][% END %] </td>
- <td class="data">[% period_loo.budget_period_total %]</td>
+ <td class="data">[% period_loo.budget_period_total | $Price %]</td>
<td>
[% PROCESS action_menu block_budget_id=period_loo.budget_period_id %]
</td>
+[% USE Price %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Administration › Funds[% IF op == 'add_form' %] › [% IF ( budget_id ) %]Modify fund[% IF ( budget_name ) %] '[% budget_name %]'[% END %][% ELSE %]Add fund [% END %][% END %]</title>
[% INCLUDE 'doc-head-close.inc' %]
<tr>
<th></th>
<th></th>
- <th colspan="2" style="text-align: left;" nowrap="nowrap">Period allocated [% IF ( budget_period_total ) %][% budget_period_total %][% END %] </th>
- <th nowrap="nowrap" class="data"> [% period_alloc_total %]</th>
+ <th colspan="2" style="text-align: left;" nowrap="nowrap">Period allocated [% IF budget_period_total %][% budget_period_total | $Price %][% END %] </th>
+ <th nowrap="nowrap" class="data"> [% period_alloc_total | $Price %]</th>
<th></th>
- <th class="data">[% ordered_total %]</th>
+ <th class="data">[% ordered_total | $Price %]</th>
<th></th>
- <th class="data">[% spent_total %]</th>
+ <th class="data">[% spent_total | $Price %]</th>
<th></th>
- <th class="data">[% available_total %]</th>
+ <th class="data">[% available_total | $Price %]</th>
<th></th>
</tr>
</tfoot>
<td>[% budget.budget_name %]</td>
<td class="data">
[% IF budget.budget_parent_id %]
- <span class="child_fund_amount">[% budget.budget_amount %]</span>
+ <span class="child_fund_amount">[% budget.budget_amount | $Price %]</span>
[% ELSE %]
- [% budget.budget_amount %]
+ [% budget.budget_amount | $Price %]
[% END %]
</td>
<td class="data">
[% IF budget.budget_parent_id %]
- <span class="child_fund_amount">[% budget.budget_ordered %]</span>
+ <span class="child_fund_amount">[% budget.budget_ordered | $Price %]</span>
[% ELSE %]
- [% budget.budget_ordered %]
+ [% budget.budget_ordered | $Price %]
[% END %]
</td>
<td class="data">
[% IF budget.budget_parent_id %]
- <span class="child_fund_amount">[% budget.total_ordered %]</span>
+ <span class="child_fund_amount">[% budget.total_ordered | $Price %]</span>
[% ELSE %]
- [% budget.total_ordered %]
+ [% budget.total_ordered | $Price %]
[% END %]
</td>
<td class="data">
[% IF budget.budget_parent_id %]
- <span class="child_fund_amount">[% budget.budget_spent %]</span>
+ <span class="child_fund_amount">[% budget.budget_spent | $Price %]</span>
[% ELSE %]
- [% budget.budget_spent %]
+ [% budget.budget_spent | $Price %]
[% END %]
</td>
<td class="data">
[% IF budget.budget_parent_id %]
- <span class="child_fund_amount">[% budget.total_spent %]</span>
+ <span class="child_fund_amount">[% budget.total_spent | $Price %]</span>
[% ELSE %]
- [% budget.total_spent %]
+ [% budget.total_spent | $Price %]
[% END %]
</td>
<span>
[% END %]
[% END %]
- [% text %]
+ [% value | $Price %]
</span>
[% END %]
<td class="data">
- [% INCLUDE colorcellvalue value=budget.budget_remaining text=budget.budget_remaining_display parent=budget.budget_parent_id %]
+ [% INCLUDE colorcellvalue value=budget.budget_remaining parent=budget.budget_parent_id %]
</td>
<td class="data">
- [% INCLUDE colorcellvalue value=budget.total_remaining text=budget.total_remaining_display parent=budget.budget_parent_id %]
+ [% INCLUDE colorcellvalue value=budget.total_remaining parent=budget.budget_parent_id %]
</td>
[% IF ( budget.budget_lock ) %]
<td> <span></span> </td>
<table>
<tr>
<th scope="row">Fund amount:</th>
- <td>[% budget_amount %]</td>
+ <td>[% budget_amount | $Price %]</td>
</tr>
</table>
+[% USE Price %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Administration › Budgets › Funds › Planning for [% budget_period_description %] by [% authcat %]</title>
[% INCLUDE 'doc-head-close.inc' %]
<td>
[% END %]
<a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&budget_id=[% budget_line.budget_id %]&budget_period_id=[% budget_line.budget_period_id %]">[% budget_line.budget_name_indent %]</a></td>
- <td><span id="budget_tot_formatted_[% budget_line.budget_id %]">[% budget_line.budget_amount_formatted %] </span>
+ <td><span id="[% budget_line.budget_amount %]">[% budget_line.budget_amount | $Price %] </span>
<!-- NEXT DIV ELEMENT IS USED BY JS FOR CALC-ING AUTO-FILL AND ESTIMATED AMOUNTS -->
[% ELSE %]
<td id="budget_est_[% budget_line.budget_id %]">
[% END %]
- [% budget_line.budget_est_remain %]
+ [% budget_line.budget_est_remain | $Price %]
</td>
</tr>
</table>