moqui / moqui-framework

Use Moqui Framework to build enterprise applications based on Java. It includes tools for databases (relational, graph, document), local and web services, web and other UI with screens and forms, security, file/resource access, scripts, templates, l10n, caching, logging, search, rules, workflow, multi-instance, and integration.
http://www.moqui.org
Other
284 stars 204 forks source link

Conversion failure with auto-parameters in other locales #49

Closed jenshp closed 6 years ago

jenshp commented 8 years ago

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 commented 8 years ago

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).

jonesde commented 8 years ago

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 commented 6 years ago

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