There are some places where the price format is defined.
All these occurrences should be removed use the way introduced by bug
12844.
Test plan:
1/ Verify you don't see any price formatting change on the basketgroup pdf
(for layout2pages, payout2pagesde, layout3pages and layout3pagesfr).
2/ On admin/aqbudgetperiods.pl, the budget total should be unchanged
too.
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>
use strict;
use warnings;
-use Number::Format;
use CGI;
use C4::Auth;
use Modern::Perl;
use CGI;
use Carp;
-use Number::Format qw(:all);
use YAML qw/Load/;
use C4::Context;
#you can use any PDF::API2 module, all you need to do is return the stringifyed pdf object from the printpdf sub.
package pdfformat::layout2pages;
use vars qw($VERSION @ISA @EXPORT);
-use Number::Format qw(format_price);
use MIME::Base64;
use strict;
use warnings;
use C4::Branch qw(GetBranchDetail);
+use Koha::Number::Price;
+
BEGIN {
use Exporter ();
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
my ($pdf, $basketgroup, $baskets, $orders) = @_;
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' => '.'
- );
- }
$pdf->mediabox($height/mm, $width/mm);
my $page = $pdf->page();
$basket->{basketno},
$titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote for vendor : " . $line->{order_vendornote} : '' ),
$line->{quantity},
- $num->format_price($line->{rrpgsti}),
- $num->format_price($line->{discount}).'%',
- $num->format_price($line->{gstrate} * 100).'%',
- $num->format_price($line->{totalgste}),
- $num->format_price($line->{totalgsti}),
+ Koha::Number::Price->new( $line->{rrpgsti} )->format,
+ Koha::Number::Price->new( $line->{discount} )->format . '%',
+ Koha::Number::Price->new( $line->{gstrate} * 100 )->format . '%',
+ Koha::Number::Price->new( $line->{totalgste} )->format,
+ Koha::Number::Price->new( $line->{totalgsti} )->format,
);
push(@$abaskets, $arrbasket);
}
#you can use any PDF::API2 module, all you need to do is return the stringifyed pdf object from the printpdf sub.
package pdfformat::layout2pagesde;
use vars qw($VERSION @ISA @EXPORT);
-use Number::Format qw(format_price);
use MIME::Base64;
use strict;
use warnings;
use C4::Branch qw(GetBranchDetail);
+use Koha::Number::Price;
+
BEGIN {
use Exporter ();
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
my ($pdf, $basketgroup, $baskets, $orders) = @_;
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' => '.'
- );
- }
$pdf->mediabox($height/mm, $width/mm);
my $page = $pdf->page();
$basket->{basketno},
$titleinfo. ($line->{order_vendornote} ? "\n----------------\nLieferantennotiz : ". $line->{order_vendornote} : '' ), $line->{quantity},
$line->{quantity},
- $num->format_price($line->{rrpgsti}),
- $num->format_price($line->{discount}).'%',
- $num->format_price($line->{gstrate} * 100).'%',
- $num->format_price($line->{totalgste}),
- $num->format_price($line->{totalgsti}),
+ Koha::Number::Price->new( $line->{rrpgsti} )->format,
+ Koha::Number::Price->new( $line->{discount} )->format . '%',
+ Koha::Number::Price->new( $line->{gstrate} * 100 )->format . '%',
+ Koha::Number::Price->new( $line->{totalgste} )->format,
+ Koha::Number::Price->new( $line->{totalgsti} )->format,
);
push(@$abaskets, $arrbasket);
}
#you can use any PDF::API2 module, all you need to do is return the stringifyed pdf object from the printpdf sub.
package pdfformat::layout3pages;
use vars qw($VERSION @ISA @EXPORT);
-use Number::Format qw(format_price);
use MIME::Base64;
use List::MoreUtils qw/uniq/;
use strict;
use C4::Branch qw(GetBranchDetail GetBranchName);
+use Koha::Number::Price;
+
BEGIN {
use Exporter ();
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
my ($pdf, $basketgroup, $baskets, $orders) = @_;
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' => '.'
- );
- }
$pdf->mediabox($height/mm, $width/mm);
my $number = 3;
push( @$arrbasket,
$titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote for vendor : " . $line->{order_vendornote} : '' ),
$line->{quantity},
- $num->format_price($line->{rrpgste}),
- $num->format_price($line->{rrpgsti}),
- $num->format_price($line->{discount}).'%',
- $num->format_price($line->{rrpgste} - $line->{ecostgste}),
- $num->format_price($line->{gstrate} * 100).'%',
- $num->format_price($line->{totalgste}),
- $num->format_price($line->{totalgsti}),
+ Koha::Number::Price->new( $line->{rrpgste} )->format,
+ Koha::Number::Price->new( $line->{rrpgsti} )->format,
+ Koha::Number::Price->new( $line->{discount} )->format . '%',
+ Koha::Number::Price->new( $line->{rrpgste} - $line->{ecostgste})->format,
+ Koha::Number::Price->new( $line->{gstrate} * 100 )->format . '%',
+ Koha::Number::Price->new( $line->{totalgste} )->format,
+ Koha::Number::Price->new( $line->{totalgsti} )->format,
);
push(@$abaskets, $arrbasket);
}
my $libraryname = C4::Context->preference("LibraryName");
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' => '.'
- );
- }
-
+
$pdf->mediabox($width/mm, $height/mm);
my $page = $pdf->openpage(2);
# create a text
push @gst, $ord->{gstrate};
}
@gst = uniq map { $_ * 100 } @gst;
- $totalgsti = $num->round($totalgsti);
- $totalgste = $num->round($totalgste);
$grandtotalrrpgste += $totalrrpgste;
$grandtotalrrpgsti += $totalrrpgsti;
$grandtotalgsti += $totalgsti;
$grandtotalgste += $totalgste;
$grandtotalgstvalue += $totalgstvalue;
$grandtotaldiscount += $totaldiscount;
- my @gst_string = map{$num->format_price( $_ ) . '%'} @gst;
+ my @gst_string =
+ map { Koha::Number::Price->new($_)->format . '%' } @gst;
push(@$arrbasket,
$basket->{contractname},
$basket->{basketname} . ' (No. ' . $basket->{basketno} . ')',
- $num->format_price($totalrrpgste),
- $num->format_price($totalrrpgsti),
+ Koha::Number::Price->new( $totalrrpgste )->format,
+ Koha::Number::Price->new( $totalrrpgsti )->format,
"@gst_string",
- $num->format_price($totalgstvalue),
- $num->format_price($totaldiscount),
- $num->format_price($totalgste),
- $num->format_price($totalgsti)
+ Koha::Number::Price->new( $totalgstvalue )->format,
+ Koha::Number::Price->new( $totaldiscount )->format,
+ Koha::Number::Price->new( $totalgste )->format,
+ Koha::Number::Price->new( $totalgsti )->format,
);
push(@$abaskets, $arrbasket);
}
# now, push total
undef $arrbasket;
- push @$arrbasket,'','Total', $num->format_price($grandtotalrrpgste), $num->format_price($grandtotalrrpgsti), '', $num->format_price($grandtotalgstvalue), $num->format_price($grandtotaldiscount), $num->format_price($grandtotalgste), $num->format_price($grandtotalgsti);
+ push @$arrbasket,
+ '',
+ 'Total',
+ Koha::Number::Price->new( $grandtotalrrpgste )->format,
+ Koha::Number::Price->new( $grandtotalrrpgsti )->format,
+ '',
+ Koha::Number::Price->new( $grandtotalgstvalue )->format,
+ Koha::Number::Price->new( $grandtotaldiscount )->format,
+ Koha::Number::Price->new( $grandtotalgste )->format,
+ Koha::Number::Price->new( $grandtotalgsti )->format;
push @$abaskets,$arrbasket;
# height is width and width is height in this function, as the pdf is in landscape mode for the Tables.
#you can use any PDF::API2 module, all you need to do is return the stringifyed pdf object from the printpdf sub.
package pdfformat::layout3pagesfr;
use vars qw($VERSION @ISA @EXPORT);
-use Number::Format qw(format_price);
use MIME::Base64;
use List::MoreUtils qw/uniq/;
use strict;
use C4::Branch qw(GetBranchDetail GetBranchName);
+use Koha::Number::Price;
+
BEGIN {
use Exporter ();
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
my ($pdf, $basketgroup, $baskets, $orders) = @_;
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' => '.'
- );
- }
$pdf->mediabox($height/mm, $width/mm);
my $number = 3;
push( @$arrbasket,
$titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote pour le fournisseur : ". $line->{order_vendornote} : '' ),
$line->{quantity},
- $num->format_price($line->{rrpgste}),
- $num->format_price($line->{rrpgsti}),
- $num->format_price($line->{discount}).'%',
- $num->format_price($line->{rrpgste} - $line->{ecostgste}),
- $num->format_price($line->{gstrate} * 100).'%',
- $num->format_price($line->{totalgste}),
- $num->format_price($line->{totalgsti}),
+ Koha::Number::Price->new( $line->{rrpgste}),
+ Koha::Number::Price->new( $line->{rrpgsti}),
+ Koha::Number::Price->new( $line->{discount}).'%',
+ Koha::Number::Price->new( $line->{rrpgste} - $line->{ecostgste}),
+ Koha::Number::Price->new( $line->{gstrate} * 100).'%',
+ Koha::Number::Price->new( $line->{totalgste}),
+ Koha::Number::Price->new( $line->{totalgsti}),
);
push(@$abaskets, $arrbasket);
}
my $libraryname = C4::Context->preference("LibraryName");
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' => '.'
- );
- }
$pdf->mediabox($width/mm, $height/mm);
my $page = $pdf->openpage(2);
push @gst, $ord->{gstrate};
}
@gst = uniq map { $_ * 100 } @gst;
- $totalgsti = $num->round($totalgsti);
- $totalgste = $num->round($totalgste);
$grandtotalrrpgste += $totalrrpgste;
$grandtotalrrpgsti += $totalrrpgsti;
$grandtotalgsti += $totalgsti;
$grandtotalgste += $totalgste;
$grandtotalgstvalue += $totalgstvalue;
$grandtotaldiscount += $totaldiscount;
- my @gst_string = map{$num->format_price( $_ ) . '%'} @gst;
+ my @gst_string =
+ map { Koha::Number::Price->new($_)->format . '%' } @gst;
push(@$arrbasket,
$basket->{contractname},
$basket->{basketname} . ' (No. ' . $basket->{basketno} . ')',
- $num->format_price($totalrrpgste),
- $num->format_price($totalrrpgsti),
+ Koha::Number::Price->new( $totalrrpgste )->format,
+ Koha::Number::Price->new( $totalrrpgsti )->format,
"@gst_string",
- $num->format_price($totalgstvalue),
- $num->format_price($totaldiscount),
- $num->format_price($totalgste),
- $num->format_price($totalgsti)
+ Koha::Number::Price->new( $totalgstvalue )->format,
+ Koha::Number::Price->new( $totaldiscount )->format,
+ Koha::Number::Price->new( $totalgste )->format,
+ Koha::Number::Price->new( $totalgsti )->format,
);
push(@$abaskets, $arrbasket);
}
# now, push total
undef $arrbasket;
- push @$arrbasket,'','Total', $num->format_price($grandtotalrrpgste), $num->format_price($grandtotalrrpgsti), '', $num->format_price($grandtotalgstvalue), $num->format_price($grandtotaldiscount), $num->format_price($grandtotalgste), $num->format_price($grandtotalgsti);
+ push @$arrbasket,
+ '',
+ 'Total',
+ Koha::Number::Price->new( $grandtotalrrpgste )->format,
+ Koha::Number::Price->new( $grandtotalrrpgsti )->format,
+ '',
+ Koha::Number::Price->new( $grandtotalgstvalue )->format,
+ Koha::Number::Price->new( $grandtotaldiscount )->format,
+ Koha::Number::Price->new( $grandtotalgste )->format,
+ Koha::Number::Price->new( $grandtotalgsti )->format;
push @$abaskets,$arrbasket;
# height is width and width is height in this function, as the pdf is in landscape mode for the Tables.
use Modern::Perl;
-use Number::Format qw(format_price);
use CGI;
use List::Util qw/min/;
use Koha::DateUtils;
use C4::Budgets;
use C4::Debug;
+use Koha::Number::Price;
+
my $dbh = C4::Context->dbh;
my $input = new CGI;
my $budgetperiod_hash=GetBudgetPeriod($budget_period_id);
# get dropboxes
- my $editnum = new Number::Format(
- 'int_curr_symbol' => '',
- 'thousands_sep' => '',
- 'mon_thousands_sep' => '',
- 'mon_decimal_point' => '.'
- );
-
- $$budgetperiod_hash{budget_period_total}= $editnum->format_price($$budgetperiod_hash{'budget_period_total'});
+ $budgetperiod_hash->{budget_period_total} =
+ Koha::Number::Price->new( $budgetperiod_hash->{budget_period_total} )
+ ->format;
$template->param(
%$budgetperiod_hash
);
use CGI;
use List::Util qw/min/;
-use Number::Format qw(format_price);
use Koha::Database;
use C4::Auth qw/get_user_subpermissions/;
use Date::Calc qw/Delta_YMD Easter_Sunday Today Decode_Date_EU/;
use Date::Manip qw/ ParseDate UnixDate DateCalc/;
use C4::Dates qw/format_date format_date_in_iso/;
-use Number::Format qw(format_price);
use Text::CSV_XS;
use C4::Acquisition;