Bug 18900: wrong number format in receiving order
commit92b08a23e3b2c001d208b82b6ffee2af756ca51f
authorFridolin Somers <fridolin.somers@biblibre.com>
Thu, 6 Jul 2017 06:48:18 +0000 (6 08:48 +0200)
committerFridolin Somers <fridolin.somers@biblibre.com>
Tue, 12 Sep 2017 14:02:07 +0000 (12 16:02 +0200)
tree5a4fa00c686aa9300f7611802bbe43121f720ea7
parent1865db52bbf9413574c22ee2c9180137ac357918
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 e35903574ce666bca32eb4676f311b99bb268ec2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Koha/Number/Price.pm