ilscipio/scipio-erp

View on GitHub
applications/marketing/widget/sfa/forms/LeadForms.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="createLead" type="single" target="createLead" header-row-style="header-row" default-map-name="contactDetailMap"> <!-- 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="groupName"><text/></field>
        <field name="title"><text/></field>
        <field name="numEmployees" title="${uiLabelMap.MarketingNoOfEmployees}"><text size="30"/></field>
        <field name="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}"><text size="50" maxlength="60"/></field>
        <field name="address2" title="${uiLabelMap.CommonAddress2}"><text size="50" maxlength="60"/></field>
        <field name="city"><text size="30" maxlength="60"/></field>
        <field name="stateProvinceGeoId" title="${uiLabelMap.CommonState}">
            <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}"><text size="10" maxlength="30"/></field>
        <field name="countryGeoId" title="${uiLabelMap.FormFieldTitle_country}">
            <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="leadSourceTitle" title="${uiLabelMap.SfaLeadSource}" title-area-style="group-label"><display/></field>
        <field name="dataSourceId" title="${uiLabelMap.SfaLeadSource}">
            <drop-down allow-empty="true">
                <entity-options entity-name="DataSource" key-field-name="dataSourceId" description="${dataSourceId} - ${description}">
                    <entity-constraint name="dataSourceTypeId" operator="equals" value="LEAD_SOURCE"/>
                    <entity-order-by field-name="description"/>
                </entity-options>
            </drop-down>
        </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_update}"><submit button-type="button"/></field>
    </form>

    <form name="ConvertLead" type="single" target="convertLead">
        <field name="partyId"><hidden value="${parameters.partyId}"/></field>
        <field name="leadId" entry-name="partyId" title="${uiLabelMap.SfaCreateContactForLead}">
            <display-entity also-hidden="false" entity-name="PartyNameView" key-field-name="partyId" description="${groupName}${firstName} ${lastName} [${parameters.partyId}]"/>
        </field>
        <field name="partyGroupId" title="${uiLabelMap.SfaCreateAccountForLead}" use-when="parameters.get(&quot;partyGroupId&quot;)!=&quot;&quot;">
            <display-entity also-hidden="true" entity-name="PartyNameView" key-field-name="partyId" description="${groupName}${firstName} ${lastName} [${parameters.partyGroupId}]"/>
        </field>
        <field name="partyGroupId" title="${uiLabelMap.SfaAccountName}" tooltip="${uiLabelMap.SfaSelectExistingAccountOrLeaveBlankToCreateNew}" use-when="parameters.get(&quot;partyGroupId&quot;)==&quot;&quot;">
            <drop-down allow-empty="true" current-description="">
              <entity-options entity-name="PartyRole" description="${groovy:org.ofbiz.party.party.PartyHelper.getPartyName(delegator, partyId, false)} : [partyId]" key-field-name="partyId">
                  <entity-constraint name="roleTypeId" operator="equals" value="ACCOUNT"/>
              </entity-options>
            </drop-down>
        </field>
        <field name="submitAction" widget-style="${styles.link_run_sys} ${styles.action_update}"><submit button-type="button"/></field>
    </form>

    <form name="MergeLeads" type="single" target="MergeLeads">
        <actions>
            <set field="roleTypeId" value="LEAD"/>
            <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="lead.partyId" list-entry-name="lead" description="${groovy:org.ofbiz.party.party.PartyHelper.getPartyName(delegator, 'partyId', false)} ${lead.partyId}"/>
            </drop-down>
        </field>
        <field name="partyIdFrom" title="${uiLabelMap.AccountingFromParty}" position="2">
            <drop-down allow-empty="false">
               <list-options list-name="partyList" key-name="lead.partyId" list-entry-name="lead" description="${groovy:org.ofbiz.party.party.PartyHelper.getPartyName(delegator, 'partyId', false)} ${lead.partyId}"/>
            </drop-down>
        </field>
        <field name="submitAction" position="3" title="${uiLabelMap.SfaMergeLeads}" widget-style="${styles.link_run_sys} ${styles.action_update}" tooltip-style="button-text"><submit button-type="text-link"/></field>
    </form>

    <form name="NewLeadFromVCard" type="upload" target="createLeadFromVCard" 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="createLead"/></field>
        <field name="submitAction" title="${uiLabelMap.CommonUpload}" widget-style="${styles.link_run_sys} ${styles.action_import}"><submit button-type="button"/></field>
    </form>

    <form name="QuickAddLead" type="single" target="quickAddLead" attribs="{'fieldsType':'default-compact'}">
        <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="groupName" title="${uiLabelMap.CommonGroup}"><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>
    <form name="AddLeadPartyDataSource" type="single" target="createLeadPartyDataSource">
        <auto-fields-service service-name="createPartyDataSource"/>
        <field name="partyId"><hidden/></field>
        <field name="dataSourceId" title="${uiLabelMap.SfaLeadSource}">
            <drop-down allow-empty="true">
                <entity-options entity-name="DataSource" key-field-name="dataSourceId" description="${dataSourceId} - ${description}">
                    <entity-constraint name="dataSourceTypeId" operator="equals" value="LEAD_SOURCE"/>
                    <entity-order-by field-name="dataSourceId"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="submitAction" title="${uiLabelMap.CommonAdd}" widget-style="${styles.link_run_sys} ${styles.action_add}"><submit button-type="button"/></field>
    </form>
    <form name="ViewLeadPartyDataSources" type="list" list-name="partyDataSources" 
        odd-row-style="alternate-row" header-row-style="header-row-2"> <!-- orig: default-table-style=-style="basic-table hover-bar" -->
        <field name="partyId"><hidden/></field>
        <field name="dataSourceId" title="${uiLabelMap.SfaLeadSource}">
            <display-entity entity-name="DataSource"/>
        </field>
        <field name="fromDate" title="${uiLabelMap.CommonFrom}" ><display/></field>
    </form>

    <form name="FindLeads" target="${currentUrl}" extends="FindAccounts" extends-resource="component://marketing/widget/sfa/forms/AccountForms.xml">
        <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="groupName"/>
            <sort-field name="contactMechTypeId"/>
            <sort-field name="contactMechContainer"/>
            <sort-field name="submitAction"/>
        </sort-order>
    </form>

    <form name="listLeads" paginate-target="${currentUrl}"
            extends="listAccountsCommon" extends-resource="component://marketing/widget/sfa/forms/AccountForms.xml"><!-- SCIPIO: Fixed listAccounts -> listAccountsCommon (new) -->
        <actions>
            <set field="roleTypeIdFrom" value="OWNER"/>
            <set field="roleTypeIdTo" value="LEAD"/>
            <set field="relatedCompanyRoleTypeIdTo" value="LEAD"/>
            <set field="relatedCompanyRoleTypeIdFrom" value="ACCOUNT_LEAD"/>
            <set field="relatedCompanyRelationshipTypeId" value="EMPLOYMENT"/>
            <set field="parameters.statusId" value="PARTY_DISABLED"/>
            <set field="parameters.statusId_op" value="notEqual"/>
            <set field="partyRelationshipTypeId" value="LEAD_OWNER"/>
            <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="ListLeads" extends="listLeads">
        <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="assignToMe"/>
        </sort-order>
    </form>
    <form name="ListMyLeads" extends="ListLeads">
        <actions>
            <set field="relatedCompanyRoleTypeIdTo" value="LEAD"/>
            <set field="relatedCompanyRoleTypeIdFrom" value="ACCOUNT_LEAD"/>
            <set field="relatedCompanyRelationshipTypeId" value="EMPLOYMENT"/>
            <set field="parameters.partyIdFrom" from-field="userLogin.partyId"/>
            <set field="parameters.roleTypeIdTo" value="LEAD"/>
            <set field="parameters.partyStatusId" value="PARTY_DISABLED"/>
            <set field="parameters.partyStatusId_op" value="notEqual"/>
            <set field="parameters.partyRelationshipTypeId" value="LEAD_OWNER"/>
            <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="AddRelatedCompany" type="single" target="createPartyRelationship">
        <field name="roleTypeIdTo"><hidden value="LEAD"/></field>
        <field name="roleTypeIdFrom"><hidden value="ACCOUNT_LEAD"/></field>
        <field name="partyRelationshipTypeId"><hidden value="EMPLOYMENT"/></field>
        <field name="partyIdTo"><hidden value="${parameters.partyId}"/></field>
        <field name="partyIdFrom" title="${uiLabelMap.PartyRelatedCompany}"><lookup target-form-name="LookupAccountLeads"/></field>
        <field name="submitAction" title="${uiLabelMap.CommonAdd}" widget-style="${styles.link_run_sys} ${styles.action_add}"><submit button-type="button"/></field>
    </form>
</forms>