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/06 19:53:43 UTC
svn commit: r1664696 - in /ofbiz/trunk/framework/widget:
src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java
templates/htmlFormMacroLibrary.ftl
Author: jleroux
Date: Fri Mar 6 18:53:42 2015
New Revision: 1664696
URL: http://svn.apache.org/r1664696
Log:
A slightly modified patch from Christian Carlow for "date-find in form widget does not persist value" https://issues.apache.org/jira/browse/OFBIZ-5074
Reported by Taher:
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.
Christian:
This issue is still relevant and needed. The <date-find> values are not persisted after submission due to MacroFormRenderer.java not evaluating value and value2 correctly. In face, value2 isn't event passed to the definition in framework/widget/templates/htmlFormMacroLibrary.ftl. This is a starting point for this functionality. I said starting point because I'm not sure if it handles default values and other field settings that may need to be applied after my patch.
jleroux: It indeed needs to be improved, at least to keep the related date operator... I don't close yet, but would be better to open a new Jira issue...
I simply formatted the patch (tabs instead of 4 spaces) and used UtilGenerics.checkMap() instead of (Map<String, Object>)
Modified:
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java
ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java?rev=1664696&r1=1664695&r2=1664696&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java Fri Mar 6 18:53:42 2015
@@ -1944,6 +1944,16 @@ public final class MacroFormRenderer imp
if (value2 == null) {
value2 = "";
}
+ if (context.containsKey("parameters")) {
+ Map<String, Object> parameters = UtilGenerics.checkMap(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();
@@ -1960,6 +1970,8 @@ public final class MacroFormRenderer imp
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/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl?rev=1664696&r1=1664695&r2=1664696&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl (original)
+++ ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl Fri Mar 6 18:53:42 2015
@@ -480,7 +480,7 @@ under the License.
</#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">