-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix(infocoms): number formatting incompatible with decimal_number option #21859
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
base: 10.0/bugfixes
Are you sure you want to change the base?
Conversation
trasher
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments.
Also, I guess it could be possible to add a test via phpunit to check if displayed value is the one expected.
Does the testFormatNumber function fulfill this requirement for testing the number displayed, or should additional tests be added? My changes only concern a modification of the Twig macro, because when a field was in the ‘any’ step, the display of the value was not managed by GLPI but by the client. |
Without your changes, the tests were already passing, so this does not prove that your fix actually resolves anything. You should add test cases that pass with your modification and fail without it to validate its effectiveness. |
|
👎 From me (obviously not a blocking review) I maintain the opinion I stated in other PRs that the raw value of an input should not be influenced/formatted by display preferences.
|
|
Make sure this doesn't cause issues that required the revert in #21123 |
|
On the support ticket is said we'll remove the use of the browser native number input; this is probably the best solution - changes currently done in this PR may just be reverted in that case. |
trasher
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments
cedric-anne
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that formating input value is not a good idea. The decimal_number option was initially designed to format values when display on reports, notifications, data tables, search results, ... but not in inputs that should never alter the current value, to be sure that an simple display/save operation will not result in changing the stored value.
Description
Screenshots (if appropriate):
decimal_number configuration

Before fix:

After fix:
