From d63e7d20ec07aff2ea2b9de27308e7110bbfd08a Mon Sep 17 00:00:00 2001 From: Suraj Khurana Date: Sat, 25 May 2019 08:27:34 +0000 Subject: [PATCH] Applied fix from trunk for revision: 1859915 === Fixed: Enable entity timestamp fields. (OFBIZ-10959) While working on a Production environment, it is found that for some reason entity timestamp fields are disabled at Search Results screen in Trunk and the previous release branch. Thanks Pawan Verma for reporting the issue and providing the patch, Jacques, Gil, Mathieu for reviewing it. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1859916 13f79535-47bb-0310-9956-ffa450edef68 --- framework/webtools/groovyScripts/entity/FindGeneric.groovy | 2 +- framework/widget/dtd/widget-form.xsd | 5 +++++ .../main/java/org/apache/ofbiz/widget/model/ModelForm.java | 5 ++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/framework/webtools/groovyScripts/entity/FindGeneric.groovy b/framework/webtools/groovyScripts/entity/FindGeneric.groovy index 39bdc7a1d8..d30557351c 100644 --- a/framework/webtools/groovyScripts/entity/FindGeneric.groovy +++ b/framework/webtools/groovyScripts/entity/FindGeneric.groovy @@ -86,7 +86,7 @@ if (modelEntity) { '' + '' + '' + - '' + + '' + '' + '' + ' ' + diff --git a/framework/widget/dtd/widget-form.xsd b/framework/widget/dtd/widget-form.xsd index c30d5a635b..5c6fd7cffe 100644 --- a/framework/widget/dtd/widget-form.xsd +++ b/framework/widget/dtd/widget-form.xsd @@ -496,6 +496,11 @@ under the License. + + + This field will let the user enable internal fields of entity + + diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java index 6395da798a..3193c56a71 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java @@ -758,7 +758,8 @@ public abstract class ModelForm extends ModelWidget { Iterator modelFieldIter = modelEntity.getFieldsIterator(); while (modelFieldIter.hasNext()) { ModelField modelField = modelFieldIter.next(); - if (modelField.getIsAutoCreatedInternal()) { + // auto-add only if field was generated automatically by the entity engine or including internally + if (modelField.getIsAutoCreatedInternal() && !autoFieldsEntity.includeInternal) { // don't ever auto-add these, should only be added if explicitly referenced continue; } @@ -1446,11 +1447,13 @@ public abstract class ModelForm extends ModelWidget { public final String mapName; public final String defaultFieldType; public final int defaultPosition; + public final boolean includeInternal; public AutoFieldsEntity(Element element) { this.entityName = element.getAttribute("entity-name"); this.mapName = element.getAttribute("map-name"); this.defaultFieldType = element.getAttribute("default-field-type"); + this.includeInternal = !"false".equals(element.getAttribute("include-internal")); String positionStr = element.getAttribute("default-position"); int position = 1; try {