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
This commit is contained in:
SebastianEcomify
2021-03-12 11:01:44 +01:00
committed by GitHub
parent 82c2258247
commit fabbba342c
@@ -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)) {