[
https://issues.apache.org/jira/browse/OFBIZ-3843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12891122#action_12891122
]
patrick LE BLAN commented on OFBIZ-3843:
----------------------------------------
I have tried the patch unsuccessful:
On FindServices.java could not find to make change but recompiled
application and restarted no change :
I recompiled trough command
java -jar ofbiz.jar -install -readers=seed,seed-initial
FindServices.java could not find to make change below text
-215,6 +219,7 @@
Set<String> processed = FastSet.newInstance();
Set<String> keys = FastSet.newInstance();
Map<String, ModelField> fieldMap = FastMap.newInstance();
+ Map<String, Object> convertValue = FastMap.newInstance();
for (ModelField modelField : fieldList) {
fieldMap.put(modelField.getName(), modelField);
}
@@ -253,6 +258,15 @@
if (parameters.containsKey(fieldName)) {
keys.add(fieldName);
}
+ if (UtilValidate.isNotEmpty(fieldValue) && useDateLocalized) {
+ try {
+ Timestamp toConvert = (Timestamp)
ObjectType.simpleTypeConvert(fieldValue, "Timestamp", (String)null, (Locale)
context.get("locale"));
+ fieldValue = toConvert.toString();
+ convertValue.put(fieldName.concat("_value"),
fieldValue);
+ } catch (GeneralException e) {
+ Debug.logError("Parse date " + fieldName + " with
value " + fieldValue + " failed", module);
+ }
+ }
fieldName = fieldName.substring(0, fieldName.length() - 5);
}
if (parameters.containsKey(fieldName)) {
@@ -271,7 +285,8 @@
}
result.add(createSingleCondition(modelField, operation,
fieldValue, ignoreCase, delegator, context));
for (String mapKey : keys) {
- queryStringMap.put(mapKey, parameters.get(mapKey));
+ if (convertValue.containsKey(mapKey))
queryStringMap.put(mapKey, convertValue.get(mapKey));
+ else queryStringMap.put(mapKey, parameters.get(mapKey));
}
}
return result;
@@ -292,6 +307,7 @@
EntityCondition cond = null;
String fieldName = modelField.getName();
EntityComparisonOperator<?, ?> fieldOp = null;
+ Locale locale = (Locale) context.get("locale");
if (operation != null) {
if (operation.equals("contains")) {
fieldOp = EntityOperator.LIKE;
@@ -311,13 +327,13 @@
fieldOp = EntityOperator.LESS_THAN;
} else if (operation.equals("greaterThanFromDayStart")) {
String timeStampString = (String) fieldValue;
- Object startValue =
modelField.getModelEntity().convertFieldValue(modelField,
dayStart(timeStampString, 0), delegator, context);
+ Object startValue =
modelField.getModelEntity().convertFieldValue(modelField,
dayStart(timeStampString, 0, locale), delegator, context);
return EntityCondition.makeCondition(fieldName,
EntityOperator.GREATER_THAN_EQUAL_TO, startValue);
} else if (operation.equals("sameDay")) {
String timeStampString = (String) fieldValue;
- Object startValue =
modelField.getModelEntity().convertFieldValue(modelField,
dayStart(timeStampString, 0), delegator, context);
+ Object startValue =
modelField.getModelEntity().convertFieldValue(modelField,
dayStart(timeStampString, 0, locale), delegator, context);
EntityCondition startCond =
EntityCondition.makeCondition(fieldName, EntityOperator.GREATER_THAN_EQUAL_TO,
startValue);
- Object endValue =
modelField.getModelEntity().convertFieldValue(modelField,
dayStart(timeStampString, 1), delegator, context);
+ Object endValue =
modelField.getModelEntity().convertFieldValue(modelField,
dayStart(timeStampString, 1, locale), delegator, context);
EntityCondition endCond =
EntityCondition.makeCondition(fieldName, EntityOperator.LESS_THAN, endValue);
return EntityCondition.makeCondition(startCond, endCond);
} else {
@@ -618,17 +634,17 @@
return results;
}
- private static String dayStart(String timeStampString, int daysLater) {
+ private static String dayStart(String timeStampString, int daysLater,
Locale locale) {
String retValue = null;
Timestamp ts = null;
Timestamp startTs = null;
try {
- ts = Timestamp.valueOf(timeStampString);
- } catch (IllegalArgumentException e) {
+ ts = (Timestamp) ObjectType.simpleTypeConvert(timeStampString,
"Timestamp", (String)null, locale);
+ } catch (GeneralException e) {
timeStampString += " 00:00:00.000";
try {
- ts = Timestamp.valueOf(timeStampString);
- } catch (IllegalArgumentException e2) {
+ ts = (Timestamp) ObjectType.simpleTypeConvert(timeStampString,
"Timestamp", (String)null, locale);
+ } catch (GeneralException e2) {
return retValue;
}
}
> Localized date format for end user
> ----------------------------------
>
> Key: OFBIZ-3843
> URL: https://issues.apache.org/jira/browse/OFBIZ-3843
> Project: OFBiz
> Issue Type: Improvement
> Components: framework
> Affects Versions: SVN trunk
> Reporter: Nicolas Malin
> Priority: Minor
> Attachments: date-localized.patch
>
>
> Many French end users don't want to use this date format : yyyy-mm-dd.
> To make a better user friendly OFBiz interface, I've added the possibility to
> configure in general.properties a localized date format. OFBiz use localized
> format (as dd/mm/yyyy) for all interactions with users but keep universal
> format for its framework. It's then possible to set date with unniversal or
> localized format.
> What's working :
> * Dates in screen engine : display, date-find, date-time
> * performFind
> * Service call
> Know problem :
> * I don't find how to configure js calendar to support this functionality
> It's possible that my solution isn't the best one to do that. But I'm open to
> all comment
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.