ilscipio/scipio-erp

View on GitHub
applications/marketing/widget/sfa/forms/ContactForms.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="FindContacts" target="${currentUrl}" extends="FindAccounts" extends-resource="component://marketing/widget/sfa/forms/AccountForms.xml">
        <field name="groupName"><hidden/></field>
        <field name="firstName" title="${uiLabelMap.PartyFirstName}"><text-find/></field>
        <field name="lastName" title="${uiLabelMap.PartyLastName}"><text-find/></field>
        <sort-order>
            <sort-field name="all"/>
            <sort-field name="groupName"/>
            <sort-field name="noConditionFind"/>
            <sort-field name="partyId"/>
            <sort-field name="firstName"/>
            <sort-field name="lastName"/>
            <sort-field name="contactMechTypeId"/>
            <sort-field name="contactMechContainer"/>
            <sort-field name="submitAction"/>
        </sort-order>
    </form>
    <form name="ListContacts" paginate-target="${currentUrl}"
            extends="listAccountsCommon" extends-resource="component://marketing/widget/sfa/forms/AccountForms.xml"><!-- SCIPIO: Fixed listAccounts -> listAccountsCommon (new) -->
        <actions>
            <set field="roleTypeIdFrom" value="ACCOUNT"/>
            <set field="roleTypeIdTo" value="CONTACT"/>
            <set field="partyRelationshipTypeId" value="EMPLOYMENT"/>
            <set field="relatedCompanyRoleTypeIdTo" value="CONTACT"/>
            <set field="relatedCompanyRoleTypeIdFrom" value="ACCOUNT"/>
            <set field="relatedCompanyRelationshipTypeId" value="EMPLOYMENT"/>
            <set field="parameters.roleTypeId" from-field="roleTypeIdTo"/>
            <set field="parameters.statusId" value="PARTY_DISABLED"/>
            <set field="parameters.statusId_op" value="notEqual"/>
            <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>
        <!-- SCIPIO: Commneted out for now -->
      <!--   <field name="export" title="${uiLabelMap.SfaVCard}" widget-style="${styles.link_run_sys} ${styles.action_export}">
            <hyperlink target="createVCardFromContact" description="${uiLabelMap.SfaVCard}">
                <parameter param-name="partyId"/>
            </hyperlink>
        </field> -->
        <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>
        <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="relatedCompany"/>
            <sort-field name="export"/>
            <sort-field name="assignToMe"/>
        </sort-order>
    </form>
    <form name="ListMyContacts" extends="ListContacts">
        <actions>
            <set field="relatedCompanyRoleTypeIdTo" value="CONTACT"/>
            <set field="relatedCompanyRoleTypeIdFrom" value="ACCOUNT"/>
            <set field="relatedCompanyRelationshipTypeId" value="EMPLOYMENT"/>
            <set field="parameters.partyIdFrom" from-field="userLogin.partyId"/>
            <set field="parameters.roleTypeIdTo" value="CONTACT"/>
            <set field="parameters.partyStatusId" value="PARTY_DISABLED"/>
            <set field="parameters.partyStatusId_op" value="notEqual"/>
            <set field="parameters.partyRelationshipTypeId" value="EMPLOYMENT"/>
            <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="NewContact" type="single" target="createContact" header-row-style="header-row"> <!-- orig: default-table-style=-style="basic-table" -->
        <field name="firstName" required-field="true"><text/></field>
        <field name="lastName" required-field="true"><text/></field>
        <field name="suffix"><text/></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" title="${uiLabelMap.CommonCity}" 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="${geoId} - ${geoName}">
                    <entity-constraint name="geoTypeId" operator="in" value="STATE,PROVINCE"/>
                    <entity-order-by field-name="geoId"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="postalCode" title="${uiLabelMap.CommonZipPostalCode}" required-field="true"><text size="10" maxlength="30"/></field>
        <field name="countryGeoId" title="${uiLabelMap.CommonCountry}" required-field="true">
            <drop-down allow-empty="false" no-current-selected-key="${defaultCountryGeoId}">
                <entity-options entity-name="Geo" key-field-name="geoId" description="${geoId}: ${geoName}">
                    <entity-constraint name="geoTypeId" value="COUNTRY"/>
                    <entity-order-by field-name="geoId"/>
                </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="contactListTitle" title="${uiLabelMap.MarketingContactList}" title-area-style="group-label"><display/></field>
        <field name="contactListId" title="${uiLabelMap.MarketingContactList}">
            <drop-down allow-empty="true">
                <entity-options entity-name="ContactList" description="${description}" key-field-name="contactListId"/>
            </drop-down>
        </field>
        <field name="submitAction" title="${uiLabelMap.CommonSave}" widget-style="${styles.link_run_sys} ${styles.action_add}"><submit button-type="button"/></field>
    </form>
    <form name="MergeContacts" type="single" target="MergeContacts">
        <actions>
            <set field="roleTypeId" value="CONTACT"/>
            <set field="partyTypeId" value="PERSON"/>
            <set field="lookupFlag" value="Y"/>
            <service service-name="findParty" auto-field-map="true"/>
        </actions>
        <field name="partyIdTo" title="${uiLabelMap.AccountingToParty}" position="1">
            <drop-down allow-empty="false">
               <list-options list-name="partyList" key-name="contact.partyId" list-entry-name="contact" description="${groovy:org.ofbiz.party.party.PartyHelper.getPartyName(delegator, 'partyId', false)} ${contact.partyId}"/>
            </drop-down>
        </field>
        <field name="partyIdFrom" title="${uiLabelMap.AccountingFromParty}" position="2">
            <drop-down allow-empty="false">
                <list-options list-name="partyList" key-name="contact.partyId" list-entry-name="contact" description="${groovy:org.ofbiz.party.party.PartyHelper.getPartyName(delegator, 'partyId', false)} ${contact.partyId}"/>
            </drop-down>
        </field>
        <field name="submitAction" position="3" title="${uiLabelMap.SfaMergeContacts}" widget-style="${styles.link_run_sys} ${styles.action_update}" tooltip-style="button-text"><submit button-type="text-link"/></field>
    </form>

    <form name="NewContactFromVCard" type="upload" target="createContactFromVCard" header-row-style="header-row"> <!-- orig: default-table-style=-style="basic-table" -->
        <field name="infile" title="${uiLabelMap.SfaUploadVCard}"><file/></field>
        <field name="serviceName"><hidden value="createContact"/></field>
        <field name="submitAction" title="${uiLabelMap.CommonUpload}" widget-style="${styles.link_run_sys} ${styles.action_import}"><submit button-type="button"/></field>
    </form>
    <!-- SCIPIO: 2018-09-12: Moved here from original stock location CommonForms.xml -->
    <form name="ViewPartiesCreatedByVCard" type="list" list-name="partiesCreated">
        <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">
                <field-map field-name="partyId"/>
                <field-map field-name="contactMechTypeId" value="EMAIL_ADDRESS"/>
            </entity-and>
            <entity-and entity-name="PartyAndContactMech" list="telecomNumbers">
                <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">
                <field-map field-name="partyId"/>
                <field-map field-name="contactMechTypeId" value="POSTAL_ADDRESS"/>
            </entity-and>
            <set field="postalAddress" from-field="postalAddresses[0]" type="Object"/>
        </row-actions>
        <field name="partyId" title="${uiLabelMap.PartyPartyId}">
            <hyperlink description="${partyName} [${partyId}]" target="viewprofile" target-window="_blank">
                <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>
    </form>
    <form name="ViewPartiesExistInVCard" type="list" list-name="partiesExist" extends="ViewPartiesCreatedByVCard"/>

    <form name="QuickAddContact" type="single" target="quickAddContact">
        <field name="firstName" title="${uiLabelMap.PartyFirstName}*" required-field="true"><text size="15"/></field>
        <field name="lastName" title="${uiLabelMap.PartyLastName}*" required-field="true"><text size="15"/></field>
        <field name="emailAddress" title="${uiLabelMap.CommonEmail}"><text size="15"/></field>
        <field name="contactListId" title="${uiLabelMap.MarketingContactList}">
            <drop-down allow-empty="true">
                <entity-options entity-name="ContactList" description="${groovy:contactListName.substring(0,Math.min(contactListName.length(), 12))}..." key-field-name="contactListId"/>
            </drop-down>
        </field>
        <field name="quickAdd"><hidden value="Y"/></field>
        <field name="submitAction" widget-style="${styles.link_run_sys} ${styles.action_add}"><submit/></field>
    </form>
</forms>