ilscipio/scipio-erp

View on GitHub
applications/marketing/widget/sfa/forms/AccountForms.xml

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is subject to the terms and conditions defined in the
files 'LICENSE' and 'NOTICE', which are part of this source
code package.
-->

<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd">

    <form name="NewAccount" type="single" target="createAccount" header-row-style="header-row"> <!-- orig: default-table-style=-style="basic-table" -->
        <field name="accountType"><hidden value="${accountType}"/></field>
        <field name="groupName" title="${uiLabelMap.PartyGroupName}" required-field="true">
            <text size="30" maxlength="60"/>
        </field>
        <field name="numEmployees" title="${uiLabelMap.MarketingNoOfEmployees}"><text size="30"/></field>
        <field name="siteName" title="${uiLabelMap.FormFieldTitle_officeSiteName}"><text size="30" maxlength="60"/></field>
        <field name="postalAddressTitle" title="${uiLabelMap.PartyGeneralCorrespondenceAddress}" title-area-style="group-label">
            <display description=" " also-hidden="false"/>
        </field>
        <field name="address1" title="${uiLabelMap.CommonAddress1}" required-field="true">
            <text size="50" maxlength="60"/>
        </field>
        <field name="address2" title="${uiLabelMap.CommonAddress2}"><text size="50" maxlength="60"/></field>
        <field name="city" required-field="true">
            <text size="30" maxlength="60"/>
        </field>
        <field name="stateProvinceGeoId" title="${uiLabelMap.CommonState}" required-field="true">
            <drop-down allow-empty="true">
                <entity-options entity-name="Geo" key-field-name="geoId" description="${geoName} - ${geoId}">
                    <entity-constraint name="geoTypeId" operator="in" value="STATE,PROVINCE"/>
                    <entity-order-by field-name="geoName"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="postalCode" title="${uiLabelMap.CommonZipPostalCode}" required-field="true">
            <text size="10" maxlength="30"/>
        </field>
        <field name="stateProvinceGeoId" title="${uiLabelMap.CommonState}" required-field="true"><drop-down allow-empty="false"/></field>
        <field name="countryGeoId" title="${uiLabelMap.CommonCountry}" required-field="true">
            <drop-down no-current-selected-key="${defaultCountryGeoId}">
                <entity-options entity-name="Geo" key-field-name="geoId" description="${geoName} - ${geoId}">
                    <entity-constraint name="geoTypeId" value="COUNTRY"/>
                    <entity-order-by field-name="geoName"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="phoneTitle" title="${uiLabelMap.PartyPrimaryPhone}" title-area-style="group-label"><display/></field>
        <field name="countryCode" title="${uiLabelMap.CommonCountryCode}"><text size="4" maxlength="10"/></field>
        <field name="areaCode" title="${uiLabelMap.PartyAreaCode}"><text size="4" maxlength="10"/></field>
        <field name="contactNumber" title="${uiLabelMap.PartyPhoneNumber}"><text size="15" maxlength="15"/></field>
        <field name="extension" title="${uiLabelMap.PartyContactExt}"><text size="6" maxlength="10"/></field>
        <field name="emailAddressTitle" title="${uiLabelMap.PartyEmailAddress}" title-area-style="group-label"><display/></field>
        <field name="emailAddress" title="${uiLabelMap.CommonEmail}"><text size="50" maxlength="60"/></field>
        <field name="submitAction" title="${uiLabelMap.CommonSave}" widget-style="${styles.link_run_sys} ${styles.action_update}"><submit button-type="button"/></field>
    </form>

    <form name="FindAccounts" id="FindAccounts" target="${currentUrl}" title="" type="single" default-map-name="parameters"
        header-row-style="header-row"> <!-- orig: default-table-style=-style="basic-table" -->
        <field name="all"><hidden/></field>
        <field name="partyId" title="${uiLabelMap.PartyPartyId}"><text-find/></field>
        <field name="groupName" title="${uiLabelMap.PartyPartyGroupName}"><text-find/></field>
        <field name="contactMechTypeId" event="onchange" action="javascript:ajaxUpdateAreas('contactMechContainer,ContactMechTypeOnly,contactMechTypeId=' + this.value);">
            <drop-down>
                <option key="" description="${uiLabelMap.CommonNone}"/>
                <entity-options entity-name="ContactMechType" key-field-name="contactMechTypeId" description="${description}"/>
            </drop-down>
        </field>
        <field name="contactMechContainer" id-name="contactMechContainer" title=" " ><container/></field>
        <field name="noConditionFind"><hidden value="Y"/><!-- if this isn't there then with all fields empty no query will be done --></field>
        <field name="submitAction" title="${uiLabelMap.CommonFind}" widget-style="${styles.link_run_sys} ${styles.action_find}">
            <submit button-type="button"/>
        </field>
    </form>
    <!-- SCIPIO: 2019-06-19: refactored listAccounts into listAccounts + listAccountsCommon because extending forms wish to make a different actions query -->
    <form name="listAccounts" extends="listAccountsCommon">
        <actions>
            <set field="roleTypeIdFrom" value="OWNER"/>
            <set field="roleTypeIdTo" value="ACCOUNT"/>
            <set field="relatedCompanyRoleTypeIdTo" value="ACCOUNT"/>
            <set field="relatedCompanyRoleTypeIdFrom" value="ACCOUNT"/>
            <set field="parameters.statusId" value="PARTY_DISABLED"/>
            <set field="parameters.statusId_op" value="notEqual"/>
            <set field="partyRelationshipTypeId" value="ACCOUNT"/>
            <set field="parameters.roleTypeId" from-field="roleTypeIdTo"/>
            <set field="fieldList" value="${groovy:['partyId','roleTypeId']}" type="List"/>
            <service service-name="performFind">
                <field-map field-name="inputFields" from-field="parameters"/>
                <field-map field-name="entityName" value="PartyRoleAndContactMechDetail"/>
                <field-map field-name="orderBy" value="partyId"/>
                <field-map field-name="distinct" value="Y"/>
            </service>
        </actions>
    </form>
    <form name="listAccountsCommon" paginate-target="${currentUrl}" type="list" list-name="listIt"
        odd-row-style="alternate-row" header-row-style="header-row-2" separate-columns="true">
        <row-actions>
            <entity-one entity-name="Party" value-field="party" use-cache="true"/>
            <set field="partyName" value="${groovy:org.ofbiz.party.party.PartyHelper.getPartyName(party, true)}"/>
            <entity-and entity-name="PartyAndContactMech" list="emailAddresses" filter-by-date="true">
                <field-map field-name="partyId"/>
                <field-map field-name="contactMechTypeId" value="EMAIL_ADDRESS"/>
            </entity-and>
            <entity-and entity-name="PartyAndContactMech" list="telecomNumbers" filter-by-date="true">
                <field-map field-name="partyId"/>
                <field-map field-name="contactMechTypeId" value="TELECOM_NUMBER"/>
            </entity-and>
            <set field="telecomNumber" from-field="telecomNumbers[0]" type="Object"/>
            <entity-and entity-name="PartyAndContactMech" list="postalAddresses" filter-by-date="true">
                <field-map field-name="partyId"/>
                <field-map field-name="contactMechTypeId" value="POSTAL_ADDRESS"/>
            </entity-and>
            <set field="postalAddress" from-field="postalAddresses[0]" type="Object"/>
            <entity-and entity-name="PartyRelationship" list="existRelationships" filter-by-date="true">
                <field-map field-name="roleTypeIdTo"/>
                <field-map field-name="partyRelationshipTypeId"/>
                <field-map field-name="partyIdFrom" from-field="userLogin.partyId"/>
                <field-map field-name="partyIdTo" from-field="partyId"/>
            </entity-and>
            <set field="countryGeoId" from-field="postalAddress.paCountryGeoId"/>
            <entity-and entity-name="PartyRelationship" list="relatedCompanies" filter-by-date="true">
                <field-map field-name="partyIdTo" from-field="partyId"/>
                <field-map field-name="roleTypeIdFrom" from-field="relatedCompanyRoleTypeIdFrom"/>
                <field-map field-name="roleTypeIdTo" from-field="relatedCompanyRoleTypeIdTo"/>
                <field-map field-name="partyRelationshipTypeId" from-field="relatedCompanyRelationshipTypeId"/>
            </entity-and>
            <set field="relatedCompanyPartyId" from-field="relatedCompanies[0].partyIdFrom" type="Object"/>
            <set field="existRelationship" from-field="existRelationships[0]"/>
        </row-actions>
        <field name="partyId" title="${uiLabelMap.PartyPartyId}" widget-style="${styles.link_nav_info_idname} ${styles.action_view}">
            <hyperlink target="viewprofile" description="${partyName} [${partyId}]" >
                <parameter param-name="partyId"/>
                <parameter param-name="roleTypeId"/>
            </hyperlink>
        </field>
        <field name="emailAddress"><display description="${emailAddresses[0].infoString}"/></field>
        <field name="telecomNumber" title="${uiLabelMap.PartyPhoneNumber}">
            <display description="${telecomNumber.tnCountryCode} ${telecomNumber.tnAreaCode} ${telecomNumber.tnContactNumber} ${telecomNumber.tnAskForName}"/>
        </field>
        <field name="city"><display description="${postalAddress.paCity}"/></field>
        <field name="countryGeoId" title="${uiLabelMap.FormFieldTitle_country}">
            <display-entity entity-name="Geo" description="${geoName}" key-field-name="geoId"/>
        </field>
        <field name="relatedCompany" use-when="relatedCompanyPartyId!=null" title="${uiLabelMap.PartyRelatedCompany}" widget-style="${styles.link_nav_info_idname} ${styles.action_view}">
            <hyperlink target="viewprofile" description="${groovy:org.ofbiz.party.party.PartyHelper.getPartyName(delegator,relatedCompanyPartyId,true);} [${relatedCompanyPartyId}]">
                <parameter param-name="partyId" from-field="relatedCompanyPartyId"/>
            </hyperlink>
        </field>
        <field name="relatedCompany" use-when="relatedCompanyPartyId==null" title="${uiLabelMap.PartyRelatedCompany}"><display/></field>
    </form>
    <form name="ListAccounts" extends="listAccounts">
        <field name="assignToMe" use-when="existRelationship==null&amp;&amp;!&quot;false&quot;.equals(parameters.get(&quot;all&quot;))"
                title="${uiLabelMap.SfaAssignToMe}" widget-style="${styles.link_run_sys} ${styles.action_update}">
            <hyperlink target="createPartyRelationshipAndRole" description="${uiLabelMap.SfaAssignToMe}">
                <parameter param-name="partyIdFrom" from-field="userLogin.partyId"/>
                <parameter param-name="roleTypeIdFrom"/>
                <parameter param-name="roleTypeIdTo"/>
                <parameter param-name="partyRelationshipTypeId"/>
                <parameter param-name="partyIdTo" from-field="partyId"/>
            </hyperlink>
        </field>
        <field name="relatedCompany"><hidden/></field>
        <sort-order>
            <sort-field name="partyId"/>
            <sort-field name="emailAddress"/>
            <sort-field name="telecomNumber"/>
            <sort-field name="city"/>
            <sort-field name="countryGeoId"/>
            <sort-field name="assignToMe"/>
            <sort-field name="relatedCompany"/>
        </sort-order>
    </form>
    <form name="ListMyAccounts" extends="ListAccounts">
        <actions>
            <set field="parameters.partyIdFrom" from-field="userLogin.partyId"/>
            <set field="parameters.roleTypeIdFrom" value="OWNER"/>
            <set field="parameters.roleTypeIdTo" value="ACCOUNT"/>
            <set field="parameters.partyStatusId" value="PARTY_DISABLED"/>
            <set field="parameters.partyStatusId_op" value="notEqual"/>
            <set field="parameters.partyRelationshipTypeId" value="ACCOUNT"/>
            <set field="fieldList" value="${groovy:['partyIdFrom','partyId']}" type="List"/>
            <service service-name="performFind">
                <field-map field-name="inputFields" from-field="parameters"/>
                <field-map field-name="entityName" value="PartyRelationshipAndContactMechDetail"/>
                <field-map field-name="orderBy" value="partyId"/>
                <field-map field-name="distinct" value="Y"/>
            </service>
        </actions>
        <field name="assignToMe"><hidden/></field>
    </form>

    <form name="FindPostalAddress" type="single">
        <field name="paToName" title="${uiLabelMap.PartyAddrToName}"><text-find/></field>
        <field name="paAttnName" title="${uiLabelMap.PartyAddrAttnName}"><text-find/></field>
        <field name="paAddress1" title="${uiLabelMap.FormFieldTitle_paAddress1}"><text-find/></field>
        <field name="paAddress2" title="${uiLabelMap.FormFieldTitle_paAddress2}"><text-find/></field>
        <field name="paCity" title="${uiLabelMap.FormFieldTitle_city}"><text-find/></field>
        <field name="paStateProvinceGeoId" title="${uiLabelMap.FormFieldTitle_stateProvince}">
            <drop-down allow-empty="true">
                <list-options key-name="geoId" description="${geoName}" list-name="states"/>
            </drop-down>
        </field>
        <field name="paPostalCode"><text-find/></field>
        <field name="paCountryGeoId" title="${uiLabelMap.CommonCountry}">
            <drop-down allow-empty="true">
                <list-options key-name="geoId" description="${geoName}" list-name="countries"/>
            </drop-down>
        </field>
    </form>
    <form name="FindTelecomNumber" type="single">
        <field name="tnCountryCode" title="${uiLabelMap.CommonCountryCode}"><text-find/></field>
        <field name="tnAreaCode" title="${uiLabelMap.PartyAreaCode}"><text-find/></field>
        <field name="tnContactNumber" title="${uiLabelMap.PartyContactNumber}"><text-find/></field>
        <field name="tnExtension" title="${uiLabelMap.PartyExtension}"><text-find/></field>
    </form>
    <form name="FindInfoStringContactMech" type="single">
        <actions>
            <entity-one entity-name="ContactMechType" value-field="contactMechType">
                <field-map field-name="contactMechTypeId" from-field="parameters.contactMechTypeId"/>
            </entity-one>
        </actions>
        <field name="infoString" title="${contactMechType.description}"><text-find/></field>
    </form>

    <form name="listAccountLeads" extends="listAccountsCommon"><!-- SCIPIO: Fixed listAccounts -> listAccountsCommon (new) -->
        <actions>
            <set field="roleTypeIdTo" value="ACCOUNT_LEAD"/>
            <set field="parameters.statusId" value="PARTY_DISABLED"/>
            <set field="parameters.statusId_op" value="notEqual"/>
            <set field="partyRelationshipTypeId" value="ACCOUNT"/>
            <set field="parameters.roleTypeId" from-field="roleTypeIdTo"/>
            <set field="fieldList" value="${groovy:['partyId','roleTypeId']}" type="List"/>
            <service service-name="performFind">
                <field-map field-name="inputFields" from-field="parameters"/>
                <field-map field-name="entityName" value="PartyRoleAndContactMechDetail"/>
                <field-map field-name="orderBy" value="partyId"/>
                <field-map field-name="distinct" value="Y"/>
            </service>
        </actions>
    </form>
</forms>