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 2015/03/14 11:29:15 UTC

svn commit: r1666648 - in /ofbiz/branches/release12.04/framework/widget: src/org/ofbiz/widget/form/MacroFormRenderer.java templates/htmlFormMacroLibrary.ftl

Author: jleroux
Date: Sat Mar 14 10:29:14 2015
New Revision: 1666648

URL: http://svn.apache.org/r1666648
Log:
A patch from Taher Alkhateeb for "date-find in form widget does not persist value" https://issues.apache.org/jira/browse/OFBIZ-5074

Any search form that calls "performFind" and has a "date-find" tag will not persist but it will give correct search results. 

For example, If I go to Order -> Requests and search using any of the date fields, the result will be correct but the field will be blank upon returning results. This behavior affects only dates.

I suspect the main offender here is a bug in performFind service or one of the services it calls (prepareFind or executeFind). I believe that the "queryStringMap" does not contain the date-find fields in its returned value. I did not look heavily into the code but I think "fld" types are not persisted in-between requests.

jleroux: this is a R12.04 specific patch

Modified:
    ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
    ofbiz/branches/release12.04/framework/widget/templates/htmlFormMacroLibrary.ftl

Modified: ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=1666648&r1=1666647&r2=1666648&view=diff
==============================================================================
--- ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original)
+++ ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Sat Mar 14 10:29:14 2015
@@ -1995,6 +1995,15 @@ public class MacroFormRenderer implement
         if (value2 == null) {
             value2 = "";
         }
+        if(context.containsKey("parameters")){
+            Map<String, Object>parameters = (Map<String, Object>)context.get("parameters");
+            if(parameters.containsKey(name + "_fld0_value")){
+                value = (String)parameters.get(name + "_fld0_value");   
+            }
+            if(parameters.containsKey(name + "_fld1_value")){
+                value2 = (String)parameters.get(name + "_fld1_value");  
+            }  
+        }
         String titleStyle = "";
         if (UtilValidate.isNotEmpty(modelFormField.getTitleStyle())) {
             titleStyle = modelFormField.getTitleStyle();
@@ -2012,6 +2021,8 @@ public class MacroFormRenderer implement
         sr.append(localizedInputTitle);
         sr.append("\" value=\"");
         sr.append(value);
+        sr.append("\" value2=\"");
+        sr.append(value2);
         sr.append("\" size=\"");
         sr.append(Integer.toString(size));
         sr.append("\" maxlength=\"");

Modified: ofbiz/branches/release12.04/framework/widget/templates/htmlFormMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/widget/templates/htmlFormMacroLibrary.ftl?rev=1666648&r1=1666647&r2=1666648&view=diff
==============================================================================
--- ofbiz/branches/release12.04/framework/widget/templates/htmlFormMacroLibrary.ftl (original)
+++ ofbiz/branches/release12.04/framework/widget/templates/htmlFormMacroLibrary.ftl Sat Mar 14 10:29:14 2015
@@ -465,7 +465,7 @@ ${item.description}</span>
 </#if><#if titleStyle?has_content></span></#if>
 </#macro>
 
-<#macro renderDateFindField className alert name localizedInputTitle value size maxlength dateType formName defaultDateTimeString imgSrc localizedIconTitle titleStyle defaultOptionFrom defaultOptionThru opEquals opSameDay opGreaterThanFromDayStart opGreaterThan opGreaterThan opLessThan opUpToDay opUpThruDay opIsEmpty>
+<#macro renderDateFindField className alert name localizedInputTitle value value2 size maxlength dateType formName defaultDateTimeString imgSrc localizedIconTitle titleStyle defaultOptionFrom defaultOptionThru opEquals opSameDay opGreaterThanFromDayStart opGreaterThan opGreaterThan opLessThan opUpToDay opUpThruDay opIsEmpty>
 <span class="view-calendar">
 <input id="${name?html}_fld0_value" type="text" <@renderClass className alert /><#if name?has_content> name="${name?html}_fld0_value"</#if><#if localizedInputTitle?has_content> title="${localizedInputTitle}"</#if><#if value?has_content> value="${value}"</#if><#if size?has_content> size="${size}"</#if><#if maxlength?has_content> maxlength="${maxlength}"</#if>/><#rt/>
 <#if dateType != "time">