[ofbiz-framework] branch release18.12 updated: Fixed: Addressed log issues caused in FindGeneric.groovy (OFBIZ-12193) (#285)

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

[ofbiz-framework] branch release18.12 updated: Fixed: Addressed log issues caused in FindGeneric.groovy (OFBIZ-12193) (#285)

jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch release18.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/release18.12 by this push:
     new fabbba3  Fixed: Addressed log issues caused in FindGeneric.groovy (OFBIZ-12193) (#285)
fabbba3 is described below

commit fabbba342c992e5bad48be269e75ca9ef86e9d3d
Author: SebastianEcomify <[hidden email]>
AuthorDate: Fri Mar 12 11:01:44 2021 +0100

    Fixed: Addressed log issues caused in FindGeneric.groovy (OFBIZ-12193) (#285)
   
    The backportet Version of searchForm in FindGeneric.groovy was to
    advanced for the 18.12 Version. The form was changed back to its
    previous version and the changes causing the view Error in ViewEntities
    have been worked into it
---
 .../groovyScripts/entity/FindGeneric.groovy        | 47 +++++++++-------------
 1 file changed, 19 insertions(+), 28 deletions(-)

diff --git a/framework/webtools/groovyScripts/entity/FindGeneric.groovy b/framework/webtools/groovyScripts/entity/FindGeneric.groovy
index be6c73b..4667c6f 100644
--- a/framework/webtools/groovyScripts/entity/FindGeneric.groovy
+++ b/framework/webtools/groovyScripts/entity/FindGeneric.groovy
@@ -83,34 +83,25 @@ if (modelEntity) {
     context.dynamicAutoEntitySearchForm = writer
 
     //prepare the result list from performFind
-    String dynamicAutoEntityFieldListForm = """<?xml version="1.0" encoding="UTF-8"?><forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ofbiz.apache.org/Widget-Form" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form http://ofbiz.apache.org/dtds/widget-form.xsd">
-            <form name="ListGeneric" type="list" target="entity/find/${entityName}" list-name="listIt" paginate-target="entity/find/${entityName}"
-              odd-row-style="alternate-row" default-table-style="basic-table light-grid hover-bar" header-row-style="header-row-2">
-            <actions>
-                <service service-name="performFind">
-                    <field-map field-name="inputFields" from-field="parameters"/>
-                    <field-map field-name="entityName" value="${entityName}"/>"""
-    if (fieldsToSelect) {
-    dynamicAutoEntityFieldListForm += """
-                    <field-map field-name="fieldList" value="${fieldsToSelect}"/>"""
-    }
-    dynamicAutoEntityFieldListForm += """
-                    <field-map field-name="orderBy" from-field="parameters.sortField"/>
-                </service>
-            </actions>
-            <auto-fields-entity entity-name="${entityName}" default-field-type="display" include-internal="true"/>
-            <field name="_method"><hidden value="POST"/></field>
-            <field name="entityName"><hidden value="${entityName}"/></field>"""
-    modelEntity.getFieldsUnmodifiable().each {
-        modelField ->
-            dynamicAutoEntityFieldListForm +=
-                    "<field name=\"${modelField.name}\" sort-field=\"true\"/>"
-    }
-    dynamicAutoEntityFieldListForm += """
-            <field name="viewGeneric" title=" "><hyperlink target="\${groovy: 'entity/find/' + org.apache.ofbiz.entity.util.EntityUtil.entityToPath(delegator, '${entityName}', context)}" description="view"/></field>
-            <sort-order><sort-field name="viewGeneric"/></sort-order>
-            </form></forms>"""
-
+    String dynamicAutoEntityFieldListForm = '<?xml version="1.0" encoding="UTF-8"?><forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ofbiz.apache.org/Widget-Form" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form http://ofbiz.apache.org/dtds/widget-form.xsd">' +
+            '<form name="ListGeneric" type="list" target="FindGeneric" list-name="listIt" ' +
+            '  odd-row-style="alternate-row" default-table-style="basic-table light-grid hover-bar">' +
+            '<actions><service service-name="performFind">' +
+            '<field-map field-name="inputFields" from-field="parameters"/>' +
+            '<field-map field-name="entityName" value="' + entityName + '"/>'
+            if (fieldsToSelect) {
+                dynamicAutoEntityFieldListForm += '<field-map field-name="fieldList" value="' + fieldsToSelect + '"/>'
+            }
+            dynamicAutoEntityFieldListForm += '</service></actions>' +
+            '<auto-fields-entity entity-name="' + entityName + '" default-field-type="display" include-internal="true"/>' +
+            '<field name="entityName"><hidden value="' + entityName + '"/></field>' +
+            '<field name="viewGeneric" title=" "><hyperlink target="ViewGeneric" description="view">' +
+            '    <auto-parameters-entity entity-name="' + entityName + '"/>' +
+            '    <parameter param-name="entityName" value="' + entityName + '"/>' +
+            '</hyperlink></field>' +
+            '<sort-order><sort-field name="viewGeneric"/></sort-order>' +
+            '</form></forms>'
+    //Debug.logInfo(dynamicAutoEntityFieldForm, "")
     Document dynamicAutoEntityFieldListFormXml = UtilXml.readXmlDocument(dynamicAutoEntityFieldListForm, true, true)
     modelFormMap = FormFactory.readFormDocument(dynamicAutoEntityFieldListFormXml, entityModelReader, dispatcher.getDispatchContext(), entityName)
     if (UtilValidate.isNotEmpty(modelFormMap)) {