Bug 22115 - Table of checkouts doesn't respect CurrencyFormat setting
Summary: Table of checkouts doesn't respect CurrencyFormat setting
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: master
Hardware: All All
: P5 - low minor (vote)
Assignee: Katrin Fischer
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 22112
  Show dependency treegraph
 
Reported: 2019-01-12 07:50 UTC by Katrin Fischer
Modified: 2023-12-28 20:42 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00


Attachments
Bug 22115: Format prices in table of checkouts according to CurrencyFormat setting (3.67 KB, patch)
2022-09-20 21:23 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 22115: Format prices in table of checkouts according to CurrencyFormat setting (3.72 KB, patch)
2022-09-20 22:45 UTC, David Nind
Details | Diff | Splinter Review
Bug 22115: Format prices in table of checkouts according to CurrencyFormat setting (3.77 KB, patch)
2022-10-03 11:39 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 22115: (QA follow-up) prevent wrap on price columns (1.84 KB, patch)
2022-10-03 11:39 UTC, Nick Clemens
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2019-01-12 07:50:16 UTC
The table of checkouts on the checkouts and details tabs in the patron account can display the columns Charge, Price and Fine. Those columns are not formatted according to the CurrencyFormat systme preference.

I don't know how to fix this. It appears the formatting is currently done in checkouts.js using toFixed(2):

Example:
                    "mDataProp": function ( oObj ) {
                        if ( ! oObj.charge ) oObj.charge = 0;
                        return '<span style="text-align: right; display: block;">' + parseFloat(oObj.charge).toFixed(2) + '<span>';
                    }
Comment 1 Owen Leonard 2021-10-07 16:29:31 UTC
Would it make sense to format the price in svc/checkouts?

e.g.

charge => Koha::Number::Price->new( $charge )->format_for_editing,

Not sure if that is correct, copied from Price.pm.
Comment 2 Jonathan Druart 2021-10-08 12:54:43 UTC
Ideally we need a JS function that copies what format_for_editing does.
Comment 3 Jonathan Druart 2022-02-11 12:28:13 UTC
We already have
koha-tmpl/intranet-tmpl/prog/en/includes/format_price.inc:    Number.prototype.format_price = function( value, params ) {
Comment 4 Katrin Fischer 2022-09-20 21:23:53 UTC
Created attachment 140807 [details] [review]
Bug 22115: Format prices in table of checkouts according to CurrencyFormat setting

In the patron account in the staff interface, all amounts in the
checkouts table should be formatted according to the CurrencyFormat
system preference setting.

To test:
* Edit some items, setting the replacement cost
* Make sure one of the item type is set to charge a rental charge
* Check out items
* Verify the checkouts table displays on both checkouts and details
  tabs correctly
* Try different settings of CurrencyFormat and verify all amounts
  display correctly
Comment 5 David Nind 2022-09-20 22:45:51 UTC
Created attachment 140811 [details] [review]
Bug 22115: Format prices in table of checkouts according to CurrencyFormat setting

In the patron account in the staff interface, all amounts in the
checkouts table should be formatted according to the CurrencyFormat
system preference setting.

To test:
* Edit some items, setting the replacement cost
* Make sure one of the item type is set to charge a rental charge
* Check out items
* Verify the checkouts table displays on both checkouts and details
  tabs correctly
* Try different settings of CurrencyFormat and verify all amounts
  display correctly

Signed-off-by: David Nind <david@davidnind.com>
Comment 6 David Nind 2022-09-20 22:49:30 UTC
The only edge case I noticed was if the charge or replacement price is 1,000.00 or greater and the currency is FR, then because of the space instead of the , it appears in the columns for check out and details tabs as:
     1
000,00
Comment 7 Nick Clemens 2022-10-03 11:39:33 UTC
Created attachment 141256 [details] [review]
Bug 22115: Format prices in table of checkouts according to CurrencyFormat setting

In the patron account in the staff interface, all amounts in the
checkouts table should be formatted according to the CurrencyFormat
system preference setting.

To test:
* Edit some items, setting the replacement cost
* Make sure one of the item type is set to charge a rental charge
* Check out items
* Verify the checkouts table displays on both checkouts and details
  tabs correctly
* Try different settings of CurrencyFormat and verify all amounts
  display correctly

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 8 Nick Clemens 2022-10-03 11:39:37 UTC
Created attachment 141257 [details] [review]
Bug 22115: (QA follow-up) prevent wrap on price columns

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 9 Tomás Cohen Arazi 2022-10-03 15:41:38 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 10 Lucas Gass 2022-12-05 15:58:19 UTC
Doesn't apply cleanly to 22.05.x, no backport