Files
ofbiz-plugins/example/widget/example/ExampleForms.xml
T
Jacques Le Roux c432d0483a "Applied fix from plugins for revision: 1868545"
------------------------------------------------------------------------
r1868545 | jleroux | 2019-10-17 14:19:33 +0200 (jeu. 17 oct. 2019) | 16 lignes

Fixed: EditExample always update status, because current Status not shown
(OFBIZ-11230)

In the EditExample Form, the drop-down is populates with the Valid change status 
only. So current status is not in the list and the status print in the drop-down 
is the next authorized. I want to modify exampleName or exampleType, I go to 
editExample and change what I want and validate. The problem is status is also 
changed!

There are 12 other same or similar cases. For the first of them (in FinAccount) 
there is the same bug: when I change FinAccount Name, status change too. If I 
add current="first-in-list" in the tag drop-down it works 

jleroux: Quote is a peculiar case due to OFBIZ-7337 which was a wrong fix
 
Thanks: Oliver for the analysis and the fix 
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1868547 13f79535-47bb-0310-9956-ffa450edef68
2019-10-17 12:20:10 +00:00

396 lines
22 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<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="FindExamples" type="single" target="FindExample" default-entity-name="Example">
<field name="noConditionFind"><hidden value="Y"/><!-- if this isn't there then with all fields empty no query will be done --></field>
<field name="exampleId" title="${uiLabelMap.ExampleExampleId}"><text-find/></field>
<field name="exampleName" title="${uiLabelMap.CommonName}"><text-find/></field>
<field name="exampleTypeId" title="${uiLabelMap.CommonType}">
<drop-down allow-empty="true" current-description="">
<entity-options key-field-name="exampleTypeId" entity-name="ExampleType">
<entity-order-by field-name="description"/>
</entity-options>
</drop-down>
</field>
<field name="statusId" title="${uiLabelMap.CommonStatus}">
<drop-down allow-empty="true" current-description="">
<entity-options key-field-name="statusId" entity-name="ExampleStatusItem"/>
</drop-down>
</field>
<field name="listOtherElements">
<radio>
<option key="items"/>
<option key="features"/>
<option key="status"/>
</radio>
</field>
<field name="searchButton"><submit/></field>
<field name="exportButton" position="2" widget-style="smallSubmit" title=" ">
<hyperlink also-hidden="false" target-type="plain" description="${uiLabelMap.CommonExport}"
target="javascript: document.FindExamples.action='ListExampleExport'; document.FindExamples.submit();"/>
</field>
</form>
<grid name="ListExamples" list-name="listIt" paginate-target="FindExample" default-entity-name="Example" separate-columns="true"
odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
<actions>
<service service-name="performFind" result-map="result" result-map-list="listIt">
<field-map field-name="inputFields" from-field="exampleCtx"/>
<field-map field-name="entityName" value="Example"/>
<field-map field-name="orderBy" from-field="parameters.sortField"/>
<field-map field-name="viewIndex" from-field="viewIndex"/>
<field-map field-name="viewSize" from-field="viewSize"/>
</service>
<set field="sortField" from-field="parameters.sortField"/>
</actions>
<alt-row-style use-when="'EXST_APPROVED'.equals(statusId)" style="Validate"/>
<alt-row-style use-when="'EXST_CANCELLED'.equals(statusId)" style="Warn"/>
<field name="exampleId" title="${uiLabelMap.ExampleExampleId}" widget-style="buttontext">
<hyperlink description="${exampleId}" target="EditExample" also-hidden="false">
<parameter param-name="exampleId"/>
</hyperlink>
</field>
<field name="exampleName" title="${uiLabelMap.CommonName}" sort-field="true"><display/></field>
<field name="exampleTypeId" title="${uiLabelMap.CommonType}"><display-entity entity-name="ExampleType"/></field>
<field name="statusId" title="${uiLabelMap.CommonStatus}"><display-entity entity-name="StatusItem"/></field>
<field name="description" title="${uiLabelMap.CommonDescription}" sort-field="true"><display/></field>
<field name="conditionalDesc" ignore-when="&quot;exampleName&quot;.equals(sortField)" title="my desc"><display description="${description}"/></field>
</grid>
<!--example form with include an other form -->
<grid name="ListExamplesWithFeatures" extends="ListExamples" extends-resource="component://example/widget/example/ExampleForms.xml">
<actions>
<call-parent-actions/>
</actions>
<field name="features"><include-form name="ExampleFeaturesInLine" location="component://example/widget/example/ExampleForms.xml"/></field>
</grid>
<form name="ExampleFeaturesInLine" type="list" default-table-style="basic-table light-grid" default-entity-name="ExampleFeatureAppl">
<actions>
<entity-condition entity-name="ExampleFeatureAppl">
<condition-expr field-name="exampleId" from-field="exampleId"/>
<order-by field-name="sequenceNum"/>
</entity-condition>
</actions>
<auto-fields-entity entity-name="ExampleFeatureAppl" default-field-type="display"/>
<field name="exampleId"><ignored/></field>
</form>
<!--example form with include a screen -->
<grid name="ListExamplesWithItems" extends="ListExamples" extends-resource="component://example/widget/example/ExampleForms.xml">
<actions>
<call-parent-actions/>
</actions>
<field name="items"><include-screen name="ExampleItemsInLine" location="component://example/widget/example/ExampleScreens.xml"/></field>
</grid>
<grid name="ListExampleItemsInLine" default-table-style="basic-table light-grid">
<actions>
<entity-condition entity-name="ExampleItem">
<condition-expr field-name="exampleId" from-field="exampleId"/>
</entity-condition>
</actions>
<auto-fields-entity entity-name="ExampleItem" default-field-type="display"/>
<field name="exampleId"><ignored/></field>
</grid>
<!--example form with include a grid -->
<grid name="ListExamplesWithStatus" extends="ListExamples" extends-resource="component://example/widget/example/ExampleForms.xml">
<actions>
<call-parent-actions/>
</actions>
<field name="status"><include-grid name="ExampleStatusInLine" location="component://example/widget/example/ExampleForms.xml"/></field>
</grid>
<grid name="ExampleStatusInLine" default-table-style="basic-table light-grid" default-entity-name="ExampleStatus">
<actions>
<entity-condition entity-name="ExampleStatus">
<condition-expr field-name="exampleId" from-field="exampleId"/>
<order-by field-name="statusDate"/>
</entity-condition>
</actions>
<auto-fields-entity entity-name="ExampleStatus" default-field-type="display"/>
<field name="exampleId"><ignored/></field>
</grid>
<grid name="ListExampleExport" extends="ListExamples" extends-resource="component://example/widget/example/ExampleForms.xml" paginate="false">
<actions>
<call-parent-actions/>
</actions>
</grid>
<!-- Typically, this extended form wouldn't be necessary. The parent form (ListExamples) would
have these attributes.
For the Ajax example we want all example entities listed, so the we use the entity-condition
instead of the performFind service. -->
<grid name="ListExamplesAjax" extends="ListExamples" paginate-target="authview/findExampleAjax">
<actions>
<entity-condition entity-name="Example"><order-by field-name="exampleName"/></entity-condition>
</actions>
<field name="exampleId" title="${uiLabelMap.ExampleExampleId}" widget-style="buttontext">
<hyperlink description="${exampleId}" target="EditExampleLayer" also-hidden="false" link-type="layered-modal">
<parameter param-name="exampleId"/>
</hyperlink>
</field>
<field name="exampleName" title="${uiLabelMap.CommonName}" id-name="exampleName">
<display>
<in-place-editor url="/example/control/updateExample" cancel-control="button" saving-text="Updating..." text-between-controls=" ">
<simple-editor/>
<field-map field-name="exampleId" from-field="exampleId"/>
<field-map field-name="statusId" from-field="statusId"/>
</in-place-editor>
</display>
</field>
<field name="description" title="${uiLabelMap.CommonDescription}" id-name="description">
<display>
<in-place-editor url="/example/control/updateExample" cancel-control="button" saving-text="Updating..." text-between-controls=" ">
<simple-editor/>
<field-map field-name="exampleId" from-field="exampleId"/>
<field-map field-name="statusId" from-field="statusId"/>
</in-place-editor>
</display>
</field>
<on-event-update-area event-type="paginate" area-id="ListExamplesAjax" area-target="ListExampleFormOnly"/>
</grid>
<form name="EditExample" type="single" target="updateExample" title="" default-map-name="example" default-entity-name="Example">
<actions>
<entity-one entity-name="StatusItem" value-field="currentStatus" auto-field-map="false">
<field-map field-name="statusId" from-field="example.statusId"/>
</entity-one>
<set field="anotherText" from-field="example.anotherText"/>
</actions>
<alt-target use-when="example==null" target="createExample"/>
<auto-fields-service service-name="updateExample"/>
<field use-when="example!=null" name="exampleId" title="${uiLabelMap.ExampleExampleId}"><display/></field>
<field use-when="example==null @and exampleId==null" name="exampleId" title="${uiLabelMap.ExampleExampleId}"><ignored/></field>
<field use-when="example==null @and exampleId!=null" name="exampleId" title="${uiLabelMap.ExampleExampleId}"><display description="${uiLabelMap.CommonCannotBeFound}: [${exampleId}]" also-hidden="false"/></field>
<field name="exampleTypeId" title="${uiLabelMap.CommonType}" id-name="exampleTypeId" required-field="true">
<drop-down allow-empty="false">
<!-- this is a neat feature, but not good for the type because the user would have to know the possible types in order to enter at least the first letter, so leaving it out by default; just uncomment to enable: <auto-complete/> -->
<entity-options entity-name="ExampleType">
<entity-order-by field-name="description"/>
</entity-options>
</drop-down>
</field>
<field name="statusId" use-when="example==null" title="${uiLabelMap.CommonStatus}" required-field="true">
<drop-down allow-empty="false">
<entity-options entity-name="ExampleStatusItem"/>
</drop-down>
</field>
<field name="statusId" use-when="example!=null" title="${uiLabelMap.CommonStatus}" required-field="true">
<drop-down allow-empty="false" current="first-in-list" current-description="${currentStatus.description}">
<option key="${currentStatus.statusId}" description="${currentStatus.description}"/>
<entity-options entity-name="StatusValidChangeToDetail" key-field-name="statusIdTo" description="${transitionName} (${description})">
<entity-constraint name="statusId" env-name="example.statusId"/>
</entity-options>
</drop-down>
</field>
<field name="exampleName" title="${uiLabelMap.FormFieldTitle_exampleName}" required-field="true"><text /></field>
<field name="description" title="${uiLabelMap.CommonDescription}"/>
<field name="longDescription" title="${uiLabelMap.ExampleLongDescription}"/>
<field name="anotherText">
<drop-down allow-empty="true">
<option key="Explicit Option" description="${uiLabelMap.ExampleExplicitOption}"/>
<entity-options entity-name="ExampleType" key-field-name="exampleTypeId">
<entity-order-by field-name="description"/>
</entity-options>
</drop-down>
</field>
<field name="displayAnotherText" use-when="anotherText!=null">
<display description="${example.anotherText}"/>
</field>
<field name="submitButton" use-when="example==null" title="${uiLabelMap.CommonCreate}"><submit button-type="button"/></field>
<field name="submitButton" use-when="example!=null" title="${uiLabelMap.CommonUpdate}"><submit button-type="button"/></field>
</form>
<!-- Typically, this extended form wouldn't be necessary. The parent form (EditExample) would
have these settings. -->
<form name="EditExampleBackgroundSubmit" type="single" extends="EditExample" target="updateExampleAjax">
<alt-target use-when="ajaxExample==null" target="createExampleAjax"/>
<field name="statusId" use-when="ajaxExample==null" title="${uiLabelMap.CommonStatus}" id-name="statusId">
<drop-down allow-empty="false">
<entity-options entity-name="ExampleStatusItem"/>
</drop-down>
</field>
<on-event-update-area event-type="submit" area-id="ListExamplesAjax" area-target="ListExampleFormOnly"/>
<!--on-event-update-area event-type="submit" area-id="EditExampleAjax" area-target="CreateExampleFormOnly"/--><!-- JLR: this does not seem to be useful -->
</form>
<!-- ExampleItem -->
<grid name="ListExampleItems" list-name="exampleItems" target="updateExampleItem">
<actions>
<entity-condition entity-name="ExampleItem">
<condition-expr field-name="exampleId" from-field="exampleId"/>
<order-by field-name="exampleItemSeqId"/>
</entity-condition>
</actions>
<auto-fields-service service-name="updateExampleItem"/>
<field name="exampleId"><hidden/></field>
<field name="exampleItemSeqId" title="${uiLabelMap.CommonItem}"><display/></field>
<field name="description"><text size="30"/></field>
<field name="amountUomId" title="${uiLabelMap.CommonUom}">
<drop-down allow-empty="true">
<entity-options entity-name="UomAndType" key-field-name="uomId" description="${typeDescription}: ${description} (${abbreviation})">
<entity-order-by field-name="typeDescription"/>
<entity-order-by field-name="description"/>
</entity-options>
</drop-down>
</field>
<field name="deleteLink" title=" " widget-style="buttontext">
<hyperlink description="${uiLabelMap.CommonDelete}" target="deleteExampleItem" also-hidden="false" confirmation-message="${uiLabelMap.CommonConfirmDelete}" image-location="${iconsLocation}/delete.png">
<parameter param-name="exampleId"/>
<parameter param-name="exampleItemSeqId"/>
</hyperlink>
</field>
<field name="submitButton" title="${uiLabelMap.CommonUpdate}"><submit button-type="button"/></field>
</grid>
<form name="AddExampleItem" type="single" target="createExampleItem" title="">
<auto-fields-service service-name="createExampleItem"/>
<field name="exampleId"><hidden/></field>
<field name="exampleItemSeqId"><ignored/><!-- this will be auto-sequenced --></field>
<field name="amountUomId" title="${uiLabelMap.CommonUom}">
<drop-down allow-empty="true">
<entity-options entity-name="UomAndType" key-field-name="uomId" description="${typeDescription}: ${description} (${abbreviation})">
<entity-order-by field-name="typeDescription"/>
<entity-order-by field-name="description"/>
</entity-options>
</drop-down>
</field>
<field name="submitButton" title="${uiLabelMap.CommonAdd}"><submit button-type="button" request-confirmation="true"/></field>
</form>
<!-- ExampleFeatureAppl -->
<grid name="ListExampleFeatureAppls" list-name="exampleFeatureAppls" target="example_updateExampleFeatureAppl">
<actions>
<entity-condition entity-name="ExampleFeatureAppl">
<condition-expr field-name="exampleId" from-field="exampleId"/>
<order-by field-name="sequenceNum"/>
</entity-condition>
</actions>
<auto-fields-service service-name="updateExampleFeatureAppl"/>
<field name="exampleId"><hidden/></field>
<field name="exampleFeatureId" title="${uiLabelMap.ExampleFeature}">
<display-entity entity-name="ExampleFeature">
<sub-hyperlink target="EditExampleFeature" description="${exampleFeatureId}" link-style="buttontext">
<parameter param-name="exampleFeatureId"/>
</sub-hyperlink>
</display-entity>
</field>
<field name="fromDate"><display/></field>
<field name="exampleFeatureApplTypeId" title="${uiLabelMap.CommonType}">
<drop-down allow-empty="false">
<entity-options entity-name="ExampleFeatureApplType">
<entity-order-by field-name="description"/>
</entity-options>
</drop-down>
</field>
<field name="submitButton" title="${uiLabelMap.CommonUpdate}"><submit button-type="button"/></field>
<field name="deleteLink" title=" " widget-style="buttontext">
<hyperlink description="${uiLabelMap.CommonDelete}" target="example_deleteExampleFeatureAppl" also-hidden="false" image-location="${iconsLocation}/delete.png">
<parameter param-name="exampleId"/>
<parameter param-name="exampleFeatureId"/>
<parameter param-name="fromDate"/>
</hyperlink>
</field>
</grid>
<form name="AddExampleFeatureAppl" type="single" target="example_createExampleFeatureAppl" title="">
<auto-fields-service service-name="createExampleFeatureAppl"/>
<field name="exampleId"><hidden/></field>
<field name="exampleFeatureId" title="${uiLabelMap.ExampleFeature}">
<lookup target-form-name="LookupExampleFeature"/>
</field>
<field name="exampleFeatureApplTypeId" title="${uiLabelMap.CommonType}">
<drop-down allow-empty="false">
<entity-options entity-name="ExampleFeatureApplType">
<entity-order-by field-name="description"/>
</entity-options>
</drop-down>
</field>
<field name="submitButton" title="${uiLabelMap.CommonAdd}"><submit button-type="button"/></field>
</form>
<form name="SetExamplePdfPassword" type="single" target="ExampleReportPdf" title="">
<field name="exampleId"><hidden/></field>
<field name="ownerPassword" title="${uiLabelMap.PDFOwnerPassword}"><text size="15" maxlength="250"/></field>
<field name="userPassword" title="${uiLabelMap.PDFUserPassword}"><text size="15" maxlength="250"/></field>
<field name="allowPrint" title="${uiLabelMap.PDFAllowPrint}">
<drop-down>
<option key="true" description="${uiLabelMap.CommonTrue}"/>
<option key="false" description="${uiLabelMap.CommonFalse}"/>
</drop-down>
</field>
<field name="allowCopyContent" title="${uiLabelMap.PDFAllowCopyContent}">
<drop-down>
<option key="true" description="${uiLabelMap.CommonTrue}"/>
<option key="false" description="${uiLabelMap.CommonFalse}"/>
</drop-down>
</field>
<field name="allowEditContent" title="${uiLabelMap.PDFAllowEditContent}">
<drop-down>
<option key="true" description="${uiLabelMap.CommonTrue}"/>
<option key="false" description="${uiLabelMap.CommonFalse}"/>
</drop-down>
</field>
<field name="allowEditAnnotations" title="${uiLabelMap.PDFAllowEditAnnotations}">
<drop-down>
<option key="true" description="${uiLabelMap.CommonTrue}"/>
<option key="false" description="${uiLabelMap.CommonFalse}"/>
</drop-down>
</field>
<field name="allowFillInForms" title="${uiLabelMap.PDFAllowFillInForms}">
<drop-down>
<option key="true" description="${uiLabelMap.CommonTrue}"/>
<option key="false" description="${uiLabelMap.CommonFalse}"/>
</drop-down>
</field>
<field name="allowAccessContent" title="${uiLabelMap.PDFAllowAccessContent}">
<drop-down>
<option key="true" description="${uiLabelMap.CommonTrue}"/>
<option key="false" description="${uiLabelMap.CommonFalse}"/>
</drop-down>
</field>
<field name="allowAssembleDocument" title="${uiLabelMap.PDFAllowAssembleDocument}">
<drop-down>
<option key="true" description="${uiLabelMap.CommonTrue}"/>
<option key="false" description="${uiLabelMap.CommonFalse}"/>
</drop-down>
</field>
<field name="allowPrintHq" title="${uiLabelMap.PDFAllowPrintHq}">
<drop-down>
<option key="true" description="${uiLabelMap.CommonTrue}"/>
<option key="false" description="${uiLabelMap.CommonFalse}"/>
</drop-down>
</field>
<field name="encrypt-metadata" title="${uiLabelMap.PDFEncryptMetadata}">
<drop-down>
<option key="true" description="${uiLabelMap.CommonTrue}"/>
<option key="false" description="${uiLabelMap.CommonFalse}"/>
</drop-down>
</field>
<field name="encryption-length" title="${uiLabelMap.PDFEncryptionLength}"><text size="15"/></field>
<field name="submitButton" title="${uiLabelMap.ExampleGeneratePDF}"><submit button-type="button"/></field>
</form>
</forms>