Bug 13352: On editing, prices should not be formatted
authorJonathan Druart <jonathan.druart@biblibre.com>
Mon, 26 Jan 2015 09:28:27 +0000 (10:28 +0100)
committerChris Cormack <chrisc@catalyst.net.nz>
Thu, 12 Feb 2015 21:58:08 +0000 (10:58 +1300)
commitabc46657e5039ba9d40637624390c0a28a664c8e
treee25dfcbbb38eae1e747b5ce4c38bf1eaa1fc694d
parent6e01fc7a5da9df8f645481048e023b46e378de3b
Bug 13352: On editing, prices should not be formatted

Bug 12979 refactored the way to display prices.
The price format configuration was duplicated everywhere it was used.

All calls looks good except the one in admin/aqbudgetperiods.pl
In this one, the prices are formatted for an edition field (input).
This means the input is incorrectly filled even if the user does not
update the field.

At the end, maybe should we manage formatted prices everywhere, even in
inputs, but it's not in the scope of this bug.

Technically, a new subroutine format_for_editing is added to the
Koha::Number::Price module.
It should be called everywhere a price is displayed in an input field.
At the moment, it only does a sprintf("%.2f"), but it is a first step to
let the number of decimals to display configurable.

To test:
1/ Verify the issue described is fixed (editing a budget with a total
amount > 1000 (With CurrencyFormat is US or FR).
2/ Verify you can edit a fund with a total amount > 1000

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>
(cherry picked from commit 945a0f09e73606907d6df72b873e478cc6763c14)
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Conflicts:
admin/aqbudgetperiods.pl
t/Prices.t
Koha/Number/Price.pm
Koha/Template/Plugin/Price.pm
admin/aqbudgetperiods.pl
admin/aqbudgets.pl
koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt
koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt
t/Prices.t [new file with mode: 0644]