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 2018/12/18 11:20:29 UTC
svn commit: r1849165 - in /ofbiz/ofbiz-framework/trunk:
framework/widget/src/main/java/org/apache/ofbiz/widget/model/
framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/
themes/common-theme/template/macro/
Author: jleroux
Date: Tue Dec 18 11:20:28 2018
New Revision: 1849165
URL: http://svn.apache.org/viewvc?rev=1849165&view=rev
Log:
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/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java
ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java
ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/CsvFormMacroLibrary.ftl
ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/FoFormMacroLibrary.ftl
ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl
ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/TextFormMacroLibrary.ftl
ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/XlsFormMacroLibrary.ftl
ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/XmlFormMacroLibrary.ftl
Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java?rev=1849165&r1=1849164&r2=1849165&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java Tue Dec 18 11:20:28 2018
@@ -227,6 +227,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);
@@ -436,6 +443,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/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java?rev=1849165&r1=1849164&r2=1849165&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java Tue Dec 18 11:20:28 2018
@@ -2062,6 +2062,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 ");
@@ -2069,6 +2070,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/trunk/themes/common-theme/template/macro/CsvFormMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/CsvFormMacroLibrary.ftl?rev=1849165&r1=1849164&r2=1849165&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/CsvFormMacroLibrary.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/CsvFormMacroLibrary.ftl Tue Dec 18 11:20:28 2018
@@ -100,7 +100,7 @@ under the License.
<#macro renderTextFindField name value defaultOption opEquals opBeginsWith opContains opIsEmpty opNotEqual className alert size maxlength autocomplete titleStyle hideIgnoreCase ignCase ignoreCase conditionGroup 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 conditionGroup 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 conditionGroup tabindex>
<@renderField value />
Modified: ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/FoFormMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/FoFormMacroLibrary.ftl?rev=1849165&r1=1849164&r2=1849165&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/FoFormMacroLibrary.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/FoFormMacroLibrary.ftl Tue Dec 18 11:20:28 2018
@@ -124,7 +124,7 @@ under the License.
<#macro renderTextFindField name value defaultOption opEquals opBeginsWith opContains opIsEmpty opNotEqual className alert size maxlength autocomplete titleStyle hideIgnoreCase ignCase ignoreCase conditionGroup 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 conditionGroup 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 conditionGroup tabindex>
Modified: ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl?rev=1849165&r1=1849164&r2=1849165&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl Tue Dec 18 11:20:28 2018
@@ -469,18 +469,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 conditionGroup="" 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="application/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 +511,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="application/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/trunk/themes/common-theme/template/macro/TextFormMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/TextFormMacroLibrary.ftl?rev=1849165&r1=1849164&r2=1849165&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/TextFormMacroLibrary.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/TextFormMacroLibrary.ftl Tue Dec 18 11:20:28 2018
@@ -100,7 +100,7 @@ under the License.
<#macro renderTextFindField name value defaultOption opEquals opBeginsWith opContains opIsEmpty opNotEqual className alert size maxlength autocomplete titleStyle hideIgnoreCase ignCase ignoreCase conditionGroup 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 conditionGroup 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 conditionGroup tabindex>
<@renderField value />
Modified: ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/XlsFormMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/XlsFormMacroLibrary.ftl?rev=1849165&r1=1849164&r2=1849165&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/XlsFormMacroLibrary.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/XlsFormMacroLibrary.ftl Tue Dec 18 11:20:28 2018
@@ -115,7 +115,7 @@ under the License.
<#macro renderTextFindField name value defaultOption opEquals opBeginsWith opContains opIsEmpty opNotEqual className alert size maxlength autocomplete titleStyle hideIgnoreCase ignCase ignoreCase conditionGroup 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 conditionGroup 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 conditionGroup tabindex></#macro>
Modified: ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/XmlFormMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/XmlFormMacroLibrary.ftl?rev=1849165&r1=1849164&r2=1849165&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/XmlFormMacroLibrary.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/XmlFormMacroLibrary.ftl Tue Dec 18 11:20:28 2018
@@ -93,7 +93,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 conditionGroup 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 conditionGroup tabindex>
</#macro>