Thank you Adrian for the feedback.
I have spotted another bug that could be related to a missing conversion from
db to user's locale, this time related to number formatting.
My comment is at the bottom of https://issues.apache.org/jira/browse/OFBIZ-4769
and I have proposed a fix for it in the same ticket.
If you don't have time to review that ticket, could you please quickly review
the change I am proposing below? I am not sure if I am using the conversion
framework in the proper way.
Thanks,
Jacopo
Index: framework/widget/src/org/ofbiz/widget/WidgetWorker.java
===================================================================
--- framework/widget/src/org/ofbiz/widget/WidgetWorker.java (revision
1611246)
+++ framework/widget/src/org/ofbiz/widget/WidgetWorker.java (working copy)
@@ -27,6 +27,7 @@
import java.text.DateFormat;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
@@ -37,6 +38,8 @@
import javolution.util.FastList;
import javolution.util.FastMap;
+import org.ofbiz.base.conversion.ConversionException;
+import org.ofbiz.base.conversion.NumberConverters;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.StringUtil;
import org.ofbiz.base.util.UtilDateTime;
@@ -377,11 +380,19 @@
if (retVal != null) {
TimeZone timeZone = (TimeZone) context.get("timeZone");
if (timeZone == null) timeZone = TimeZone.getDefault();
+ Locale locale = (Locale) context.get("locale");
+ if (locale == null) locale = Locale.getDefault();
String returnValue = null;
// format string based on the user's time zone (not locale
because these are parameters)
- if (retVal instanceof Double || retVal instanceof Float ||
retVal instanceof BigDecimal) {
+ if (retVal instanceof Double || retVal instanceof Float) {
returnValue = retVal.toString();
+ } else if (retVal instanceof BigDecimal) {
+ try {
+ returnValue = new
NumberConverters.BigDecimalToString().convert((BigDecimal)retVal, locale,
timeZone);
+ } catch (ConversionException e) {
+ Debug.logError(e, module);
+ }
} else if (retVal instanceof java.sql.Date) {
DateFormat df =
UtilDateTime.toDateFormat(UtilDateTime.DATE_FORMAT, timeZone, null);
returnValue = df.format((java.util.Date) retVal);
On Jul 15, 2014, at 7:55 PM, Adrian Crum (JIRA) <[email protected]> wrote:
>
> [
> https://issues.apache.org/jira/browse/OFBIZ-5551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14062401#comment-14062401
> ]
>
> Adrian Crum commented on OFBIZ-5551:
> ------------------------------------
>
> I agree with Pierre - the value should be expired, not deleted.
>
> Aside from that, there might be a problem in the converter framework. The
> correct value SHOULD be sent to the service:
>
> DB Timestamp -> Converter -> String
> String -> Converter -> DB Timestamp
>
> The converters are supposed to be bidirectional:
>
> A -> B -> A
>
> should result in no change to A.
>
>
>> Cannot delete the record When Server Timezone and Application timeZone are
>> different.
>> -------------------------------------------------------------------------------------
>>
>> Key: OFBIZ-5551
>> URL: https://issues.apache.org/jira/browse/OFBIZ-5551
>> Project: OFBiz
>> Issue Type: Bug
>> Components: party
>> Affects Versions: Release Branch 13.07, Release Branch 12.04, Release
>> Branch 11.04, Trunk
>> Reporter: SenthilMurugan
>> Assignee: Adrian Crum
>> Labels: partymgr, service-engine, timezone
>> Original Estimate: 12h
>> Remaining Estimate: 12h
>>
>> I have added a role 'PROJECTADMIN' to admin when System timezone is in CST,
>> Then i changed the timezone to 'Hongkong' and tried to delete the recoed,
>> Nothing happens.
>
>
>
> --
> This message was sent by Atlassian JIRA
> (v6.2#6252)