Skip to content

[72685] User can input anything in WP unit costs#22145

Open
HDinger wants to merge 1 commit intorelease/17.2from
bug/72685-user-can-input-anything-in-wp-unit-costs-1
Open

[72685] User can input anything in WP unit costs#22145
HDinger wants to merge 1 commit intorelease/17.2from
bug/72685-user-can-input-anything-in-wp-unit-costs-1

Conversation

@HDinger
Copy link
Contributor

@HDinger HDinger commented Mar 2, 2026

Ticket

https://community.openproject.org/wp/72685

What are you trying to accomplish?

Allow only numbers for logged units. This needed to be done with a regex because number fields are per definition not sensitive to locales resulting in wrong results with other locales then English.

@HDinger HDinger added this to the 17.2.x milestone Mar 2, 2026
@HDinger HDinger force-pushed the bug/72685-user-can-input-anything-in-wp-unit-costs-1 branch from ea9aaa9 to 821f52e Compare March 2, 2026 12:33
@HDinger HDinger force-pushed the bug/72685-user-can-input-anything-in-wp-unit-costs-1 branch from 821f52e to aa042c9 Compare March 3, 2026 10:02
Copy link
Member

@cbliard cbliard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works but I don't find the message pretty:

Image

And as the "Costs" amount is automatically updated each time the number of unit is changed, would it be possible to run the validation on every keystroke as well? (instead of having to click "Save" button to see it's wrong)

Also there is a regression: before it was possible to enter an amount with spaces in it (like "10 000"), but it does not work anymore. What feels wrong is that the calculated cost updates itself correctly, but it can't be saved:

Image

Also as my language is set to English, , is interpreted as the thousand separator, and . as the decimal separator.

Image Image

And when I switch to French (and probably other languages), it's reversed: . is the thousand separator and , is the decimal separator.

That contradicts a bit our hour input in time tracking where both , and . are always decimal separators.

Is it ok? (I suppose as it's already how it was behaving before. We probably already have a existing bug if that's a problem for users).

So there are 2 things to change, and 2 optional:

  • bad formatting of input validation message
    • could it validate the field each time it changes?
  • it should allow spaces in the number'
    • is it ok that . and , are treated differently depending on locale?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants