Bug 18900: wrong number format in receiving order

Bug 18471 added number formating in order receive.

I found a bug generated by this.
Koha::Number::Price defines methods to (un)format price depending on CurrencyFormat syspref.
The bug is that for CurrencyFormat US, some params are not defined in this module so there are retrieved from system locale. If system locale is not en_US, the params will be wrong. For example fr_FR will define ',' as decimal and so saved unit price is divided by 1000.

To recreate:
- On a server with locale 'fr_FR'
- With Plack mode
- Set CurrencyFormat on 'US'
- Open a basket
- Place an order for an item
- Close basket
- Receive order with changing 'Actual Cost' to '1,234'
- Note the 'Actual Cost' is now '1.23'
- Run unit test t/Number/Price.t without and with patch

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e35903574c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 92b08a23e3)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
This commit is contained in:
Fridolin Somers 2017-07-06 08:48:18 +02:00 committed by Katrin Fischer
parent 85a57d0f94
commit a374afe92d
1 changed files with 3 additions and 0 deletions

View File

@ -87,8 +87,11 @@ sub _format_params {
my $int_curr_symbol = q||;
my %format_params = (
decimal_fill => '2',
decimal_point => '.',
int_curr_symbol => $int_curr_symbol,
mon_thousands_sep => ',',
thousands_sep => ',',
mon_decimal_point => '.'
);