svn commit: r813731 - in /ofbiz/trunk/applications/party: script/org/ofbiz/party/party/PartyServices.xml servicedef/services.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r813731 - in /ofbiz/trunk/applications/party: script/org/ofbiz/party/party/PartyServices.xml servicedef/services.xml

ashish-18
Author: ashish
Date: Fri Sep 11 09:09:08 2009
New Revision: 813731

URL: http://svn.apache.org/viewvc?rev=813731&view=rev
Log:
Applied patch from jira issue OFBIZ-2913 - Write a new service for quick create customer profile.
After seeing a discussion in b/w Vikas and Sumit I am committing the previous patch in which there will be new service definition and implementation so further enhancements in SFA service and Party service will remain separate.

Thanks Awdesh, Sumit for the contribution & Vikas for providing useful comments.

Modified:
    ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml
    ofbiz/trunk/applications/party/servicedef/services.xml

Modified: ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml?rev=813731&r1=813730&r2=813731&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml (original)
+++ ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml Fri Sep 11 09:09:08 2009
@@ -993,4 +993,32 @@
         <field-to-result field="partyId"/>
     </simple-method>
 
+    <simple-method method-name="quickCreateCustomer" short-description="Create customer profile on basis of First Name ,Last Name and Email Address" login-required="false">
+        <call-map-processor xml-resource="component://party/script/org/ofbiz/party/contact/PartyContactMechMapProcs.xml"
+                processor-name="person" in-map-name="parameters" out-map-name="personInMap"/>
+        <call-map-processor xml-resource="component://party/script/org/ofbiz/party/contact/PartyContactMechMapProcs.xml"
+                processor-name="emailAddress" in-map-name="parameters" out-map-name="emailAddressInMap"/>
+        <check-errors/>
+        
+        <!-- create person  -->
+        <call-service service-name="createPerson" in-map-name="personInMap">
+            <result-to-field result-name="partyId"/>
+            <result-to-result result-name="partyId"/>
+        </call-service>
+
+        <!-- Create email address -->
+        <entity-one entity-name="UserLogin" value-field="userLogin">
+            <field-map field-name="userLoginId" value="system"/>
+        </entity-one>
+        <set field="emailAddressInMap.partyId" from-field="partyId"/>
+        <set field="emailAddressInMap.userLogin" from-field="userLogin"/>
+        <set field="emailAddressInMap.contactMechPurposeTypeId" value="PRIMARY_EMAIL"/>
+        <call-service service-name="createPartyEmailAddress" in-map-name="emailAddressInMap"/>
+        
+        <!-- Create the PartyRole -->
+        <set field="createPartyRoleInMap.partyId" from-field="partyId"/>
+        <set field="createPartyRoleInMap.roleTypeId" value="CUSTOMER"/>
+        <set field="createPartyRoleInMap.userLogin" from-field="userLogin"/>
+        <call-service service-name="createPartyRole" in-map-name="createPartyRoleInMap"/>
+    </simple-method>
 </simple-methods>

Modified: ofbiz/trunk/applications/party/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/servicedef/services.xml?rev=813731&r1=813730&r2=813731&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/party/servicedef/services.xml Fri Sep 11 09:09:08 2009
@@ -1248,4 +1248,13 @@
             location="org.ofbiz.party.communication.CommunicationEventServices" invoke="logIncomingMessage">
         <implements service="mailProcessInterface"/>
     </service>    
+    
+    <service name="quickCreateCustomer" engine="simple"
+            location="component://party/script/org/ofbiz/party/party/PartyServices.xml" invoke="quickCreateCustomer">
+        <description>Create customer profile on basis of First Name ,Last Name and Email Address</description>
+        <attribute name="firstName" type="String" mode="IN" optional="false"/>
+        <attribute name="lastName" type="String" mode="IN" optional="false"/>
+        <attribute name="emailAddress" type="String" mode="IN" optional="false"/>
+        <attribute name="partyId" type="String" mode="OUT" optional="false"/>
+    </service>
 </services>