| <?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. |
| --> |
| |
| <simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods-v2.xsd"> |
| <simple-method short-description="Create Contact" method-name="createContact"> |
| <set field="parameters.roleTypeId" value="CONTACT"/> |
| <if-compare field="parameters.quickAdd" operator="not-equals" value="Y"> |
| <call-simple-method method-name="createPersonRoleAndContactMechs" xml-resource="component://party/script/org/ofbiz/party/party/PartySimpleMethods.xml"/> |
| <else> |
| <call-map-processor processor-name="person" in-map-name="parameters" out-map-name="personCtx" |
| xml-resource="component://party/script/org/ofbiz/party/party/PartyMapProcs.xml"/> |
| <call-service service-name="createPerson" in-map-name="personCtx"> |
| <result-to-field result-name="partyId" field="partyId"/> |
| <result-to-result result-name="partyId" service-result-name="partyId"/> |
| </call-service> |
| <if-not-empty field="parameters.roleTypeId"> |
| <set field="createPartyRoleCtx.partyId" from-field="partyId"/> |
| <set field="createPartyRoleCtx.roleTypeId" from-field="parameters.roleTypeId"/> |
| <call-service service-name="createPartyRole" in-map-name="createPartyRoleCtx"/> |
| </if-not-empty> |
| <if-not-empty field="parameters.emailAddress"> |
| <call-map-processor in-map-name="parameters" out-map-name="emailAddressCtx"> |
| <simple-map-processor name="emailAddress"> |
| <process field="emailAddress"> |
| <copy/><validate-method method="isEmail"><fail-property resource="PartyUiLabels" property="PartyEmailAddressNotFormattedCorrectly"/></validate-method> |
| </process> |
| </simple-map-processor> |
| </call-map-processor> |
| <check-errors/> |
| <set field="emailAddressCtx.partyId" from-field="partyId"/> |
| <set field="emailAddressCtx.contactMechPurposeTypeId" value="PRIMARY_EMAIL"/> |
| <call-service service-name="createPartyEmailAddress" in-map-name="emailAddressCtx"> |
| <result-to-field result-name="contactMechId" field="emailContactMechId"/> |
| <result-to-result result-name="contactMechId" service-result-name="contactMechId"/> |
| </call-service> |
| </if-not-empty> |
| </else> |
| </if-compare> |
| |
| <set field="partyId" from-field="parameters.partyId"/> |
| <set field="partyRelationCtx.partyIdFrom" from-field="userLogin.partyId"/> |
| <set field="partyRelationCtx.partyIdTo" from-field="partyId"/> |
| <set field="partyRelationCtx.roleTypeIdTo" from-field="parameters.roleTypeId"/> |
| <set field="partyRelationCtx.roleTypeIdFrom" value="_NA_"/> |
| <set field="partyRelationCtx.partyRelationshipTypeId" value="CONTACT_REL"/> |
| <call-service service-name="createPartyRelationship" in-map-name="partyRelationCtx"/> |
| <field-to-result field="partyId"/> |
| </simple-method> |
| |
| <simple-method method-name="mergeContacts" short-description="Merge two Contacts"> |
| <set field="partyIdTo" from-field="parameters.partyIdTo"/> |
| <set field="addrContactMechIdTo" from-field="parameters.addrContactMechIdTo"/> |
| <set field="phoneContactMechIdTo" from-field="parameters.phoneContactMechIdTo"/> |
| <set field="emailContactMechIdTo" from-field="parameters.emailContactMechIdTo"/> |
| <set field="partyId" from-field="parameters.partyId"/> |
| <set field="addrContactMechId" from-field="parameters.addrContactMechId"/> |
| <set field="phoneContactMechId" from-field="parameters.phoneContactMechId"/> |
| <set field="emailContactMechId" from-field="parameters.emailContactMechId"/> |
| <set field="infoString" from-field="parameters.infoString"/> |
| <if-compare-field field="partyIdTo" to-field="partyId" operator="not-equals"> |
| <if-compare field="parameters.useAddress2" operator="equals" value="Y"> |
| <if-not-empty field="addrContactMechId"> |
| <if-not-empty field="addrContactMechIdTo"> |
| <set field="updatePartyContactMechCtx.partyId" from-field="partyIdTo"/> |
| <set field="updatePartyContactMechCtx.contactMechTypeId" value="POSTAL_ADDRESS"/> |
| <set field="updatePartyContactMechCtx.contactMechId" from-field="addrContactMechIdTo"/> |
| <set field="updatePartyContactMechCtx.newContactMechId" from-field="addrContactMechId"/> |
| <set field="updatePartyContactMechCtx.contactMechPurposeTypeId" value="GENERAL_LOCATION"/> |
| <call-service service-name="updatePartyContactMech" in-map-name="updatePartyContactMechCtx"/> |
| </if-not-empty> |
| <clear-field field="updatePartyContactMechCtx"/> |
| <set field="deletePartyContactMechCtx.partyId" from-field="partyId"/> |
| <set field="deletePartyContactMechCtx.contactMechId" from-field="addrContactMechId"/> |
| <call-service service-name="deletePartyContactMech" in-map-name="deletePartyContactMechCtx"/> |
| <clear-field field="deletePartyContactMechCtx"/> |
| </if-not-empty> |
| </if-compare> |
| <if-compare field="parameters.useContactNum2" operator="equals" value="Y"> |
| <if-not-empty field="phoneContactMechId"> |
| <if-not-empty field="phoneContactMechIdTo"> |
| <set field="updatePartyContactMechCtx.partyId" from-field="partyIdTo"/> |
| <set field="updatePartyContactMechCtx.contactMechId" from-field="phoneContactMechIdTo"/> |
| <set field="updatePartyContactMechCtx.contactMechTypeId" value="TELECOM_NUMBER"/> |
| <set field="updatePartyContactMechCtx.newContactMechId" from-field="phoneContactMechId"/> |
| <set field="updatePartyContactMechCtx.contactMechPurposeTypeId" value="PRIMARY_PHONE"/> |
| <call-service service-name="updatePartyContactMech" in-map-name="updatePartyContactMechCtx"/> |
| </if-not-empty> |
| <clear-field field="updatePartyContactMechCtx"/> |
| <set field="deletePartyContactMechCtx.partyId" from-field="partyId"/> |
| <set field="deletePartyContactMechCtx.contactMechId" from-field="phoneContactMechId"/> |
| <call-service service-name="deletePartyContactMech" in-map-name="deletePartyContactMechCtx"/> |
| <clear-field field="deletePartyContactMechCtx"/> |
| </if-not-empty> |
| </if-compare> |
| <if-compare field="parameters.useEmail2" operator="equals" value="Y"> |
| <if-not-empty field="emailContactMechId"> |
| <if-not-empty field="emailContactMechIdTo"> |
| <set field="updatePartyContactMechCtx.partyId" from-field="partyIdTo"/> |
| <set field="updatePartyContactMechCtx.contactMechId" from-field="emailContactMechIdTo"/> |
| <set field="updatePartyContactMechCtx.contactMechTypeId" value="EMAIL_ADDRESS"/> |
| <set field="updatePartyContactMechCtx.contactMechPurposeTypeId" value="PRIMARY_EMAIL"/> |
| <set field="updatePartyContactMechCtx.newContactMechId" from-field="emailContactMechId"/> |
| <call-service service-name="updatePartyContactMech" in-map-name="updatePartyContactMechCtx"/> |
| </if-not-empty> |
| <set field="deletePartyContactMechCtx.partyId" from-field="partyId"/> |
| <set field="deletePartyContactMechCtx.contactMechId" from-field="emailContactMechId"/> |
| <call-service service-name="deletePartyContactMech" in-map-name="deletePartyContactMechCtx"/> |
| </if-not-empty> |
| </if-compare> |
| |
| <set field="updatePartyCtx.partyId" from-field="partyId"/> |
| <set field="updatePartyCtx.statusId" value="PARTY_DISABLED"/> |
| <call-service service-name="setPartyStatus" in-map-name="updatePartyCtx"/> |
| |
| <field-to-result field="partyIdTo" result-name="partyId"/> |
| <field-to-request field="partyIdTo" request-name="partyId"/> |
| </if-compare-field> |
| </simple-method> |
| </simple-methods> |