Lines 19-24
package Koha::Number::Price;
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
|
|
22 |
use Math::BigFloat; |
22 |
use Number::Format; |
23 |
use Number::Format; |
23 |
use C4::Context; |
24 |
use C4::Context; |
24 |
use Koha::Acquisition::Currencies; |
25 |
use Koha::Acquisition::Currencies; |
Lines 83-94
sub round {
Link Here
|
83 |
|
84 |
|
84 |
my $format_params = $self->_format_params; |
85 |
my $format_params = $self->_format_params; |
85 |
|
86 |
|
86 |
# To avoid the system to crash, we will not format big number |
87 |
return Number::Format->new(%$format_params)->round( Math::BigFloat->new( $self->value ) )->bdstr(); |
87 |
# We divide per 100 because we want to keep the default DECIMAL_DIGITS (2) |
|
|
88 |
# error - round() overflow. Try smaller precision or use Math::BigFloat |
89 |
return $self->value if $self->value > Number::Format::MAX_INT/100; |
90 |
|
91 |
return Number::Format->new(%$format_params)->round($self->value); |
92 |
} |
88 |
} |
93 |
|
89 |
|
94 |
sub _format_params { |
90 |
sub _format_params { |
95 |
- |
|
|