Skip to content
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

Conversion failure with auto-parameters in other locales #49

Closed
jenshp opened this issue Apr 22, 2016 · 3 comments
Closed

Conversion failure with auto-parameters in other locales #49

jenshp opened this issue Apr 22, 2016 · 3 comments

Comments

@jenshp
Copy link
Member

jenshp commented Apr 22, 2016

I am seeing following problem while using the spanish locale (relevant issue is that decimal separator is ',' and thousands separator is '.':
When invoking the service TaskServices.update#Task in mantle-usl, the auto-parameters for the in-parameters gets the decimal numbers wrong. These decimal numbers come directly from the Databse, so are not in the user's locale format. When checking the parameters (checkConvertType method of org.moqui.impl.service.ServiceDefinition), the line:
BigDecimal bdVal = eci.l10n.parseNumber((String) parameterValue, format)
assumes that the parameter is in the locale's format. But when the value comes directly from the DB because it is filled in because of the auto-parameters tag, a value like 1.5 is converted to 15 (eliminating what is considered a thousands separator according to the locale).

The solution would be to either:

  1. format the parameters coming from the DB into the current user's locale, or
  2. identifying when a parameter comes from the DB (it would have the entity-name and field-name attributes) and in that case use a standard parsing instead of going through the L10nFacadeImplementation.

I'm not sure which way would be more suitable.

@jenshp
Copy link
Member Author

jenshp commented Apr 22, 2016

A related issue is that apparently the number validation used does not take the locale into account. So, in HiveMind when I try to incorporate an hour formatted according to the curent locale (spanish) in hm/Task/EditTimeEntries, it gets rejected by the jquery validate plugin.
If I want to add an entry with 1,2 hours, I have to use 1.2 to get through the Javascript checking but then it would be recognized as 12 hours instead of 1.2 (due to the locale configuration).

jenshp added a commit to jenshp/mantle-usl that referenced this issue Apr 22, 2016
@jonesde
Copy link
Member

jonesde commented May 13, 2016

I apologize for now response on this yet, it is indeed an issue. The first priority would be a working round trip to/from the database. The JavaScript checking is another issue, there may be a locale option for jquery-validation library that needs to be set.

With other priorities I don't have time to look into this for the next couple weeks, but if you have any further input or a patch that solves either problem I'll review them.

@jonesde
Copy link
Member

jonesde commented Jan 17, 2018

Closing as part of general cleanup for the move to HiveMind and for no recent activity on this issue. If this comes up again or anyone wants to pursue it feel free to create a request on moqui.org. For more information see:

https://www.moqui.org/m/docs/moqui/Community+Guide

@jonesde jonesde closed this as completed Jan 17, 2018
acetousk pushed a commit that referenced this issue Jan 10, 2024
mrovnanik added a commit to rovnanik-sk/moqui-framework that referenced this issue May 27, 2024
Co-authored-by: Michal Rovnanik on WS <michal@rovnanik.sk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants