Bug 30567

Summary: Create manual invoice with FR currency format show the incorrect format
Product: Koha Reporter: The Minh Luong <the-minh.luong>
Component: Fines and feesAssignee: Katrin Fischer <katrin.fischer>
Status: CLOSED FIXED QA Contact: Jonathan Druart <jonathan.druart>
Severity: normal    
Priority: P5 - low CC: arthur.suzuki, caroline.cyr-la-rose, david, jonathan.druart, lucas, philippe.blouin, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This fixes the price formatting when CurrencyFormat = FR. When adding a manual invoice, the amount input field was shown with a comma for debit types with default amounts, but it should be a decimal point. (For input fields we always use the decimal point and the display format uses the decimal separator defined by CurrencyFormat.)
Version(s) released in:
22.11.00, 22.05.04, 21.11.11, 21.05.18
Circulation function:
Attachments: Bug 30567: Create manual invoice with FR currency format show the correct format
Bug 30567: Fix price formatting when adding a manual invoice with CurrencyFormat FR
Bug 30567: Fix price formatting when adding a manual invoice with CurrencyFormat FR
Bug 30567: Fix price formatting when adding a manual invoice with CurrencyFormat FR

Description The Minh Luong 2022-04-19 18:23:16 UTC
When creating a manual invoice with  CurrencyFormat = FR , it shows the incorrect format.

To test:
1- Go in Administration->Debit types
2- Click on New debit type
3- Fill the form:
   Code: USEDBOOK
   Default amount: 0.50
   Description: Used book
   Can be manually invoiced: Yes
   Can be sold: Optionnal
4- Save
5- Go in Patrons
6- Go in a patron's page
7- Go in the "Accounting" section
8- Click on "Create manual invoice"
9- Fill the form 
10- Choose the created debit (Used book)
11- Notice that the format is incorrect (0,50 instead of 0.50)
Comment 1 The Minh Luong 2022-04-19 18:30:55 UTC
Created attachment 133413 [details] [review]
Bug 30567: Create manual invoice with FR currency format show the correct format

This patch correct the format of the price when creating a manual invoice with CurrencyFormat = FR

To test:
1- Go in Administration->Debit types
2- Click on New debit type
3- Fill the form:
   Code: USEDBOOK
   Default amount: 0.50
   Description: Used book
   Can be manually invoiced: Yes
   Can be sold: Optionnal
4- Save
5- Go in Patrons
6- Go in a patron's page
7- Go in the "Accounting" section
8- Click on "Create manual invoice"
9- Fill the form
10- Choose the created debit (Used book)
11- Notice that the format is incorrect (0,50 instead of 0.50)
12 - Apply the patch
13- We now see the correct format
Comment 2 Katrin Fischer 2022-06-06 21:25:52 UTC
I can confirm the bug and the patch fixes it, but I am worried about side effects of this change to Price.pm. Are we sure it has no undesired effects in other places?

We'll also need unit tests for this to PQA.
Comment 3 Katrin Fischer 2022-06-06 21:29:50 UTC
Ok, with the patch the display format also changes to . instead of , - so this is not what we want. 

You can see this for example under administration > debit types.

The rule is that input fields should always have ., but the display format depends on CurrencyFormat.
Comment 4 Katrin Fischer 2022-06-06 21:38:43 UTC
Created attachment 135737 [details] [review]
Bug 30567: Fix price formatting when adding a manual invoice with CurrencyFormat FR

In input fields we always use the decimal . while the display format
uses the decimal separtor definded by CurrencyFormat. When adding a
manual invoice without this patch, the amount is shown with comma, but
it should be . in the input field.

To test:
1- Go in Administration->Debit types
2- Click on New debit type
3- Fill the form:
   Code: USEDBOOK
   Default amount: 0.50
   Description: Used book
   Can be manually invoiced: Yes
4- Save
5- Go to any patron account
6- Go to the "Accounting" tab
7- Click on "Create manual invoice"
8- Fill the form
9- Choose the created debit (Used book)
10- Verify that the format is incorrect (0,50 instead of 0.50)
11- Apply the patch
12- Verify the amount is now using the correct format
Comment 5 Katrin Fischer 2022-06-06 21:40:08 UTC
I hope it's ok - I had an idea what could be wrong here and have written up an alternate patch. I'd really like to see this fixed :)
Comment 6 David Nind 2022-06-19 22:00:28 UTC
Created attachment 136335 [details] [review]
Bug 30567: Fix price formatting when adding a manual invoice with CurrencyFormat FR

In input fields we always use the decimal . while the display format
uses the decimal separtor definded by CurrencyFormat. When adding a
manual invoice without this patch, the amount is shown with comma, but
it should be . in the input field.

To test:
1- Go in Administration->Debit types
2- Click on New debit type
3- Fill the form:
   Code: USEDBOOK
   Default amount: 0.50
   Description: Used book
   Can be manually invoiced: Yes
4- Save
5- Go to any patron account
6- Go to the "Accounting" tab
7- Click on "Create manual invoice"
8- Fill the form
9- Choose the created debit (Used book)
10- Verify that the format is incorrect (0,50 instead of 0.50)
11- Apply the patch
12- Verify the amount is now using the correct format

Signed-off-by: David Nind <david@davidnind.com>
Comment 7 Jonathan Druart 2022-07-04 13:00:26 UTC
Created attachment 137059 [details] [review]
Bug 30567: Fix price formatting when adding a manual invoice with CurrencyFormat FR

In input fields we always use the decimal . while the display format
uses the decimal separtor definded by CurrencyFormat. When adding a
manual invoice without this patch, the amount is shown with comma, but
it should be . in the input field.

To test:
1- Go in Administration->Debit types
2- Click on New debit type
3- Fill the form:
   Code: USEDBOOK
   Default amount: 0.50
   Description: Used book
   Can be manually invoiced: Yes
4- Save
5- Go to any patron account
6- Go to the "Accounting" tab
7- Click on "Create manual invoice"
8- Fill the form
9- Choose the created debit (Used book)
10- Verify that the format is incorrect (0,50 instead of 0.50)
11- Apply the patch
12- Verify the amount is now using the correct format

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 8 Tomás Cohen Arazi (tcohen) 2022-07-05 12:59:24 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 9 Lucas Gass (lukeg) 2022-08-09 22:28:48 UTC
Backported to 22.05.x for 22.05.04
Comment 10 Arthur Suzuki 2022-08-12 08:00:34 UTC
pushed to 21.11.x for 21.11.11
Comment 11 Victor Grousset/tuxayo 2022-08-17 22:41:39 UTC
Not backported to oldoldstable (21.05.x). Feel free to ask if it's needed.

Nothing to document, marking resolved.
Comment 12 Katrin Fischer 2022-08-18 07:19:39 UTC
If it applies, please backport. It's a TT filter change, but if the bug is in the version it's a bigger issue for users.
Comment 13 Caroline Cyr La Rose 2022-08-18 13:35:29 UTC
I confirm we found this bug in 21.05
Comment 14 Victor Grousset/tuxayo 2022-08-20 20:36:42 UTC
Backported: Pushed to 21.05.x branch for 21.05.18