Author: jleroux
Date: Fri Mar 6 18:55:30 2015 New Revision: 1664697 URL: http://svn.apache.org/r1664697 Log: "Applied fix from trunk for revision: 1664696 " ------------------------------------------------------------------------ r1664696 | jleroux | 2015-03-06 19:53:42 +0100 (ven., 06 mars 2015) | 13 lines 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/branches/release14.12/ (props changed) ofbiz/branches/release14.12/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java ofbiz/branches/release14.12/framework/widget/templates/htmlFormMacroLibrary.ftl Propchange: ofbiz/branches/release14.12/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Fri Mar 6 18:55:30 2015 @@ -8,4 +8,4 @@ /ofbiz/branches/json-integration-refactoring:1634077-1635900 /ofbiz/branches/multitenant20100310:921280-927264 /ofbiz/branches/release13.07:1547657 -/ofbiz/trunk:1649072,1649083-1649084,1649086,1649090,1649096,1649230,1649238-1649239,1649248,1649272,1649275,1649280-1649281,1649283,1649285-1649286,1649291,1649329,1649331,1649384,1649393,1649666,1649742,1650240,1650348,1650357,1650583,1650642,1650678,1650821,1650882,1650887,1650938,1651593,1652312,1652361,1652638,1652641,1652672,1652688,1652706,1652725,1652731,1652739,1652852,1653248,1653296,1653456,1653597,1653614,1654175,1654273,1654509,1654670,1654672-1654673,1654683-1654684,1654824,1655046,1655668,1655979,1656014,1656185,1656198,1656445,1656983,1657323,1657506-1657507,1657514,1657714,1657790,1657848,1658364,1658662,1658882,1659224,1659965,1660031,1660053,1660389,1660444,1660579,1661303,1661328,1661760,1661778,1661853,1661862,1661873,1661940,1661951,1661977,1662119-1662120,1662361,1662500,1662812,1662919,1663202,1663912,1663979,1664602,1664604 +/ofbiz/trunk:1649072,1649083-1649084,1649086,1649090,1649096,1649230,1649238-1649239,1649248,1649272,1649275,1649280-1649281,1649283,1649285-1649286,1649291,1649329,1649331,1649384,1649393,1649666,1649742,1650240,1650348,1650357,1650583,1650642,1650678,1650821,1650882,1650887,1650938,1651593,1652312,1652361,1652638,1652641,1652672,1652688,1652706,1652725,1652731,1652739,1652852,1653248,1653296,1653456,1653597,1653614,1654175,1654273,1654509,1654670,1654672-1654673,1654683-1654684,1654824,1655046,1655668,1655979,1656014,1656185,1656198,1656445,1656983,1657323,1657506-1657507,1657514,1657714,1657790,1657848,1658364,1658662,1658882,1659224,1659965,1660031,1660053,1660389,1660444,1660579,1661303,1661328,1661760,1661778,1661853,1661862,1661873,1661940,1661951,1661977,1662119-1662120,1662361,1662500,1662812,1662919,1663202,1663912,1663979,1664602,1664604,1664696 Modified: ofbiz/branches/release14.12/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java?rev=1664697&r1=1664696&r2=1664697&view=diff ============================================================================== --- ofbiz/branches/release14.12/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java (original) +++ ofbiz/branches/release14.12/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java Fri Mar 6 18:55:30 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/branches/release14.12/framework/widget/templates/htmlFormMacroLibrary.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/framework/widget/templates/htmlFormMacroLibrary.ftl?rev=1664697&r1=1664696&r2=1664697&view=diff ============================================================================== --- ofbiz/branches/release14.12/framework/widget/templates/htmlFormMacroLibrary.ftl (original) +++ ofbiz/branches/release14.12/framework/widget/templates/htmlFormMacroLibrary.ftl Fri Mar 6 18:55:30 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"> |
Free forum by Nabble | Edit this page |