-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed dev/core#2505 fix formatting of numbers in civireport #20123
Conversation
(Standard links)
|
I think you would need to do something like call getDecimalPlacesForAmount() and pass that in as numberOfPlaces, or since formatLocaleNumeric is the function that wasn't used anywhere, change the default of 2 in formatLocaleNumeric to null and then have it call getDecimalPlacesForAmount when numberOfPlaces is null (similar to how formatLocaleNumericRoundedByOptionalPrecision does it). Something like that. |
I have updated the failing tests and added tests for checking with localized settings. |
jenkins issue is code formatting https://test.civicrm.org/job/CiviCRM-Core-PR/40501/checkstyleResult/new/ |
Fixed failing test Fixed issue with wrong parameters in comment section Improved settings of NumberFormatter removed unused function
I have squashed all commits into one. |
@eileenmcnaughton you had some initial concerns in the ticket - is this ok here? |
@jaapjansma @demeritcowboy my concern is that ig we pass the locale to the formatter we shouldn't be specifiying the separaotrs - that should be determined from the locale - but did you try without? |
Yes i try that out and the test also does not pass the locale. |
@eileenmcnaughton Yes without the symbol lines it uses the locale symbols, but then it would ignore your separators if you wanted something different than the locale, which seems like a possibility in some regions. But I'll leave that discussion to people who are in locales where it's mixed. |
And again I don´t know where as an site administrator I should set the locale. I do know where to set the decimal and thousand separators. |
OK - well this is well tested and I think it will avoid the double convert pitfall so I'm OK going with it |
@jaapjansma locale for these purposes gets set from "Default language" on the localization settings, which also seems a little bit wrong, so that's another reason it might not match the desired separators. |
Overview
Localize the display of custom fields of type number.
Before
When a report displayed a custom field of type number it wont localize the decimal separator.
After
Display of custom field of type number correctly shows the decimal separator. This is on the report screen as on other screens in CiviCRM.
Technical Details
CRM_Utils_Number::formatLocaleNumeric
is added (which is almost a copy fromCRM_Utils_Money::formatLocaleNumeric
but without the precision ($numberOfPlaces
) paramater.CRM_Core_BAO_CustomField::formatDisplayValue
the formatting of number fields is added.Comments
See https://lab.civicrm.org/dev/core/-/issues/2505