svn commit: r1857484 - in /ofbiz/ofbiz-framework/branches/release17.12: ./ framework/widget/src/main/java/org/apache/ofbiz/widget/model/ framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/ themes/common/template/macro/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1857484 - in /ofbiz/ofbiz-framework/branches/release17.12: ./ framework/widget/src/main/java/org/apache/ofbiz/widget/model/ framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/ themes/common/template/macro/

jleroux@apache.org
Author: jleroux
Date: Sat Apr 13 17:35:05 2019
New Revision: 1857484

URL: http://svn.apache.org/viewvc?rev=1857484&view=rev
Log:
"Applied fix from trunk for revision: 1849165"
------------------------------------------------------------------------
r1849165 | jleroux | 2018-12-18 12:20:28 +0100 (mar. 18 déc. 2018) | 16 lignes

Fixed: Date-find error when used in two forms of a same screen
(OFBIZ-10722)

When we have more than one form, in a screen, that use a date-find field,
the second date-find picker is not working.

To reproduce, you can add a new form with a date-find and call it below
FindInvoices in FindInvoices screen

Then load page [https://localhost:8443/accounting/control/findInvoices] .
You should see  that there is no picker on the second date-find

The patch adds an id that allow renderDateFindField macro script to work for
both fields

Thanks: Leila Mekika
------------------------------------------------------------------------

Modified:
    ofbiz/ofbiz-framework/branches/release17.12/   (props changed)
    ofbiz/ofbiz-framework/branches/release17.12/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java
    ofbiz/ofbiz-framework/branches/release17.12/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java
    ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/CsvFormMacroLibrary.ftl
    ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/FoFormMacroLibrary.ftl
    ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/HtmlFormMacroLibrary.ftl
    ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/TextFormMacroLibrary.ftl
    ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/XlsFormMacroLibrary.ftl
    ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/XmlFormMacroLibrary.ftl

Propchange: ofbiz/ofbiz-framework/branches/release17.12/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Apr 13 17:35:05 2019
@@ -10,4 +10,4 @@
 /ofbiz/branches/json-integration-refactoring:1634077-1635900
 /ofbiz/branches/multitenant20100310:921280-927264
 /ofbiz/branches/release13.07:1547657
-/ofbiz/ofbiz-framework/trunk:1819499,1819598,1819800,1819805,1819811,1819947,1820038,1820262,1820374-1820375,1820441,1820457,1820644,1820658,1820790,1820823,1820949,1820966,1821012,1821036,1821112,1821115,1821144,1821186,1821219,1821226,1821230,1821386,1821613,1821628,1821965,1822125,1822310,1822377,1822383,1822393,1823467,1823562,1823876,1824314,1824316,1824732,1824803,1824847,1824855,1825192,1825211,1825216,1825233,1825450,1826374,1826502,1826592,1826671,1826674,1826780,1826805,1826938,1826997,1827439,1828255,1828316,1828346,1828424,1828512,1828514,1829690,1830936,1831074,1831078,1831234,1831608,1831831,1832577,1832662,1832756,1832800,1832944,1833173,1833211,1834181,1834191,1834736,1835235,1835887,1835891,1835953,1835964,1836144,1836871,1837857,1838032,1838256,1838381,1840189,1840199,1840828,1841657,1841662,1842372,1842921,1843225,1843893,1844943,1845418,1845420,1845466,1845544,1845552,1845558,1845933,1845995,1846097,1846107,1846214,1846594,1846632,1847398,1847478,1847670,1847715,
 1847890,1848263,1848336,1848386,1848398,1848441,1848444,1848447,1848449,1848467,1848469,1848745,1848849-1848850,1849021,1849191,1849193,1849275,1849467,1849528,1849540,1849567,1849693,1850015,1850023,1850530,1850647,1850685,1850694,1850914,1850918,1850948,1850953,1851006,1851068,1851074,1851130,1851158,1851163,1851200,1851247,1851319,1851350,1851805,1851998,1852587,1852818,1853070,1853109,1853691,1853745,1853750,1854306,1854457,1855078,1855287,1855371,1855403,1855488,1855492,1855497,1855501,1855898,1856405,1856455,1856459-1856460,1856484,1856598,1856617,1856667,1857173,1857180,1857213,1857392
+/ofbiz/ofbiz-framework/trunk:1819499,1819598,1819800,1819805,1819811,1819947,1820038,1820262,1820374-1820375,1820441,1820457,1820644,1820658,1820790,1820823,1820949,1820966,1821012,1821036,1821112,1821115,1821144,1821186,1821219,1821226,1821230,1821386,1821613,1821628,1821965,1822125,1822310,1822377,1822383,1822393,1823467,1823562,1823876,1824314,1824316,1824732,1824803,1824847,1824855,1825192,1825211,1825216,1825233,1825450,1826374,1826502,1826592,1826671,1826674,1826780,1826805,1826938,1826997,1827439,1828255,1828316,1828346,1828424,1828512,1828514,1829690,1830936,1831074,1831078,1831234,1831608,1831831,1832577,1832662,1832756,1832800,1832944,1833173,1833211,1834181,1834191,1834736,1835235,1835887,1835891,1835953,1835964,1836144,1836871,1837857,1838032,1838256,1838381,1840189,1840199,1840828,1841657,1841662,1842372,1842921,1843225,1843893,1844943,1845418,1845420,1845466,1845544,1845552,1845558,1845933,1845995,1846097,1846107,1846214,1846594,1846632,1847398,1847478,1847670,1847715,
 1847890,1848263,1848336,1848386,1848398,1848441,1848444,1848447,1848449,1848467,1848469,1848745,1848849-1848850,1849021,1849165,1849191,1849193,1849275,1849467,1849528,1849540,1849567,1849693,1850015,1850023,1850530,1850647,1850685,1850694,1850914,1850918,1850948,1850953,1851006,1851068,1851074,1851130,1851158,1851163,1851200,1851247,1851319,1851350,1851805,1851998,1852587,1852818,1853070,1853109,1853691,1853745,1853750,1854306,1854457,1855078,1855287,1855371,1855403,1855488,1855492,1855497,1855501,1855898,1856405,1856455,1856459-1856460,1856484,1856598,1856617,1856667,1857173,1857180,1857213,1857392

Modified: ofbiz/ofbiz-framework/branches/release17.12/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release17.12/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java?rev=1857484&r1=1857483&r2=1857484&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/branches/release17.12/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java (original)
+++ ofbiz/ofbiz-framework/branches/release17.12/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java Sat Apr 13 17:35:05 2019
@@ -224,6 +224,13 @@ public class ModelFormField {
         return this.name;
     }
 
+
+    /**
+     * Gets the current id name of the {@link ModelFormField} and if in
+     * a multi type {@link ModelForm}, suffixes it with the index row.
+     * @param context
+     * @return
+     */
     public String getCurrentContainerId(Map<String, Object> context) {
         ModelForm modelForm = this.getModelForm();
         String idName = FlexibleStringExpander.expandString(this.getIdName(), context);
@@ -433,6 +440,14 @@ public class ModelFormField {
         return headerLinkStyle;
     }
 
+    /**
+     * Gets the id name of the {@link ModelFormField} that is :
+     * <ul>
+     *     <li>The id-name" specified on the field definition
+     *     <li>Else the concatenation of the formName and fieldName
+     * </ul>
+     * @return
+     */
     public String getIdName() {
         if (UtilValidate.isNotEmpty(idName)) {
             return idName;

Modified: ofbiz/ofbiz-framework/branches/release17.12/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release17.12/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java?rev=1857484&r1=1857483&r2=1857484&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/branches/release17.12/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java (original)
+++ ofbiz/ofbiz-framework/branches/release17.12/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java Sat Apr 13 17:35:05 2019
@@ -2039,6 +2039,7 @@ public final class MacroFormRenderer imp
         if (UtilValidate.isNotEmpty(modelFormField.getTitleStyle())) {
             titleStyle = modelFormField.getTitleStyle();
         }
+        String id = modelFormField.getCurrentContainerId(context);
         String tabindex = modelFormField.getTabindex();
         StringWriter sr = new StringWriter();
         sr.append("<@renderDateFindField ");
@@ -2046,6 +2047,8 @@ public final class MacroFormRenderer imp
         sr.append(className);
         sr.append("\" alert=\"");
         sr.append(alert);
+        sr.append("\" id=\"");
+        sr.append(id);
         sr.append("\" name=\"");
         sr.append(name);
         sr.append("\" localizedInputTitle=\"");

Modified: ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/CsvFormMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/CsvFormMacroLibrary.ftl?rev=1857484&r1=1857483&r2=1857484&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/CsvFormMacroLibrary.ftl (original)
+++ ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/CsvFormMacroLibrary.ftl Sat Apr 13 17:35:05 2019
@@ -99,7 +99,7 @@ under the License.
 
 <#macro renderTextFindField name value defaultOption opEquals opBeginsWith opContains opIsEmpty opNotEqual className alert size maxlength autocomplete titleStyle hideIgnoreCase ignCase ignoreCase tabindex><@renderField value /></#macro>
 
-<#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 tabindex><@renderField value /></#macro>
+<#macro renderDateFindField className alert id name localizedInputTitle value value2 size maxlength dateType formName defaultDateTimeString imgSrc localizedIconTitle titleStyle defaultOptionFrom defaultOptionThru opEquals opSameDay opGreaterThanFromDayStart opGreaterThan opGreaterThan opLessThan opUpToDay opUpThruDay opIsEmpty conditionGroup tabindex><@renderField value /></#macro>
 
 <#macro renderRangeFindField className alert name value size maxlength autocomplete titleStyle defaultOptionFrom opEquals opGreaterThan opGreaterThanEquals opLessThan opLessThanEquals value2 defaultOptionThru tabindex>
 <@renderField value />

Modified: ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/FoFormMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/FoFormMacroLibrary.ftl?rev=1857484&r1=1857483&r2=1857484&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/FoFormMacroLibrary.ftl (original)
+++ ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/FoFormMacroLibrary.ftl Sat Apr 13 17:35:05 2019
@@ -123,7 +123,7 @@ under the License.
 
 <#macro renderTextFindField name value defaultOption opEquals opBeginsWith opContains opIsEmpty opNotEqual className alert size maxlength autocomplete titleStyle hideIgnoreCase ignCase ignoreCase tabindex><@makeBlock className value/></#macro>
 
-<#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 tabindex>
+<#macro renderDateFindField className alert id name localizedInputTitle value value2 size maxlength dateType formName defaultDateTimeString imgSrc localizedIconTitle titleStyle defaultOptionFrom defaultOptionThru opEquals opSameDay opGreaterThanFromDayStart opGreaterThan opGreaterThan opLessThan opUpToDay opUpThruDay opIsEmpty conditionGroup tabindex>
 <@makeBlock className value />
 </#macro>
 <#macro renderRangeFindField className alert name value size maxlength autocomplete titleStyle defaultOptionFrom opEquals opGreaterThan opGreaterThanEquals opLessThan opLessThanEquals value2 defaultOptionThru tabindex>

Modified: ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/HtmlFormMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/HtmlFormMacroLibrary.ftl?rev=1857484&r1=1857483&r2=1857484&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/HtmlFormMacroLibrary.ftl (original)
+++ ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/HtmlFormMacroLibrary.ftl Sat Apr 13 17:35:05 2019
@@ -472,15 +472,18 @@ under the License.
   </#if>
 </#macro>
 
-<#macro renderDateFindField className alert name dateType formName value defaultDateTimeString imgSrc localizedIconTitle defaultOptionFrom defaultOptionThru opEquals opSameDay opGreaterThanFromDayStart opGreaterThan opGreaterThan opLessThan opUpToDay opUpThruDay opIsEmpty localizedInputTitle="" value2="" size="" maxlength="" titleStyle="" tabindex="">
+<#macro renderDateFindField className alert id name dateType formName value defaultDateTimeString imgSrc localizedIconTitle defaultOptionFrom defaultOptionThru opEquals opSameDay opGreaterThanFromDayStart opGreaterThan opGreaterThan opLessThan opUpToDay opUpThruDay opIsEmpty conditionGroup="" localizedInputTitle="" value2="" size="" maxlength="" titleStyle="" tabindex="">
+  <#if conditionGroup?has_content>
+    <input type="hidden" name="${name}_grp" value="${conditionGroup}"/>
+  </#if>
   <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>/><#if tabindex?has_content> tabindex="${tabindex}"</#if><#rt/>
+    <input id="${id}_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>/><#if tabindex?has_content> tabindex="${tabindex}"</#if><#rt/>
     <#if dateType != "time">
       <script type="text/javascript">
         <#if "date" == dateType>
-          jQuery("#${name?html}_fld0_value").datepicker({
+          jQuery("#${id}_fld0_value").datepicker({
         <#else>
-          jQuery("#${name?html}_fld0_value").datetimepicker({
+          jQuery("#${id}_fld0_value").datetimepicker({
             showSecond: true,
             <#-- showMillisec: true, -->
             timeFormat: 'HH:mm:ss',
@@ -511,13 +514,13 @@ under the License.
       </span><#rt/>
     </#if>
     <#rt/>
-    <input id="${name?html}_fld1_value" type="text" <@renderClass className alert /><#if name?has_content> name="${name}_fld1_value"</#if><#if localizedInputTitle??> title="${localizedInputTitle?html}"</#if><#if value2?has_content> value="${value2}"</#if><#if size?has_content> size="${size}"</#if><#if maxlength?has_content> maxlength="${maxlength}"</#if>/><#rt/>
+    <input id="${id}_fld1_value" type="text" <@renderClass className alert /><#if name?has_content> name="${name}_fld1_value"</#if><#if localizedInputTitle??> title="${localizedInputTitle?html}"</#if><#if value2?has_content> value="${value2}"</#if><#if size?has_content> size="${size}"</#if><#if maxlength?has_content> maxlength="${maxlength}"</#if>/><#rt/>
     <#if dateType != "time">
       <script type="text/javascript">
         <#if "date" == dateType>
-          jQuery("#${name?html}_fld1_value").datepicker({
+          jQuery("#${id}_fld1_value").datepicker({
         <#else>
-          jQuery("#${name?html}_fld1_value").datetimepicker({
+          jQuery("#${id}_fld1_value").datetimepicker({
             showSecond: true,
             <#-- showMillisec: true, -->
             timeFormat: 'HH:mm:ss',

Modified: ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/TextFormMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/TextFormMacroLibrary.ftl?rev=1857484&r1=1857483&r2=1857484&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/TextFormMacroLibrary.ftl (original)
+++ ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/TextFormMacroLibrary.ftl Sat Apr 13 17:35:05 2019
@@ -99,7 +99,7 @@ under the License.
 
 <#macro renderTextFindField name value defaultOption opEquals opBeginsWith opContains opIsEmpty opNotEqual className alert size maxlength autocomplete titleStyle hideIgnoreCase ignCase ignoreCase tabindex><@renderField value /></#macro>
 
-<#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 tabindex><@renderField value /></#macro>
+<#macro renderDateFindField className alert id name localizedInputTitle value value2 size maxlength dateType formName defaultDateTimeString imgSrc localizedIconTitle titleStyle defaultOptionFrom defaultOptionThru opEquals opSameDay opGreaterThanFromDayStart opGreaterThan opGreaterThan opLessThan opUpToDay opUpThruDay opIsEmpty conditionGroup tabindex><@renderField value /></#macro>
 
 <#macro renderRangeFindField className alert name value size maxlength autocomplete titleStyle defaultOptionFrom opEquals opGreaterThan opGreaterThanEquals opLessThan opLessThanEquals value2 defaultOptionThru tabindex>
 <@renderField value />

Modified: ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/XlsFormMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/XlsFormMacroLibrary.ftl?rev=1857484&r1=1857483&r2=1857484&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/XlsFormMacroLibrary.ftl (original)
+++ ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/XlsFormMacroLibrary.ftl Sat Apr 13 17:35:05 2019
@@ -114,7 +114,7 @@ under the License.
 
 <#macro renderTextFindField name value defaultOption opEquals opBeginsWith opContains opIsEmpty opNotEqual className alert size maxlength autocomplete titleStyle hideIgnoreCase ignCase ignoreCase tabindex></#macro>
 
-<#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 tabindex></#macro>
+<#macro renderDateFindField className alert id name localizedInputTitle value value2 size maxlength dateType formName defaultDateTimeString imgSrc localizedIconTitle titleStyle defaultOptionFrom defaultOptionThru opEquals opSameDay opGreaterThanFromDayStart opGreaterThan opGreaterThan opLessThan opUpToDay opUpThruDay opIsEmpty conditionGroup tabindex></#macro>
 
 <#macro renderRangeFindField className alert name value size maxlength autocomplete titleStyle defaultOptionFrom opEquals opGreaterThan opGreaterThanEquals opLessThan opLessThanEquals value2 defaultOptionThru tabindex></#macro>
 

Modified: ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/XmlFormMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/XmlFormMacroLibrary.ftl?rev=1857484&r1=1857483&r2=1857484&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/XmlFormMacroLibrary.ftl (original)
+++ ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/macro/XmlFormMacroLibrary.ftl Sat Apr 13 17:35:05 2019
@@ -92,7 +92,7 @@ under the License.
 
 <#macro renderTextFindField name value defaultOption opEquals opBeginsWith opContains opIsEmpty opNotEqual className alert size maxlength autocomplete titleStyle hideIgnoreCase ignCase ignoreCase tabindex><@renderField value/></#macro>
 
-<#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 tabindex></#macro>
+<#macro renderDateFindField className alert id name localizedInputTitle value value2 size maxlength dateType formName defaultDateTimeString imgSrc localizedIconTitle titleStyle defaultOptionFrom defaultOptionThru opEquals opSameDay opGreaterThanFromDayStart opGreaterThan opGreaterThan opLessThan opUpToDay opUpThruDay opIsEmpty conditionGroup tabindex></#macro>
 
 <#macro renderRangeFindField className alert name value size maxlength autocomplete titleStyle defaultOptionFrom opEquals opGreaterThan opGreaterThanEquals opLessThan opLessThanEquals value2 defaultOptionThru tabindex>
 </#macro>