You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2011/06/24 19:46:46 UTC

svn commit: r1139388 - in /ofbiz/branches/release11.04: ./ applications/order/script/org/ofbiz/order/customer/ applications/party/webapp/partymgr/WEB-INF/actions/party/ applications/product/script/org/ofbiz/product/test/ framework/common/widget/ framew...

Author: jleroux
Date: Fri Jun 24 17:46:45 2011
New Revision: 1139388

URL: http://svn.apache.org/viewvc?rev=1139388&view=rev
Log:
"Applied fix from trunk for revision: 1139385" 
------------------------------------------------------------------------
r1139385 | jleroux | 2011-06-24 19:33:25 +0200 (ven., 24 juin 2011) | 17 lines

A patch from Nicolas Malin <<Display dateTime field with input method time-dropdown not use context value to display hour and minutes>> https://issues.apache.org/jira/browse/OFBIZ-4319

If you define a dateTime field like that :

<field name="estimatedStartDate"><date-time input-method="time-dropdown" step="10"/></field>
and pass in context : estimatedStartDate = "2011-06-016 20:30:00"
when you edit the form, estimatedStartDate takes the good value 2011-06-016 on date, but takes nowTimestamps.hour for dropdown hour instead of 20 and nowTimestamps.minutes for dropdown minutes instead of 30

To test the patch :

    go to ofbiz example component with given date : "https://localhost:8443/example/control/FormWidgetExamples?field4=2001-01-01 02:21:000"
    the field 4 must have hour to 02 and minutes to 21

The patch also corrects multiple definition : sr.append("\" value=\"");
and removes unneeded escape at end line : if (UtilValidate.isEmpty(requiredStyle)) requiredStyle = "required";


------------------------------------------------------------------------


Modified:
    ofbiz/branches/release11.04/   (props changed)
    ofbiz/branches/release11.04/applications/order/script/org/ofbiz/order/customer/CheckoutMapProcs.xml   (props changed)
    ofbiz/branches/release11.04/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy   (props changed)
    ofbiz/branches/release11.04/applications/product/script/org/ofbiz/product/test/InventoryTests.xml   (props changed)
    ofbiz/branches/release11.04/framework/common/widget/HelpScreens.xml   (props changed)
    ofbiz/branches/release11.04/framework/security/data/PasswordSecurityData.xml   (props changed)
    ofbiz/branches/release11.04/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
    ofbiz/branches/release11.04/specialpurpose/ebaystore/lib/   (props changed)
    ofbiz/branches/release11.04/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/Facilities.groovy   (props changed)
    ofbiz/branches/release11.04/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductList.groovy   (props changed)
    ofbiz/branches/release11.04/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductStockTake.groovy   (props changed)

Propchange: ofbiz/branches/release11.04/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 24 17:46:45 2011
@@ -2,4 +2,4 @@
 /ofbiz/branches/dojo1.4:951708-952957
 /ofbiz/branches/jquery:952958-1044489
 /ofbiz/branches/multitenant20100310:921280-927264
-/ofbiz/trunk:1100197,1100880,1104423,1131144,1131396,1132496,1132749,1133353,1134990,1135199,1135686,1135929,1137201,1137433,1137435,1138463,1138485
+/ofbiz/trunk:1100197,1100880,1104423,1131144,1131396,1132496,1132749,1133353,1134990,1135199,1135686,1135929,1137201,1137433,1137435,1138463,1138485,1139385

Propchange: ofbiz/branches/release11.04/applications/order/script/org/ofbiz/order/customer/CheckoutMapProcs.xml
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 24 17:46:45 2011
@@ -2,4 +2,4 @@
 /ofbiz/branches/dojo1.4/applications/order/script/org/ofbiz/order/customer/CheckoutMapProcs.xml:951708-952957
 /ofbiz/branches/jquery/applications/order/script/org/ofbiz/order/customer/CheckoutMapProcs.xml:952958-1044489
 /ofbiz/branches/multitenant20100310/applications/order/script/org/ofbiz/order/customer/CheckoutMapProcs.xml:921280-927264
-/ofbiz/trunk/applications/order/script/org/ofbiz/order/customer/CheckoutMapProcs.xml:1100197,1100880,1104423,1131144,1131396,1132496,1132749,1134990,1135199,1135686,1135929,1137201,1137433,1137435,1138463,1138485
+/ofbiz/trunk/applications/order/script/org/ofbiz/order/customer/CheckoutMapProcs.xml:1100197,1100880,1104423,1131144,1131396,1132496,1132749,1134990,1135199,1135686,1135929,1137201,1137433,1137435,1138463,1138485,1139385

Propchange: ofbiz/branches/release11.04/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 24 17:46:45 2011
@@ -2,4 +2,4 @@
 /ofbiz/branches/dojo1.4/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy:951708-952957
 /ofbiz/branches/jquery/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy:952958-1044489
 /ofbiz/branches/multitenant20100310/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy:921280-927264
-/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy:1100197,1100880,1104423,1131144,1131396,1132496,1132749,1134990,1135199,1135686,1135929,1137201,1137433,1137435,1138463,1138485
+/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy:1100197,1100880,1104423,1131144,1131396,1132496,1132749,1134990,1135199,1135686,1135929,1137201,1137433,1137435,1138463,1138485,1139385

Propchange: ofbiz/branches/release11.04/applications/product/script/org/ofbiz/product/test/InventoryTests.xml
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 24 17:46:45 2011
@@ -2,4 +2,4 @@
 /ofbiz/branches/dojo1.4/applications/product/script/org/ofbiz/product/test/InventoryTests.xml:951708-952957
 /ofbiz/branches/jquery/applications/product/script/org/ofbiz/product/test/InventoryTests.xml:952958-1044489
 /ofbiz/branches/multitenant20100310/applications/product/script/org/ofbiz/product/test/InventoryTests.xml:921280-927264
-/ofbiz/trunk/applications/product/script/org/ofbiz/product/test/InventoryTests.xml:1100197,1100880,1104423,1131144,1131396,1132496,1132749,1134990,1135199,1135686,1135929,1137201,1137433,1137435,1138463,1138485
+/ofbiz/trunk/applications/product/script/org/ofbiz/product/test/InventoryTests.xml:1100197,1100880,1104423,1131144,1131396,1132496,1132749,1134990,1135199,1135686,1135929,1137201,1137433,1137435,1138463,1138485,1139385

Propchange: ofbiz/branches/release11.04/framework/common/widget/HelpScreens.xml
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 24 17:46:45 2011
@@ -2,4 +2,4 @@
 /ofbiz/branches/dojo1.4/framework/common/widget/HelpScreens.xml:951708-952957
 /ofbiz/branches/jquery/framework/common/widget/HelpScreens.xml:952958-1044489
 /ofbiz/branches/multitenant20100310/framework/common/widget/HelpScreens.xml:921280-927264
-/ofbiz/trunk/framework/common/widget/HelpScreens.xml:1100197,1100880,1104423,1131144,1131396,1132496,1132749,1134990,1135199,1135686,1135929,1137201,1137433,1137435,1138463,1138485
+/ofbiz/trunk/framework/common/widget/HelpScreens.xml:1100197,1100880,1104423,1131144,1131396,1132496,1132749,1134990,1135199,1135686,1135929,1137201,1137433,1137435,1138463,1138485,1139385

Propchange: ofbiz/branches/release11.04/framework/security/data/PasswordSecurityData.xml
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 24 17:46:45 2011
@@ -2,4 +2,4 @@
 /ofbiz/branches/dojo1.4/applications/securityext/data/PasswordSecurityData.xml:951708-952957
 /ofbiz/branches/jquery/applications/securityext/data/PasswordSecurityData.xml:952958-1044489
 /ofbiz/branches/multitenant20100310/applications/securityext/data/PasswordSecurityData.xml:921280-927264
-/ofbiz/trunk/framework/security/data/PasswordSecurityData.xml:1100197,1100880,1104423,1131144,1131396,1132496,1132749,1134990,1135199,1135686,1135929,1137201,1137433,1137435,1138463,1138485
+/ofbiz/trunk/framework/security/data/PasswordSecurityData.xml:1100197,1100880,1104423,1131144,1131396,1132496,1132749,1134990,1135199,1135686,1135929,1137201,1137433,1137435,1138463,1138485,1139385

Modified: ofbiz/branches/release11.04/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release11.04/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=1139388&r1=1139387&r2=1139388&view=diff
==============================================================================
--- ofbiz/branches/release11.04/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original)
+++ ofbiz/branches/release11.04/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Fri Jun 24 17:46:45 2011
@@ -507,10 +507,11 @@ public class MacroFormRenderer implement
                 alert = "true";
             }
         }
+        boolean useTimeDropDown = "time-dropdown".equals(dateTimeField.getInputMethod());
         String stepString = dateTimeField.getStep();
         int step = 1;
         StringBuilder timeValues = new StringBuilder();
-        if ( "time-dropdown".equals(dateTimeField.getInputMethod()) && UtilValidate.isNotEmpty(step)) {
+        if (useTimeDropDown && UtilValidate.isNotEmpty(step)) {
             try {
                 step = Integer.valueOf(stepString).intValue();
             } catch (IllegalArgumentException e) {
@@ -534,9 +535,9 @@ public class MacroFormRenderer implement
         String localizedInputTitle = "", localizedIconTitle = "";
 
         // whether the date field is short form, yyyy-mm-dd
-        boolean shortDateInput = ("date".equals(dateTimeField.getType()) || "time-dropdown".equals(dateTimeField.getInputMethod()) ? true : false);
+        boolean shortDateInput = ("date".equals(dateTimeField.getType()) || useTimeDropDown ? true : false);
 
-        if ("time-dropdown".equals(dateTimeField.getInputMethod())) {
+        if (useTimeDropDown) {
             name = UtilHttp.makeCompositeParam(paramName, "date");
         } else {
             name = paramName;
@@ -562,7 +563,14 @@ public class MacroFormRenderer implement
             }
         }
 
-        String value = modelFormField.getEntry(context, dateTimeField.getDefaultValue(context));
+        String contextValue = null;
+        //if time-dropdow desactive encodingOutput for found hour and minutes
+        boolean memEncodeOutput = modelFormField.getEncodeOutput();
+        if (useTimeDropDown) modelFormField.setEncodeOutput(false);
+        contextValue = modelFormField.getEntry(context, dateTimeField.getDefaultValue(context));
+        if (useTimeDropDown) modelFormField.setEncodeOutput(memEncodeOutput);
+
+        String value = contextValue;
         if (UtilValidate.isNotEmpty(value)) {
             if (value.length() > maxlength) {
                 value = value.substring(0, maxlength);
@@ -586,7 +594,7 @@ public class MacroFormRenderer implement
 
         if (!"time".equals(dateTimeField.getType())) {
             String tempParamName;
-            if ("time-dropdown".equals(dateTimeField.getInputMethod())) {
+            if (useTimeDropDown) {
                 tempParamName = UtilHttp.makeCompositeParam(paramName, "date");
             } else {
                 tempParamName = paramName;
@@ -597,7 +605,7 @@ public class MacroFormRenderer implement
 
         // if we have an input method of time-dropdown, then render two
         // dropdowns
-        if ("time-dropdown".equals(dateTimeField.getInputMethod())) {
+        if (useTimeDropDown) {
             className = modelFormField.getWidgetStyle();
             classString = (className != null ? className : "");
             isTwelveHour = "12".equals(dateTimeField.getClock());
@@ -605,7 +613,7 @@ public class MacroFormRenderer implement
             // set the Calendar to the default time of the form or now()
             Calendar cal = null;
             try {
-                Timestamp defaultTimestamp = Timestamp.valueOf(dateTimeField.getDefaultDateTimeString(context));
+                Timestamp defaultTimestamp = Timestamp.valueOf(contextValue);
                 cal = Calendar.getInstance();
                 cal.setTime(defaultTimestamp);
             } catch (IllegalArgumentException e) {
@@ -639,7 +647,7 @@ public class MacroFormRenderer implement
         //check for required field style on single forms
         if ("single".equals(modelFormField.getModelForm().getType()) && modelFormField.getRequiredField()) {
             String requiredStyle = modelFormField.getRequiredFieldStyle();
-            if (UtilValidate.isEmpty(requiredStyle)) requiredStyle = "required";            
+            if (UtilValidate.isEmpty(requiredStyle)) requiredStyle = "required";
             if (UtilValidate.isEmpty(className)) className = requiredStyle;
             else className = requiredStyle + " " + className;
         }
@@ -666,14 +674,10 @@ public class MacroFormRenderer implement
         sr.append(value);
         sr.append("\" title=\"");
         sr.append(localizedInputTitle);
-        sr.append("\" value=\"");
-        sr.append(value);
         sr.append("\" size=\"");
         sr.append(Integer.toString(size));
         sr.append("\" maxlength=\"");
         sr.append(Integer.toString(maxlength));
-        sr.append("\" value=\"");
-        sr.append(value);
         sr.append("\" step=\"");
         sr.append(Integer.toString(step));
         sr.append("\" timeValues=\"");

Propchange: ofbiz/branches/release11.04/specialpurpose/ebaystore/lib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 24 17:46:45 2011
@@ -2,4 +2,4 @@
 /ofbiz/branches/dojo1.4/specialpurpose/ebaystore/lib:951708-952957
 /ofbiz/branches/jquery/specialpurpose/ebaystore/lib:952958-1044489
 /ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/lib:921280-927264
-/ofbiz/trunk/specialpurpose/ebaystore/lib:1100197,1100880,1104423,1131144,1131396,1132496,1132749,1134990,1135199,1135686,1135929,1137201,1137433,1137435,1138463,1138485
+/ofbiz/trunk/specialpurpose/ebaystore/lib:1100197,1100880,1104423,1131144,1131396,1132496,1132749,1134990,1135199,1135686,1135929,1137201,1137433,1137435,1138463,1138485,1139385

Propchange: ofbiz/branches/release11.04/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/Facilities.groovy
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 24 17:46:45 2011
@@ -2,4 +2,4 @@
 /ofbiz/branches/dojo1.4/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/Facilities.groovy:951708-952957
 /ofbiz/branches/jquery/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/Facilities.groovy:952958-1044489
 /ofbiz/branches/multitenant20100310/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/Facilities.groovy:921280-927264
-/ofbiz/trunk/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/Facilities.groovy:1100197,1100880,1104423,1131144,1131396,1132496,1132749,1134990,1135199,1135686,1135929,1137201,1137433,1137435,1138463,1138485
+/ofbiz/trunk/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/Facilities.groovy:1100197,1100880,1104423,1131144,1131396,1132496,1132749,1134990,1135199,1135686,1135929,1137201,1137433,1137435,1138463,1138485,1139385

Propchange: ofbiz/branches/release11.04/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductList.groovy
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 24 17:46:45 2011
@@ -2,4 +2,4 @@
 /ofbiz/branches/dojo1.4/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductList.groovy:951708-952957
 /ofbiz/branches/jquery/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductList.groovy:952958-1044489
 /ofbiz/branches/multitenant20100310/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductList.groovy:921280-927264
-/ofbiz/trunk/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductList.groovy:1100197,1100880,1104423,1131144,1131396,1132496,1132749,1134990,1135199,1135686,1135929,1137201,1137433,1137435,1138463,1138485
+/ofbiz/trunk/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductList.groovy:1100197,1100880,1104423,1131144,1131396,1132496,1132749,1134990,1135199,1135686,1135929,1137201,1137433,1137435,1138463,1138485,1139385

Propchange: ofbiz/branches/release11.04/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductStockTake.groovy
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 24 17:46:45 2011
@@ -2,4 +2,4 @@
 /ofbiz/branches/dojo1.4/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductStockTake.groovy:951708-952957
 /ofbiz/branches/jquery/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductStockTake.groovy:952958-1044489
 /ofbiz/branches/multitenant20100310/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductStockTake.groovy:921280-927264
-/ofbiz/trunk/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductStockTake.groovy:1100197,1100880,1104423,1131144,1131396,1132496,1132749,1134990,1135199,1135686,1135929,1137201,1137433,1137435,1138463,1138485
+/ofbiz/trunk/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductStockTake.groovy:1100197,1100880,1104423,1131144,1131396,1132496,1132749,1134990,1135199,1135686,1135929,1137201,1137433,1137435,1138463,1138485,1139385