svn commit: r692448 - in /ofbiz/trunk/applications: ecommerce/data/ ecommerce/script/org/ofbiz/ecommerce/customer/ ecommerce/webapp/ecommerce/images/ ecommerce/webapp/ecommerce/order/ order/script/org/ofbiz/order/order/ order/servicedef/ party/script/o...

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

svn commit: r692448 - in /ofbiz/trunk/applications: ecommerce/data/ ecommerce/script/org/ofbiz/ecommerce/customer/ ecommerce/webapp/ecommerce/images/ ecommerce/webapp/ecommerce/order/ order/script/org/ofbiz/order/order/ order/servicedef/ party/script/o...

mor-2
Author: mor
Date: Fri Sep  5 07:08:18 2008
New Revision: 692448

URL: http://svn.apache.org/viewvc?rev=692448&view=rev
Log:
Done following changes:
1) Converted all of these events to services "createUpdatePerson, createUpdateEmailAddress, createUpdateTelecomNumber, createUpdateUserLogin,
   createUpdateShippingAddress, createUpdateBillingAddress, createUpdateCreditCard"
2) Added Demo data for telecom number for DemoCustomer so that this party can do checkout on One page checkout.
3) Modified behaviour of billing and shipping telecom number field on new customer page with respect to check box "Billing is the same as the shipping address" and
   corresponding changes to createCustomerProfile event. Now billing and shipping phone numbers are handled separtely from billing and shipping addresses resp.
4) Misc. changes to profile Java Script and one page template.

Thanks to Rishi Solanki, Santosh Malviya, Brajesh Patel and Sumit Pandit (for review) for this contribution.



Modified:
    ofbiz/trunk/applications/ecommerce/data/DemoOrderPeopleData.xml
    ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml
    ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js
    ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/profile.js
    ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl
    ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml
    ofbiz/trunk/applications/order/servicedef/services.xml
    ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml
    ofbiz/trunk/applications/party/servicedef/services.xml

Modified: ofbiz/trunk/applications/ecommerce/data/DemoOrderPeopleData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/data/DemoOrderPeopleData.xml?rev=692448&r1=692447&r2=692448&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/data/DemoOrderPeopleData.xml (original)
+++ ofbiz/trunk/applications/ecommerce/data/DemoOrderPeopleData.xml Fri Sep  5 07:08:18 2008
@@ -127,9 +127,13 @@
     <PartyContactMechPurpose partyId="DemoCustomer" contactMechId="9015" contactMechPurposeTypeId="SHIPPING_LOCATION" fromDate="2001-05-13 00:00:00.000"/>
     <PartyContactMechPurpose partyId="DemoCustomer" contactMechId="9015" contactMechPurposeTypeId="GENERAL_LOCATION" fromDate="2001-05-13 00:00:00.000"/>
     <ContactMech contactMechId="9025" contactMechTypeId="TELECOM_NUMBER"/>
-    <TelecomNumber contactMechId="9025" areaCode="801" contactNumber="555-5555"/>
-    <PartyContactMech partyId="DemoCustomer" contactMechId="9025" fromDate="2001-05-13 00:00:00.000" allowSolicitation="Y"/>
+    <TelecomNumber contactMechId="9025" countryCode="1" areaCode="801" contactNumber="555-5555"/>
+    <TelecomNumber contactMechId="9027" countryCode="1" areaCode="801" contactNumber="444-4444"/>
+    <PartyContactMech partyId="DemoCustomer" contactMechId="9025" fromDate="2001-05-13 00:00:00.000" allowSolicitation="Y" extension="222"/>
+    <PartyContactMech partyId="DemoCustomer" contactMechId="9027" fromDate="2001-05-13 00:00:00.000" allowSolicitation="Y" extension="212"/>
     <PartyContactMechPurpose partyId="DemoCustomer" contactMechId="9025" contactMechPurposeTypeId="PHONE_HOME" fromDate="2001-05-13 00:00:00.000"/>
+    <PartyContactMechPurpose partyId="DemoCustomer" contactMechId="9025" contactMechPurposeTypeId="PHONE_SHIPPING" fromDate="2001-05-13 00:00:00.000"/>
+    <PartyContactMechPurpose partyId="DemoCustomer" contactMechId="9027" contactMechPurposeTypeId="PHONE_BILLING" fromDate="2001-05-13 00:00:00.000"/>
     <ContactMech contactMechId="9026" contactMechTypeId="EMAIL_ADDRESS" infoString="[hidden email]"/>
     <PartyContactMech partyId="DemoCustomer" contactMechId="9026" fromDate="2001-05-13 00:00:00.000" allowSolicitation="Y"/>
     <PartyContactMechPurpose partyId="DemoCustomer" contactMechId="9026" contactMechPurposeTypeId="PRIMARY_EMAIL" fromDate="2001-05-13 00:00:00.000"/>

Modified: ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml?rev=692448&r1=692447&r2=692448&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml (original)
+++ ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml Fri Sep  5 07:08:18 2008
@@ -861,12 +861,21 @@
         <if-empty field="shoppingCart">
             <session-to-field field-name="shoppingCart"/>
         </if-empty>
-
         <if-not-empty field="partyId">
             <!-- If userLogin is empty set anonymous userLogin or if anonymous user is coming back update userLogin -->
             <call-simple-method method-name="setAnonUserLogin"/>
         </if-not-empty>
-        <call-simple-method method-name="createUpdatePerson"/>
+
+        <!-- Create Update Person -->
+        <set-service-fields service-name="createUpdatePerson" map-name="parameters" to-map-name="createUpdatePersonCtx"/>
+        <set field="createUpdatePersonCtx.userLogin" from-field="userLogin"/>
+        <set field="createUpdatePersonCtx.partyId" from-field="userLogin.partyId"/>
+        <call-service service-name="createUpdatePerson" in-map-name="createUpdatePersonCtx">
+            <result-to-request result-name="partyId"/>
+            <result-to-field result-name="partyId" field-name="parameters.partyId"/>
+        </call-service>
+        <set field="partyId" from-field="parameters.partyId"/>
+        
         <if-empty field="userLogin">
             <!-- If new anonymous user set anonymous userLogin -->
             <call-simple-method method-name="setAnonUserLogin"/>
@@ -876,12 +885,45 @@
         <set field="partyRoleContext.roleTypeId" from-field="parameters.roleTypeId"/>
         <set field="partyRoleContext.userLogin" from-field="userLogin"/>
         <call-service service-name="createPartyRole" in-map-name="partyRoleContext"/>
+
+        <!-- Create Update Shipping address -->
+        <set-service-fields service-name="createUpdateShippingAddress" map-name="parameters" to-map-name="shipToAddressCtx"/>
+        <set field="shipToAddressCtx.userLogin" from-field="userLogin"/>
+        <call-service service-name="createUpdateShippingAddress" in-map-name="shipToAddressCtx">
+            <result-to-field result-name="contactMechId" field-name="parameters.shipToContactMechId"/>
+        </call-service>
+        <field-to-request field-name="parameters.shipToContactMechId" request-name="shipToContactMechId"/>
+
+        <!-- Create Update Shipping Telecom Number -->
+        <call-map-processor xml-resource="org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml"
+                processor-name="phoneNumber" in-map-name="parameters" out-map-name="shipToPhoneContext"/>
+        <check-errors/>
+    
+        <set-service-fields service-name="createUpdateTelecomNumber" map-name="shipToPhoneContext" to-map-name="createUpdateTelecomNumberCtx"/>
+        <set field="createUpdateTelecomNumberCtx.contactMechId" from-field="parameters.shipToPhoneContactMechId"/>
+        <set field="createUpdateTelecomNumberCtx.userLogin" from-field="userLogin"/>
+        <set field="createUpdateTelecomNumberCtx.partyId" from-field="parameters.partyId"/>
+        <set field="createUpdateTelecomNumberCtx.roleTypeId" from-field="parameters.roleTypeId"/>
+        <set field="createUpdateTelecomNumberCtx.contactMechPurposeTypeId" from-field="parameters.contactMechPurposeTypeId"/>
+        <call-service service-name="createUpdateTelecomNumber" in-map-name="createUpdateTelecomNumberCtx">
+            <result-to-field result-name="contactMechId" field-name="parameters.shipToPhoneContactMechId"/>
+        </call-service>
+        <field-to-request field-name="parameters.shipToPhoneContactMechId" request-name="shipToPhoneContactMechId"/>
+
+        <!-- Create Update email address -->
+        <call-map-processor xml-resource="org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml"
+                processor-name="emailAddress" in-map-name="parameters" out-map-name="emailAddressContext"/>
+        <check-errors/>
+    
+        <set-service-fields service-name="createUpdateEmailAddress" map-name="emailAddressContext" to-map-name="createUpdateEmailCtx"/>
+        <set field="createUpdateEmailCtx.contactMechPurposeTypeId" value="PRIMARY_EMAIL"/>
+        <set field="createUpdateEmailCtx.userLogin" from-field="userLogin"/>
+        <set field="createUpdateEmailCtx.partyId" from-field="parameters.partyId"/>
+        <call-service service-name="createUpdateEmailAddress" in-map-name="createUpdateEmailCtx">
+            <result-to-field result-name="contactMechId" field-name="parameters.emailContactMechId"/>
+        </call-service>
+        <field-to-request field-name="parameters.emailContactMechId" request-name="emailContactMechId"/>        
         
-        <call-simple-method method-name="createUpdateShippingAddress"/>
-        <set field="parameters.phoneContactMechPurposeTypeId" value="PRIMARY_PHONE"/>
-        <call-simple-method method-name="createUpdateTelecomNumber"/>
-        <set field="parameters.emailContactMechPurposeTypeId" value="PRIMARY_EMAIL"/>
-        <call-simple-method method-name="createUpdateEmailAddress"/>
         <!-- Set partyId, in shoppingCart -->
         <call-object-method obj-field-name="shoppingCart" method-name="setUserLogin">
             <field field-name="userLogin" type="org.ofbiz.entity.GenericValue"/>
@@ -900,25 +942,6 @@
         </call-object-method>
     </simple-method>
     
-    <simple-method method-name="createUpdatePerson" short-description="Create and update a person" login-required="false">
-        <call-map-processor xml-resource="org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml"
-                processor-name="person" in-map-name="parameters" out-map-name="personMap"/>
-        <check-errors/>        
-            <set-service-fields service-name="createPerson"  map-name="personMap" to-map-name="personContext"/>
-            <if-empty field="partyId">
-                <call-service service-name="createPerson" in-map-name="personContext">
-                    <result-to-field result-name="partyId" field-name="partyId"/>
-                </call-service>
-            <else><!-- If partyId already exists. -->
-                <set field="personContext.partyId" from-field="partyId"/>
-                <call-service service-name="updatePerson" in-map-name="personContext"/>
-                <log level="info" message="Party Updated partyId is ${partyId}"/>
-            </else>
-            </if-empty>
-            <field-to-request field-name="partyId" request-name="partyId"/>
-            <set field="parameters.partyId" from-field="partyId"/>
-    </simple-method>
-    
     <simple-method method-name="createUpdateUserLogin" short-description="Create and update a user login" login-required="false">
         <if-empty field="userLogin">
             <call-map-processor xml-resource="org/ofbiz/securityext/login/LoginMapProcs.xml"
@@ -1002,119 +1025,6 @@
         <log level="info" message="userLogin is ${userLogin}"/>
     </simple-method>
 
-    <simple-method method-name="createUpdateTelecomNumber" short-description="Create and update phone number" login-required="false">
-        <call-map-processor xml-resource="org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml"
-                processor-name="phoneNumber" in-map-name="parameters" out-map-name="phoneContext"/>
-        <check-errors/>
-        <set field="phoneContext.partyId" from-field="partyId"/>
-        <set field="phoneContext.roleTypeId" from-field="parameters.roleTypeId"/>
-        <set field="phoneContext.userLogin" from-field="userLogin"/>
-        <if-empty field="parameters.phoneContactMechId">
-            <set field="phoneContext.contactMechPurposeTypeId" from-field="parameters.phoneContactMechPurposeTypeId"/>
-            <call-service service-name="createPartyTelecomNumber" in-map-name="phoneContext">
-                <result-to-field result-name="contactMechId" field-name="parameters.phoneContactMechId"/>
-            </call-service>
-            <log level="info" message="Phone Contact created phoneContactMechId is ${parameters.phoneContactMechId}"></log>
-        <else>
-            <set field="phoneContext.contactMechId" from-field="parameters.phoneContactMechId"/>
-            <log level="info" message="Updating phoneContactMechId is ${parameters.phoneContactMechId}"></log>
-            <call-service service-name="updatePartyTelecomNumber" in-map-name="phoneContext">
-                <result-to-field result-name="contactMechId" field-name="parameters.phoneContactMechId"/>
-            </call-service>
-            <log level="info" message="Phone Contact updated phoneContactMechId is ${parameters.phoneContactMechId}"></log>
-        </else>
-        </if-empty>
-        <field-to-request field-name="parameters.phoneContactMechId" request-name="phoneContactMechId"/>
-    </simple-method>
-
-    <simple-method method-name="createUpdateEmailAddress" short-description="Create and update email address" login-required="false">
-        <call-map-processor xml-resource="org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml"
-                processor-name="emailAddress" in-map-name="parameters" out-map-name="emailAddressContext"/>
-        <check-errors/>        
-        <!-- Create Or Update email address -->
-        <set  field="emailAddressContext.partyId" from-field="partyId"/>
-        <set field="emailAddressContext.userLogin" from-field="userLogin"/>
-        <if-empty field="parameters.emailContactMechId">
-            <set field="emailAddressContext.contactMechPurposeTypeId" from-field="parameters.emailContactMechPurposeTypeId"/>
-            <call-service service-name="createPartyEmailAddress" in-map-name="emailAddressContext">
-                <result-to-field result-name="contactMechId" field-name="parameters.emailContactMechId"/>
-            </call-service>
-            <log level="info" message="Email Contact Created emailContactMechId is ${parameters.emailContactMechId}"></log>
-        <else>
-            <set field="emailAddressContext.contactMechId" from-field="parameters.emailContactMechId"/>
-            <!-- call update Email address -->
-            <call-service service-name="updatePartyEmailAddress" in-map-name="emailAddressContext">
-                <result-to-field result-name="contactMechId" field-name="parameters.emailContactMechId"/>
-            </call-service>
-            <log level="info" message="Email Contact updated emailContactMechId is ${parameters.emailContactMechId}"></log>
-        </else>
-        </if-empty>
-        <entity-one entity-name="ContactMech" value-name="emailContactMech">
-            <field-map field-name="contactMechId" env-name="parameters.emailContactMechId"/>
-        </entity-one>
-        <field-to-request field-name="parameters.emailContactMechId" request-name="emailContactMechId"/>
-        <field-to-request field-name="emailContactMech" request-name="emailContactMech"/>
-    </simple-method>
-
-    <simple-method method-name="createUpdateShippingAddress" short-description="create and update shipping address" login-required="false">
-        <set field="keepAddressBook" from-field="parameters.keepAddressBook" default-value="Y"/>
-        <call-map-processor xml-resource="org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml"
-            processor-name="shipToAddress" in-map-name="parameters" out-map-name="shipToAddressCtx"/>
-        <check-errors/>
-        <set field="shipToAddressCtx.partyId" from-field="partyId"/>
-        <set field="shipToAddressCtx.contactMechPurposeTypeId" value="SHIPPING_LOCATION"/>
-        <if-empty field="parameters.shipToContactMechId">
-            <call-service service-name="createPartyPostalAddress" in-map-name="shipToAddressCtx">
-                <result-to-field result-name="contactMechId" field-name="parameters.shipToContactMechId"/>
-            </call-service>
-            <log level="info" message="Shipping address created with contactMechId ${parameters.shipToContactMechId}"/>
-        <else>
-            <if-compare field="keepAddressBook" operator="equals" value="Y">
-                <make-value entity-name="PostalAddress" value-name="newValue"/>
-                <set-pk-fields value-name="newValue" map-name="shipToAddressCtx"/>
-                <find-by-primary-key entity-name="PostalAddress" map-name="newValue" value-name="oldValue"/>
-                <set-nonpk-fields map-name="shipToAddressCtx" value-name="newValue"/>
-                <if-compare-field field="oldValue" to-field="newValue" operator="not-equals" type="Object">
-                    <call-service service-name="createPartyPostalAddress" in-map-name="shipToAddressCtx">
-                        <result-to-field result-name="contactMechId" field-name="parameters.shipToContactMechId"/>
-                    </call-service>                        
-                </if-compare-field>              
-            </if-compare>
-            <if-compare field="keepAddressBook" operator="equals" value="N">
-                <if-compare-field field="parameters.shipToContactMechId" operator="equals" to-field="parameters.billToContactMechId">
-                    <make-value entity-name="PostalAddress" value-name="newValue"/>
-                    <set-pk-fields value-name="newValue" map-name="shipToAddressCtx"/>
-                    <find-by-primary-key entity-name="PostalAddress" map-name="newValue" value-name="oldValue"/>
-                    <set-nonpk-fields map-name="shipToAddressCtx" value-name="newValue"/>
-                    <if-compare-field field="oldValue" to-field="newValue" operator="not-equals" type="Object">
-                        <entity-and entity-name="PartyContactMechPurpose" list-name="pcmpList" filter-by-date="true">
-                            <field-map field-name="contactMechId" env-name="parameters.shipToContactMechId"/>
-                            <field-map field-name="partyId" env-name="partyId"/>
-                            <field-map field-name="contactMechPurposeTypeId" value="SHIPPING_LOCATION"/>
-                        </entity-and>
-                        <first-from-list list-name="pcmpList" entry-name="pcmp"/>
-                        <if-not-empty field="pcmp">
-                            <set-service-fields service-name="deletePartyContactMechPurposeIfExists" map-name="pcmp" to-map-name="serviceInMap"/>
-                            <call-service service-name="deletePartyContactMechPurposeIfExists" in-map-name="serviceInMap"/>
-                        </if-not-empty>
-                        <call-service service-name="createPartyPostalAddress" in-map-name="shipToAddressCtx">
-                            <result-to-field result-name="contactMechId" field-name="parameters.shipToContactMechId"/>
-                        </call-service>
-                        <log level="info" message="Shipping address updated with contactMechId ${parameters.shipToContactMechId}"/>
-                    </if-compare-field>
-                <else>
-                    <call-service service-name="updatePartyPostalAddress" in-map-name="shipToAddressCtx">
-                        <result-to-field result-name="contactMechId" field-name="parameters.shipToContactMechId"/>
-                    </call-service>
-                    <log level="info" message="Shipping address updated with contactMechId ${parameters.shipToContactMechId}"/>
-                </else>
-                </if-compare-field>
-            </if-compare>
-        </else>
-        </if-empty>
-        <field-to-request field-name="parameters.shipToContactMechId" request-name="shipToContactMechId"/>
-    </simple-method>
-
     <simple-method method-name="getShipOptions" short-description="Get shipping options" login-required="false">
         <set field="dispatcher" from-field="parameters.dispatcher" type="Object"/>
         <set field="shoppingCart" from-field="parameters.shoppingCart"/>
@@ -1261,12 +1171,42 @@
             <call-simple-method method-name="setAnonUserLogin"/>
         </if-not-empty>
 
-        <call-simple-method method-name="createUpdateBillingAddress"/>
-        <call-simple-method method-name="createUpdateCreditCard"/>
+        <!-- Create Update Billing address -->
+        <set-service-fields service-name="createUpdateBillingAddress" map-name="parameters" to-map-name="billToAddressCtx"/>
+        <set field="billToAddressCtx.userLogin" from-field="userLogin"/>
+        <call-service service-name="createUpdateBillingAddress" in-map-name="billToAddressCtx">
+            <result-to-field result-name="contactMechId" field-name="parameters.billToContactMechId"/>
+        </call-service>
+        <field-to-request field-name="parameters.billToContactMechId" request-name="billToContactMechId"/>
+    
+        <!-- Create Update Billing Telecom Number -->
+        <call-map-processor xml-resource="org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml"
+                processor-name="phoneNumber" in-map-name="parameters" out-map-name="billToPhoneContext"/>
+        <check-errors/>
+    
+        <set-service-fields service-name="createUpdateTelecomNumber" map-name="billToPhoneContext" to-map-name="createUpdateTelecomNumberCtx"/>
+        <set field="createUpdateTelecomNumberCtx.contactMechId" from-field="parameters.billToPhoneContactMechId"/>
+        <set field="createUpdateTelecomNumberCtx.userLogin" from-field="userLogin"/>
+        <set field="createUpdateTelecomNumberCtx.partyId" from-field="parameters.partyId"/>
+        <set field="createUpdateTelecomNumberCtx.roleTypeId" from-field="parameters.roleTypeId"/>
+        <set field="createUpdateTelecomNumberCtx.contactMechPurposeTypeId" from-field="parameters.contactMechPurposeTypeId"/>
+        <call-service service-name="createUpdateTelecomNumber" in-map-name="createUpdateTelecomNumberCtx">
+            <result-to-field result-name="contactMechId" field-name="parameters.billToPhoneContactMechId"/>
+        </call-service>
+        <field-to-request field-name="parameters.billToPhoneContactMechId" request-name="billToPhoneContactMechId"/>
+        
+        <!-- Create Update credit card -->
+        <set-service-fields service-name="createUpdateCreditCard" map-name="parameters" to-map-name="creditCardContext"/>
+        <set field="creditCardContext.contactMechId" from-field="parameters.billToContactMechId"/>
+        <call-service service-name="createUpdateCreditCard" in-map-name="creditCardContext">
+            <result-to-field result-name="paymentMethodId" field-name="parameters.paymentMethodId"/>
+        </call-service>
+
         <!--============== Set Payment Method ================-->
         <set field="paymentMethodId" from-field="parameters.paymentMethodId"/>
         <set field="cardSecurityCode" from-field="parameters.cardSecurityCode"/>
         <field-to-session field-name="userLogin" session-name="userLogin"/>
+        <field-to-request field-name="parameters.paymentMethodId" request-name="paymentMethodId"/>
         <call-bsh>
             <![CDATA[
                 import org.ofbiz.order.shoppingcart.ShoppingCart;
@@ -1278,119 +1218,6 @@
         </call-bsh>
     </simple-method>
 
-    <simple-method method-name="createUpdateBillingAddress" short-description="create and update billing address">
-        <set field="keepAddressBook" from-field="parameters.keepAddressBook" default-value="Y"/>
-        <if-compare field="parameters.useShippingAddressForBilling" operator="not-equals" value="Y">
-            <call-map-processor xml-resource="org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml"
-                processor-name="billToAddress" in-map-name="parameters" out-map-name="billToAddressCtx"/>
-        </if-compare>
-        <check-errors/>
-        <set field="billToAddressCtx.contactMechPurposeTypeId" value="BILLING_LOCATION"/>
-        <set field="billToAddressCtx.partyId" from-field="partyId"/>
-
-        <if-compare field="parameters.useShippingAddressForBilling" operator="equals" value="Y">
-            <if-empty field="parameters.billToContactMechId">
-                <set-service-fields service-name="createPartyContactMechPurpose" map-name="billToAddressCtx" to-map-name="serviceInMap"/>
-                <set field="serviceInMap.contactMechId" from-field="parameters.shipToContactMechId"/>
-                <call-service service-name="createPartyContactMechPurpose" in-map-name="serviceInMap"/>
-            <else>
-                <if-compare-field field="parameters.shipToContactMechId" operator="not-equals" to-field="parameters.billToContactMechId">
-                    <if-compare field="keepAddressBook" operator="equals" value="N">
-                        <entity-and entity-name="PartyContactMechPurpose" list-name="pcmpList" filter-by-date="true">
-                            <field-map field-name="contactMechId" env-name="parameters.billToContactMechId"/>
-                            <field-map field-name="partyId" env-name="partyId"/>
-                            <field-map field-name="contactMechPurposeTypeId" value="BILLING_LOCATION"/>
-                        </entity-and>
-                        <first-from-list entry-name="pcmp" list-name="pcmpList"/>
-                        <set-service-fields service-name="deletePartyContactMechPurposeIfExists" map-name="pcmp" to-map-name="serviceInMap"/>
-                        <call-service service-name="deletePartyContactMechPurposeIfExists" in-map-name="serviceInMap"/>
-                        <clear-field field-name="serviceInMap"/>
-                        
-                        <set-service-fields service-name="deletePartyContactMech" map-name="pcmp" to-map-name="serviceInMap"/>
-                        <call-service service-name="deletePartyContactMech" in-map-name="serviceInMap"/>
-                        <clear-field field-name="serviceInMap"/>
-                    </if-compare>
-                    <set-service-fields service-name="createPartyContactMechPurpose" map-name="billToAddressCtx" to-map-name="serviceInMap"/>
-                    <set field="serviceInMap.contactMechId" from-field="parameters.shipToContactMechId"/>
-                    <call-service service-name="createPartyContactMechPurpose" in-map-name="serviceInMap">
-                    </call-service>
-                    <log level="info" message="Billing address updated with contactMechId ${parameters.billToContactMechId}"/>
-                </if-compare-field>
-            </else>
-            </if-empty>
-            <set field="parameters.billToContactMechId" from-field="parameters.shipToContactMechId"/>
-        </if-compare>
-        <if-compare field="parameters.useShippingAddressForBilling" operator="not-equals" value="Y">
-            <if-empty field="parameters.billToContactMechId">
-                <call-service service-name="createPartyPostalAddress" in-map-name="billToAddressCtx">
-                    <result-to-field result-name="contactMechId" field-name="parameters.billToContactMechId"/>
-                </call-service>
-                <log level="info" message="Billing address created with contactmechId ${parameters.billToContactMechId}"/>
-            <else>
-                <if-compare-field field="parameters.shipToContactMechId" operator="equals" to-field="parameters.billToContactMechId">
-                    <if-compare field="keepAddressBook" operator="equals" value="N">
-                        <entity-and entity-name="PartyContactMechPurpose" list-name="pcmpList" filter-by-date="true">
-                            <field-map field-name="contactMechId" env-name="parameters.billToContactMechId"/>
-                            <field-map field-name="partyId" env-name="partyId"/>
-                            <field-map field-name="contactMechPurposeTypeId" value="BILLING_LOCATION"/>
-                        </entity-and>
-                        <first-from-list entry-name="pcmp" list-name="pcmpList"/>
-                    
-                        <set-service-fields service-name="deletePartyContactMechPurposeIfExists" map-name="pcmp" to-map-name="serviceInMap"/>
-                        <call-service service-name="deletePartyContactMechPurposeIfExists" in-map-name="serviceInMap"/>
-                    </if-compare>
-                    <call-service service-name="createPartyPostalAddress" in-map-name="billToAddressCtx">
-                        <result-to-field result-name="contactMechId" field-name="parameters.billToContactMechId"/>
-                    </call-service>
-                    <log level="info" message="Billing address updated with contactMechId ${parameters.billToContactMechId}"/>
-                <else>
-                    <if-compare field="keepAddressBook" operator="equals" value="N">
-                        <call-service service-name="updatePartyPostalAddress" in-map-name="billToAddressCtx">
-                            <result-to-field result-name="contactMechId" field-name="parameters.billToContactMechId"/>
-                        </call-service>
-                    </if-compare>
-                    <if-compare field="keepAddressBook" operator="equals" value="Y">
-                        <call-service service-name="createPartyPostalAddress" in-map-name="billToAddressCtx">
-                            <result-to-field result-name="contactMechId" field-name="parameters.billToContactMechId"/>
-                        </call-service>                  
-                    </if-compare>
-                    <log level="info" message="Billing Postal Address created billToContactMechId is ${parameters.billToContactMechId}"/>
-                </else>
-                </if-compare-field>
-            </else>
-            </if-empty>
-        </if-compare>
-        <field-to-request field-name="parameters.billToContactMechId" request-name="billToContactMechId"/>
-    </simple-method>
-
-    <simple-method method-name="createUpdateCreditCard" short-description="create and update credit card">
-        <call-map-processor xml-resource="org/ofbiz/accounting/payment/PaymentMapProcs.xml"
-                processor-name="createCreditCard" in-map-name="parameters" out-map-name="creditCardContext"/>
-        <check-errors/>        
-            <set field="creditCardContext.partyId" from-field="partyId"/>
-            <set field="creditCardContext.contactMechId" from-field="parameters.billToContactMechId"/>
-            <if-empty field="parameters.paymentMethodId">
-                <!-- call create Credit Card -->
-                <call-service service-name="createCreditCard" in-map-name="creditCardContext">
-                    <result-to-field result-name="paymentMethodId" field-name="parameters.paymentMethodId"/>
-                </call-service>
-            <else>
-                <!-- call update Credit Card -->
-                <entity-and entity-name="PaymentMethod" list-name="paymentMethodList" filter-by-date="true">
-                    <field-map field-name="partyId" env-name="partyId"/>
-                <order-by field-name="-fromDate"/>
-            </entity-and>
-            <first-from-list list-name="paymentMethodList" entry-name="paymentMethod"/>
-                <set field="creditCardContext.paymentMethodId" from-field="paymentMethod.paymentMethodId"/>
-                <call-service service-name="updateCreditCard" in-map-name="creditCardContext">
-                    <result-to-field result-name="paymentMethodId" field-name="parameters.paymentMethodId"/>
-                </call-service>
-            </else>
-            </if-empty>
-            <set field="paymentMethodId" from-field="parameters.paymentMethodId"/>
-            <field-to-request field-name="parameters.paymentMethodId" request-name="paymentMethodId"/>
-    </simple-method>
-
     <simple-method method-name="createCustomerProfile" short-description="create a customer profile" login-required="false">
         <!-- Process all map -->
         <call-map-processor xml-resource="org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml"
@@ -1464,40 +1291,52 @@
             <call-service service-name="createPostalAddressAndPurposes" in-map-name="billToAddressCtx">
                 <result-to-field result-name="contactMechId" field-name="billToContactMechId"/>
             </call-service>
-            <!-- create billing telecom number  -->
-            <set field="billToTelecomNumberCtx.partyId" from-field="parameters.partyId"/>
-            <set field="billToTelecomNumberCtx.userLogin" from-field="parameters.userLogin"/>
-            <set field="billToTelecomNumberCtx.contactMechPurposeTypeId" value="PHONE_BILLING"/>
-            <!-- call create telecom service -->
-            <call-service service-name="createPartyTelecomNumber" in-map-name="billToTelecomNumberCtx">
-                <result-to-field result-name="contactMechId" field-name="billToTelecomContactMechId"/>
-            </call-service>
-        
             <log level="info" message="Billing address created with contactMechId ${billToContactMechId}"/>
         <else>
-            <set field="billToTelecomNumberCtx.contactMechPurposeTypeId" value="PHONE_BILLING"/>
-            <set field="billToTelecomNumberCtx.partyId" from-field="partyId"/>
-            <set-service-fields service-name="createPartyContactMechPurpose" map-name="billToTelecomNumberCtx" to-map-name="serviceInMap"/>
-            <set field="serviceInMap.contactMechId" from-field="parameters.shipToTelecomContactMechId"/>
-            <set field="serviceInMap.userLogin" from-field="parameters.userLogin"/>
-            <call-service service-name="createPartyContactMechPurpose" in-map-name="serviceInMap"/>
             <log level="info" message="Billing address created same as Shipping address with contactMechId ${shipToContactMechId}"/>
         </else>
         </if-compare>
+        <!-- create billing telecom number  -->
+        <set field="billToTelecomNumberCtx.partyId" from-field="parameters.partyId"/>
+        <set field="billToTelecomNumberCtx.userLogin" from-field="parameters.userLogin"/>
+        <set field="billToTelecomNumberCtx.contactMechPurposeTypeId" value="PHONE_BILLING"/>
+        <!-- call create telecom service -->
+        <call-service service-name="createPartyTelecomNumber" in-map-name="billToTelecomNumberCtx">
+            <result-to-field result-name="contactMechId" field-name="billToTelecomContactMechId"/>
+        </call-service>
      </simple-method>
     
     <simple-method method-name="updateCustomerProfile" short-description="Update a customer profile">
         <call-class-method class-name="org.ofbiz.product.store.ProductStoreWorker" method-name="getProductStore" ret-field-name="productStore">
             <field field-name="request" type="javax.servlet.ServletRequest"/>
         </call-class-method>
-        <set field="partyId" from-field="userLogin.partyId"/>
-        <call-simple-method method-name="createUpdatePerson"/>
+    
+        <set-service-fields service-name="createUpdatePerson" map-name="parameters" to-map-name="createUpdatePersonCtx"/>
+        <set field="createUpdatePersonCtx.userLogin" from-field="userLogin"/>
+        <set field="createUpdatePersonCtx.partyId" from-field="userLogin.partyId"/>
+        <call-service service-name="createUpdatePerson" in-map-name="createUpdatePersonCtx">
+            <result-to-request result-name="partyId"/>
+            <result-to-field result-name="partyId" field-name="parameters.partyId"/>
+        </call-service>
+    
         <if-compare field="productStore.usePrimaryEmailUsername" operator="equals" value="Y">
             <set field="parameters.userLoginId" from-field="parameters.emailAddress"/>
             <call-simple-method method-name="setUserLoginFromEmail"/>
         </if-compare>
+    
         <call-simple-method method-name="createUpdateUserLogin"/>
-        <call-simple-method method-name="createUpdateEmailAddress"/>
+    
+        <call-map-processor xml-resource="org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml"
+                processor-name="emailAddress" in-map-name="parameters" out-map-name="emailAddressContext"/>
+        <check-errors/>
+        <set-service-fields service-name="createUpdateEmailAddress" map-name="emailAddressContext" to-map-name="createUpdateEmailCtx"/>
+        <set field="createUpdateEmailCtx.contactMechPurposeTypeId" value="PRIMARY_EMAIL"/>
+        <set field="createUpdateEmailCtx.contactMechId" from-field="parameters.emailContactMechId"/>
+        <set field="createUpdateEmailCtx.userLogin" from-field="userLogin"/>
+        <set field="createUpdateEmailCtx.partyId" from-field="parameters.partyId"/>
+        <call-service service-name="createUpdateEmailAddress" in-map-name="createUpdateEmailCtx">
+            <result-to-field result-name="contactMechId" field-name="parameters.emailContactMechId"/>
+        </call-service>
     </simple-method>
 
     <simple-method method-name="setUserLoginFromEmail" short-description="Set userloginId from email. If user edit email address then set it as a new userLoginId and disabled date to far in the future for existing userLoginId">

Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js?rev=692448&r1=692447&r2=692448&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js Fri Sep  5 07:08:18 2008
@@ -268,7 +268,7 @@
                 $('shipToPartyId').value = data.partyId;
                 $('billToPartyId').value = data.partyId;
                 $('shipToContactMechId').value = data.shipToContactMechId;
-                $('phoneContactMechId').value = data.phoneContactMechId;
+                $('shipToPhoneContactMechId').value = data.shipToPhoneContactMechId;
                 $('emailContactMechId').value = data.emailContactMechId;
                 $('completedShippingMethod').update(data.shippingDescription);
             }
@@ -305,8 +305,8 @@
 
 function setDataInShippingCompleted() {
     var fullName = $('firstName').value + " " +$('lastName').value;
-    var shippingContactPhoneNumber = $F('shippingCountryCode')+ "-" + $F('shippingAreaCode')
-            + "-" + $F('shippingContactNumber')+ "-" + $F('shippingExtension');
+    var shippingContactPhoneNumber = $F('shipToCountryCode')+ "-" + $F('shipToAreaCode')
+            + "-" + $F('shipToContactNumber')+ "-" + $F('shipToExtension');
     $('completedShipToAttn').update("Attn: " + fullName);
     $('completedShippingContactNumber').update(shippingContactPhoneNumber);
     $('completedEmailAddress').update($('emailAddress').value);
@@ -391,6 +391,7 @@
                 isBillStepValidate = true;
                 $('billToContactMechId').value = data.billToContactMechId;
                 $('paymentMethodId').value = data.paymentMethodId;
+                $('billToPhoneContactMechId').value = data.billToPhoneContactMechId;
             }
         }, parameters: $('billingForm').serialize(), requestHeaders: {Accept: 'application/json'}
     });
@@ -399,6 +400,8 @@
 function setDataInBillingCompleted() {
     var fullName = $F('firstNameOnCard') + " " +$F('lastNameOnCard');
     $('completedBillToAttn').update("Attn: " + fullName);
+    var billToPhoneNumber = $F('billToCountryCode') + "-" + $F('billToAreaCode') + "-" +$F('billToContactNumber') + "-" + $F('billToExtension');
+    $('completedBillToPhoneNumber').update(billToPhoneNumber);
     var cardNumber = "CC#:XXXXXXXXXXXX"+$F('cardNumber').gsub('-','').slice(12,16);
     $('completedCCNumber').update(cardNumber);
     var expiryDate = "Expires:"+$F('expMonth')+"/"+$F('expYear');

Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/profile.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/profile.js?rev=692448&r1=692447&r2=692448&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/profile.js (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/profile.js Fri Sep  5 07:08:18 2008
@@ -97,10 +97,6 @@
         $('billToCountryGeoId').value = $F('shipToCountryGeoId');
         $('billToStateProvinceGeoId').value = $F('shipToStateProvinceGeoId');
         $('billToPostalCode').value = $F('shipToPostalCode');
-        $('billToCountryCode').value = $F('shipToCountryCode');
-        $('billToAreaCode').value = $F('shipToAreaCode');
-        $('billToContactNumber').value = $F('shipToContactNumber');
-        $('billToExtension').value = $F('shipToExtension');
         
         $('billToAddress1').disabled = true ;
         $('billToAddress2').disabled = true ;
@@ -108,10 +104,6 @@
         $('billToCountryGeoId').disabled = true ;
         $('billToStateProvinceGeoId').disabled = true ;
         $('billToPostalCode').disabled = true;
-        $('billToCountryCode').disabled = true;
-        $('billToAreaCode').disabled = true;
-        $('billToContactNumber').disabled = true;
-        $('billToExtension').disabled = true;
         copyShipToBillAddress();
         hideErrorMessage();
     } else {
@@ -123,10 +115,6 @@
         $('billToCountryGeoId').disabled = false ;
         $('billToStateProvinceGeoId').disabled = false ;
         $('billToPostalCode').disabled = false;
-        $('billToCountryCode').disabled = false;
-        $('billToAreaCode').disabled = false;
-        $('billToContactNumber').disabled = false;
-        $('billToExtension').disabled = false;
     }
 }
 
@@ -339,18 +327,6 @@
     Event.observe($('shipToPostalCode'), 'change', function() {
         $('billToPostalCode').value = $F('shipToPostalCode')
     });
-    Event.observe($('shipToCountryCode'), 'change', function() {
-        $('billToCountryCode').value = $F('shipToCountryCode')
-    });
-    Event.observe($('shipToAreaCode'), 'change', function() {
-        $('billToAreaCode').value = $F('shipToAreaCode')
-    });
-    Event.observe($('shipToContactNumber'), 'change', function() {
-        $('billToContactNumber').value = $F('shipToContactNumber')
-    });
-    Event.observe($('shipToExtension'), 'change', function() {
-        $('billToExtension').value = $F('shipToExtension')
-    });
 }
 
 function stopObservingShipToBillAddress() {
@@ -360,8 +336,4 @@
     Event.stopObserving($('shipToStateProvinceGeoId'), 'change', "");
     Event.stopObserving($('shipToCountryGeoId'), 'change', "");
     Event.stopObserving($('shipToPostalCode'), 'change', "");
-    Event.stopObserving($('shipToCountryCode'), 'change', "");
-    Event.stopObserving($('shipToAreaCode'), 'change', "");
-    Event.stopObserving($('shipToContactNumber'), 'change', "");
-    Event.stopObserving($('shipToExtension'), 'change', "");
 }
\ No newline at end of file

Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl?rev=692448&r1=692447&r2=692448&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl Fri Sep  5 07:08:18 2008
@@ -248,9 +248,18 @@
               <input type="hidden" id="shipToContactMechId" name="shipToContactMechId" value="${shipToContactMechId?if_exists}"/>
               <input type="hidden" id="billToContactMechIdInShipingForm" name="billToContactMechId" value="${billToContactMechId?if_exists}"/>
               <input type="hidden" id="shipToPartyId" name="partyId" value="${parameters.partyId?if_exists}"/>
-              <input type="hidden" id="phoneContactMechId" name="phoneContactMechId" value="${phoneContactMechId?if_exists}"/>
+              <input type="hidden" id="shipToPhoneContactMechId" name="shipToPhoneContactMechId" value="${(shipToTelecomNumber.contactMechId)?if_exists}"/>
               <input type="hidden" id="emailContactMechId" name="emailContactMechId" value="${emailContactMechId?if_exists}"/>
               <input type="hidden" name="roleTypeId" value="CUSTOMER"/>
+              <input type="hidden" id="shipToPhoneContactMechPurposeTypeId" name="contactMechPurposeTypeId" value="PHONE_SHIPPING"/>
+              <#if userLogin?exists>
+                <input type="hidden" name="keepAddressBook" value="Y"/>
+                <input type="hidden" name="setDefaultShipping" value="Y"/>
+                <#assign productStoreId = Static["org.ofbiz.product.store.ProductStoreWorker"].getProductStoreId(request)/>
+                <input type="hidden" name="productStoreId" value="${productStoreId?if_exists}"/>
+              <#else>
+                <input type="hidden" name="keepAddressBook" value="N"/>
+              </#if>
               <div id="shippingFormServerError" class="errorMessage"></div>
               <table>
                 <tr>
@@ -274,18 +283,28 @@
                     <div class="form-row">
                       <div class="field-label">
                         <label for="countryCode">${uiLabelMap.PartyCountry}*
-                          <span id="advice-required-shippingCountryCode" style="display:none" class="errorMessage"> (required)</span>
+                          <span id="advice-required-shipToCountryCode" style="display:none" class="errorMessage"> (required)</span>
                         </label>
-                        <label for="areaCode">${uiLabelMap.PartyAreaCode}*<span id="advice-required-shippingAreaCode" style="display:none" class="errorMessage"> (required)</span></label>
-                        <label for="contactNumber">${uiLabelMap.PartyContactNumber}*<span id="advice-required-shippingContactNumber" style="display:none" class="errorMessage"> (required)</span></label>
+                        <label for="areaCode">${uiLabelMap.PartyAreaCode}*<span id="advice-required-shipToAreaCode" style="display:none" class="errorMessage"> (required)</span></label>
+                        <label for="contactNumber">${uiLabelMap.PartyContactNumber}*<span id="advice-required-shipToContactNumber" style="display:none" class="errorMessage"> (required)</span></label>
                         <label for="extension">${uiLabelMap.PartyExtension}</label>
                       </div>
                       <div>
-                        <input name="countryCode" class="required" id="shippingCountryCode" value="${countryCode?if_exists}" size="5" maxlength=3> -
-                        <input name="areaCode" class="required" id="shippingAreaCode" value="${areaCode?if_exists}" size="5" maxlength=3> -
-                        <input name="contactNumber" class="required" id="shippingContactNumber" value="${contactNumber?if_exists}" size="10" maxlength=7> -
-                        <input name="extension" id="shippingExtension" value="${extension?if_exists}" size="5" maxlength=3>
-                      </div>
+                      <#if shipToTelecomNumber?has_content>
+                        <div>
+                          <input name="countryCode" class="required" id="shipToCountryCode" value="${shipToTelecomNumber.countryCode?if_exists}" size="5" maxlength=3> -
+                          <input name="areaCode" class="required" id="shipToAreaCode" value="${shipToTelecomNumber.areaCode?if_exists}")}" size="5" maxlength=3> -
+                          <input name="contactNumber" class="required" id="shipToContactNumber" value="${shipToTelecomNumber.contactNumber?if_exists}")}" size="10" maxlength=7> -
+                          <input name="extension" id="shipToExtension" value="${shipToExtension?if_exists}")}" size="5" maxlength=3>
+                        </div>
+                      <#else>
+                        <div>
+                          <input name="countryCode" class="required" id="shipToCountryCode" value="${parameters.countryCode?if_exists}" size="5" maxlength=3> -
+                          <input name="areaCode" class="required" id="shipToAreaCode" value="${parameters.areaCode?if_exists}" size="5" maxlength=3> -
+                          <input name="contactNumber" class="required" id="shipToContactNumber" value="${parameters.contactNumber?if_exists}" size="10" maxlength=7> -
+                          <input name="extension" id="shipToExtension" value="${parameters.extension?if_exists}" size="5" maxlength=3>
+                        </div>
+                      </#if>
                     </div>
                     <div class="form-row">
                       <div class="field-label">
@@ -413,6 +432,7 @@
                     <td valign="top" width="20%">
                       <div>
                         <div id="completedBillToAttn"></div>
+                        <div id="completedBillToPhoneNumber"></div>
                         <div id="completedCCNumber"></div>
                         <div id="completedExpiryDate"></div>
                       </div>
@@ -446,6 +466,16 @@
               <input type="hidden" id="billToPartyId" name="partyId" value="${parameters.partyId?if_exists}"/>
               <input type="hidden" name="expireDate" value="${expireDate?if_exists}"/>
               <input type="hidden" name="roleTypeId" value="CUSTOMER"/>
+              <input type="hidden" id="billToPhoneContactMechPurposeTypeId" name="contactMechPurposeTypeId" value="PHONE_BILLING"/>
+              <input type="hidden" id="billToPhoneContactMechId" name="billToPhoneContactMechId" value="${(billToTelecomNumber.contactMechId)?if_exists}"/>
+              <#if userLogin?exists>
+                <input type="hidden" name="keepAddressBook" value="Y"/>
+                <input type="hidden" name="setDefaultBilling" value="Y"/>
+                <#assign productStoreId = Static["org.ofbiz.product.store.ProductStoreWorker"].getProductStoreId(request)/>
+                <input type="hidden" name="productStoreId" value="${productStoreId?if_exists}"/>
+              <#else>
+                <input type="hidden" name="keepAddressBook" value="N"/>
+              </#if>
               <div id="billingFormServerError" class="errorMessage"></div>
               <table>
                 <tr>
@@ -520,6 +550,31 @@
                         </select>
                       </span>
                     </div>
+                    <div class="form-row">
+                      <div class="field-label">
+                        <label for="countryCode">${uiLabelMap.PartyCountry}*
+                          <span id="advice-required-billToCountryCode" style="display:none" class="errorMessage"> (required)</span>
+                        </label>
+                        <label for="areaCode">${uiLabelMap.PartyAreaCode}*<span id="advice-required-billToAreaCode" style="display:none" class="errorMessage"> (required)</span></label>
+                        <label for="contactNumber">${uiLabelMap.PartyContactNumber}*<span id="advice-required-billToContactNumber" style="display:none" class="errorMessage"> (required)</span></label>
+                        <label for="extension">${uiLabelMap.PartyExtension}</label>
+                      </div>
+                      <#if billToTelecomNumber?has_content>
+                        <div>
+                          <input name="countryCode" class="required" id="billToCountryCode" value="${billToTelecomNumber.countryCode?if_exists}" size="5" maxlength=3> -
+                          <input name="areaCode" class="required" id="billToAreaCode" value="${billToTelecomNumber.areaCode?if_exists}" size="5" maxlength=3> -
+                          <input name="contactNumber" class="required" id="billToContactNumber" value="${billToTelecomNumber.contactNumber?if_exists}" size="10" maxlength=7> -
+                          <input name="extension" id="billToExtension" value="${billToExtension?if_exists}" size="5" maxlength=3>
+                        </div>
+                      <#else>
+                        <div>
+                          <input name="countryCode" class="required" id="billToCountryCode" value="${parameters.countryCode?if_exists}" size="5" maxlength=3> -
+                          <input name="areaCode" class="required" id="billToAreaCode" value="${parameters.areaCode?if_exists}" size="5" maxlength=3> -
+                          <input name="contactNumber" class="required" id="billToContactNumber" value="${parameters.contactNumber?if_exists}" size="10" maxlength=7> -
+                          <input name="extension" id="billToExtension" value="${parameters.extension?if_exists}" size="5" maxlength=3>
+                        </div>
+                      </#if>  
+                    </div>
                   </td>
                   <td width="20%">&nbsp;</td>
                   <td valign="top">

Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml?rev=692448&r1=692447&r2=692448&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml (original)
+++ ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml Fri Sep  5 07:08:18 2008
@@ -898,4 +898,238 @@
         <create-value value-name="newEntity"/>
         <field-to-result field-name="newEntity.orderItemChangeId" result-name="orderItemChangeId"/>                    
     </simple-method>    
+
+    <simple-method method-name="createUpdateShippingAddress" short-description="create and update Shipping address" login-required="false">
+        <set field="keepAddressBook" from-field="parameters.keepAddressBook" default-value="Y"/>
+        <call-map-processor xml-resource="org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml"
+            processor-name="shipToAddress" in-map-name="parameters" out-map-name="shipToAddressCtx"/>
+        <check-errors/>
+        <set field="shipToAddressCtx.partyId" from-field="parameters.partyId"/>
+
+        <if-empty field="shipToAddressCtx.contactMechId">
+            <set field="shipToAddressCtx.contactMechPurposeTypeId" value="SHIPPING_LOCATION"/>
+            <call-service service-name="createPartyPostalAddress" in-map-name="shipToAddressCtx">
+                <result-to-field result-name="contactMechId" field-name="parameters.shipToContactMechId"/>
+            </call-service>
+            <log level="info" message="Shipping address created with contactMechId ${shipToAddressCtx.shipToContactMechId}"/>
+        <else>
+            <if-compare field="keepAddressBook" operator="equals" value="Y">
+                <make-value entity-name="PostalAddress" value-name="newValue"/>
+                <set-pk-fields value-name="newValue" map-name="shipToAddressCtx"/>
+                <find-by-primary-key entity-name="PostalAddress" map-name="newValue" value-name="oldValue"/>
+                <set-nonpk-fields map-name="shipToAddressCtx" value-name="newValue"/>
+                <if-compare-field field="oldValue" to-field="newValue" operator="not-equals" type="Object">
+                    <call-service service-name="createPartyPostalAddress" in-map-name="shipToAddressCtx">
+                        <result-to-field result-name="contactMechId" field-name="parameters.shipToContactMechId"/>
+                    </call-service>
+                </if-compare-field>
+                <entity-and entity-name="PartyContactMechPurpose" list-name="pcmpShipList" filter-by-date="true">
+                    <field-map field-name="partyId" env-name="userLogin.partyId"/>
+                    <field-map field-name="contactMechId" env-name="parameters.shipToContactMechId"/>
+                    <field-map field-name="contactMechPurposeTypeId" value="SHIPPING_LOCATION"/>
+                </entity-and>
+                <!-- If purpose is not exists then create -->
+                <if-empty field="pcmpShipList">
+                    <set-service-fields service-name="createPartyContactMechPurpose" map-name="parameters" to-map-name="serviceContext"/>
+                    <set field="serviceContext.partyId" from-field="userLogin.partyId"/>
+
+                    <entity-and entity-name="PartyContactMechPurpose" list-name="pcmpList" filter-by-date="true">
+                        <field-map field-name="partyId" env-name="userLogin.partyId"/>
+                        <field-map field-name="contactMechPurposeTypeId" value="SHIPPING_LOCATION"/>
+                    </entity-and>
+                    <if-not-empty field="pcmpList">
+                        <first-from-list list-name="pcmpList" entry-name="pcmp"/>
+                        <set-service-fields service-name="deletePartyContactMechPurposeIfExists" map-name="pcmp" to-map-name="serviceInMap"/>
+                        <call-service service-name="deletePartyContactMechPurposeIfExists" in-map-name="serviceInMap"/>
+                        <clear-field field-name="serviceInMap"/>
+                    </if-not-empty>
+                    <set field="serviceContext.partyId" from-field="userLogin.partyId"/>
+                    <set field="serviceContext.contactMechId" from-field="parameters.shipToContactMechId"/>
+                    <set field="serviceContext.contactMechPurposeTypeId" value="SHIPPING_LOCATION"/>
+                    <call-service service-name="createPartyContactMechPurpose" in-map-name="serviceContext"/>
+                    <clear-field field-name="pcmpList"/>
+                    <clear-field field-name="serviceContext"/>
+                </if-empty>
+                <if-compare field="parameters.setDefaultShipping" operator="equals" value="Y">
+                    <set-service-fields service-name="setPartyProfileDefaults" map-name="parameters" to-map-name="partyProfileDefaultsCtx"/>
+                    <set field="partyProfileDefaultsCtx.defaultShipAddr" from-field="parameters.shipToContactMechId"/>
+                    <set field="partyProfileDefaultsCtx.partyId" from-field="userLogin.partyId"/>
+                    <call-service service-name="setPartyProfileDefaults" in-map-name="partyProfileDefaultsCtx"/>
+                </if-compare>
+            </if-compare>
+            <if-compare field="keepAddressBook" operator="equals" value="N">
+                <set field="shipToAddressCtx.shipToContactMechId" from-field="shipToAddressCtx.contactMechId"></set>
+                <if-compare-field field="shipToAddressCtx.shipToContactMechId" operator="equals" to-field="parameters.billToContactMechId">
+                    <make-value entity-name="PostalAddress" value-name="newValue"/>
+                    <set-pk-fields value-name="newValue" map-name="shipToAddressCtx"/>
+                    <find-by-primary-key entity-name="PostalAddress" map-name="newValue" value-name="oldValue"/>
+                    <set-nonpk-fields map-name="shipToAddressCtx" value-name="newValue"/>
+                    <if-compare-field field="oldValue" to-field="newValue" operator="not-equals" type="Object">
+                        <entity-and entity-name="PartyContactMechPurpose" list-name="pcmpList" filter-by-date="true">
+                            <field-map field-name="contactMechId" env-name="shipToAddressCtx.shipToContactMechId"/>
+                            <field-map field-name="partyId" env-name="partyId"/>
+                            <field-map field-name="contactMechPurposeTypeId" value="SHIPPING_LOCATION"/>
+                        </entity-and>
+                        <first-from-list list-name="pcmpList" entry-name="pcmp"/>
+                        <if-not-empty field="pcmp">
+                            <set-service-fields service-name="deletePartyContactMechPurposeIfExists" map-name="pcmp" to-map-name="serviceInMap"/>
+                            <call-service service-name="deletePartyContactMechPurposeIfExists" in-map-name="serviceInMap"/>
+                        </if-not-empty>
+                        <call-service service-name="createPartyPostalAddress" in-map-name="shipToAddressCtx">
+                            <result-to-field result-name="contactMechId" field-name="parameters.shipToContactMechId"/>
+                        </call-service>
+                        <log level="info" message="Shipping address updated with contactMechId ${shipToAddressCtx.shipToContactMechId}"/>
+                    </if-compare-field>
+                <else>
+                    <set field="shipToAddressCtx.userLogin" from-field="parameters.userLogin"/>
+                    <call-service service-name="updatePartyPostalAddress" in-map-name="shipToAddressCtx">
+                        <result-to-field result-name="contactMechId" field-name="parameters.shipToContactMechId"/>
+                    </call-service>
+                    <log level="info" message="Shipping address updated with contactMechId ${shipToAddressCtx.shipToContactMechId}"/>
+                </else>
+                </if-compare-field>
+            </if-compare>
+        </else>
+        </if-empty>
+        <field-to-result field-name="parameters.shipToContactMechId" result-name="contactMechId"/>
+    </simple-method>
+
+    <simple-method method-name="createUpdateBillingAddress" short-description="create and update billing address">
+
+        <set field="keepAddressBook" from-field="parameters.keepAddressBook" default-value="Y"/>
+        <if-compare field="parameters.useShippingAddressForBilling" operator="not-equals" value="Y">
+            <call-map-processor xml-resource="org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml"
+                processor-name="billToAddress" in-map-name="parameters" out-map-name="billToAddressCtx"/>
+        </if-compare>
+        <check-errors/>
+        <set field="partyId" from-field="parameters.partyId"/>
+        <set field="billToAddressCtx.partyId" from-field="partyId"/>
+
+        <if-compare field="parameters.useShippingAddressForBilling" operator="equals" value="Y">
+            <if-empty field="parameters.billToContactMechId">
+                <set field="billToAddressCtx.contactMechPurposeTypeId" value="BILLING_LOCATION"/>
+                <set-service-fields service-name="createPartyContactMechPurpose" map-name="billToAddressCtx" to-map-name="serviceInMap"/>
+                <set field="serviceInMap.contactMechId" from-field="parameters.shipToContactMechId"/>
+                <call-service service-name="createPartyContactMechPurpose" in-map-name="serviceInMap"/>
+            <else>
+                <if-compare-field field="parameters.shipToContactMechId" operator="not-equals" to-field="parameters.billToContactMechId">
+                    <entity-and entity-name="PartyContactMechPurpose" list-name="pcmpList" filter-by-date="true">
+                        <field-map field-name="contactMechId" env-name="parameters.billToContactMechId"/>
+                        <field-map field-name="partyId" env-name="partyId"/>
+                        <field-map field-name="contactMechPurposeTypeId" value="BILLING_LOCATION"/>
+                    </entity-and>
+                    <first-from-list entry-name="pcmp" list-name="pcmpList"/>
+                    <set-service-fields service-name="deletePartyContactMechPurposeIfExists" map-name="pcmp" to-map-name="serviceInMap"/>
+                    <call-service service-name="deletePartyContactMechPurposeIfExists" in-map-name="serviceInMap"/>
+                    <clear-field field-name="serviceInMap"/>
+                    <if-compare field="keepAddressBook" operator="equals" value="N">
+                        <set-service-fields service-name="deletePartyContactMech" map-name="pcmp" to-map-name="serviceInMap"/>
+                        <call-service service-name="deletePartyContactMech" in-map-name="serviceInMap"/>
+                        <clear-field field-name="serviceInMap"/>
+                    </if-compare>
+                    <set field="billToAddressCtx.contactMechPurposeTypeId" value="BILLING_LOCATION"/>
+                    <set-service-fields service-name="createPartyContactMechPurpose" map-name="billToAddressCtx" to-map-name="serviceInMap"/>
+                    <set field="serviceInMap.contactMechId" from-field="parameters.shipToContactMechId"/>
+                    <call-service service-name="createPartyContactMechPurpose" in-map-name="serviceInMap">
+                    </call-service>
+                    <log level="info" message="Billing address updated with contactMechId ${parameters.billToContactMechId}"/>
+                </if-compare-field>
+            </else>
+            </if-empty>
+            <set field="parameters.billToContactMechId" from-field="parameters.shipToContactMechId"/>
+        </if-compare>
+        <if-compare field="parameters.useShippingAddressForBilling" operator="not-equals" value="Y">
+            <if-empty field="parameters.billToContactMechId">
+                <set field="billToAddressCtx.contactMechPurposeTypeId" value="BILLING_LOCATION"/>
+                <call-service service-name="createPartyPostalAddress" in-map-name="billToAddressCtx">
+                    <result-to-field result-name="contactMechId" field-name="parameters.billToContactMechId"/>
+                </call-service>
+                <log level="info" message="Billing address created with contactmechId ${parameters.billToContactMechId}"/>
+            <else>
+                <if-compare-field field="parameters.shipToContactMechId" operator="equals" to-field="parameters.billToContactMechId">
+                    <set field="billToAddressCtx.contactMechPurposeTypeId" value="BILLING_LOCATION"/>
+                    <call-service service-name="createPartyPostalAddress" in-map-name="billToAddressCtx">
+                        <result-to-field result-name="contactMechId" field-name="parameters.billToContactMechId"/>
+                    </call-service>
+                    <log level="info" message="Billing address updated with contactMechId ${parameters.billToContactMechId}"/>
+                <else>
+                    <if-compare field="keepAddressBook" operator="equals" value="N">
+                        <call-service service-name="updatePartyPostalAddress" in-map-name="billToAddressCtx">
+                            <result-to-field result-name="contactMechId" field-name="parameters.billToContactMechId"/>
+                        </call-service>
+                    </if-compare>
+                    <if-compare field="keepAddressBook" operator="equals" value="Y">
+                        <call-service service-name="createPartyPostalAddress" in-map-name="billToAddressCtx">
+                            <result-to-field result-name="contactMechId" field-name="parameters.billToContactMechId"/>
+                        </call-service>                  
+                    </if-compare>
+                    <log level="info" message="Billing Postal Address created billToContactMechId is ${parameters.billToContactMechId}"/>
+                </else>
+                </if-compare-field>
+
+                <entity-and entity-name="PartyContactMechPurpose" list-name="pcmpShipList" filter-by-date="true">
+                    <field-map field-name="partyId" env-name="userLogin.partyId"/>
+                    <field-map field-name="contactMechId" env-name="parameters.billToContactMechId"/>
+                    <field-map field-name="contactMechPurposeTypeId" value="BILLING_LOCATION"/>
+                </entity-and>
+                <!-- If purpose is not exists then create -->
+                <if-empty field="pcmpShipList">
+                    <set-service-fields service-name="createPartyContactMechPurpose" map-name="parameters" to-map-name="serviceContext"/>
+                    <set field="serviceContext.partyId" from-field="userLogin.partyId"/>
+
+                    <entity-and entity-name="PartyContactMechPurpose" list-name="pcmpList" filter-by-date="true">
+                        <field-map field-name="partyId" env-name="userLogin.partyId"/>
+                        <field-map field-name="contactMechPurposeTypeId" value="BILLING_LOCATION"/>
+                    </entity-and>
+                    <if-not-empty field="pcmpList">
+                        <first-from-list list-name="pcmpList" entry-name="pcmp"/>
+                        <set-service-fields service-name="deletePartyContactMechPurposeIfExists" map-name="pcmp" to-map-name="serviceInMap"/>
+                        <call-service service-name="deletePartyContactMechPurposeIfExists" in-map-name="serviceInMap"/>
+                        <clear-field field-name="serviceInMap"/>
+                    </if-not-empty>
+                    <set field="serviceContext.partyId" from-field="userLogin.partyId"/>
+                    <set field="serviceContext.contactMechId" from-field="parameters.billToContactMechId"/>
+                    <set field="serviceContext.contactMechPurposeTypeId" value="BILLING_LOCATION"/>
+                    <call-service service-name="createPartyContactMechPurpose" in-map-name="serviceContext"/>
+                    <clear-field field-name="pcmpList"/>
+                    <clear-field field-name="serviceContext"/>
+                </if-empty>
+                <if-compare field="parameters.setDefaultBilling" operator="equals" value="Y">
+                    <set-service-fields service-name="setPartyProfileDefaults" map-name="parameters" to-map-name="partyProfileDefaultsCtx"/>
+                    <set field="partyProfileDefaultsCtx.defaultBillAddr" from-field="parameters.billToContactMechId"/>
+                    <set field="partyProfileDefaultsCtx.partyId" from-field="userLogin.partyId"/>
+                    <call-service service-name="setPartyProfileDefaults" in-map-name="partyProfileDefaultsCtx"/>
+                </if-compare>
+
+            </else>
+            </if-empty>
+        </if-compare>
+        <field-to-result field-name="parameters.billToContactMechId" result-name="contactMechId"/>
+    </simple-method>
+    <simple-method method-name="createUpdateCreditCard" short-description="create and update credit card">
+        <set-service-fields service-name="createCreditCard" map-name="parameters" to-map-name="creditCardContext"/>
+        <set field="creditCardContext.partyId" from-field="parameters.partyId"/>
+        <set field="creditCardContext.contactMechId" from-field="parameters.contactMechId"/>
+        <if-empty field="parameters.paymentMethodId">
+            <!-- call create Credit Card -->
+            <call-service service-name="createCreditCard" in-map-name="creditCardContext">
+                <result-to-field result-name="paymentMethodId" field-name="parameters.paymentMethodId"/>
+            </call-service>
+        <else>
+            <!-- call update Credit Card -->
+            <entity-and entity-name="PaymentMethod" list-name="paymentMethodList" filter-by-date="true">
+                <field-map field-name="partyId" env-name="partyId"/>
+                <order-by field-name="-fromDate"/>
+            </entity-and>
+            <first-from-list list-name="paymentMethodList" entry-name="paymentMethod"/>
+            <set field="creditCardContext.paymentMethodId" from-field="paymentMethod.paymentMethodId"/>
+            <call-service service-name="updateCreditCard" in-map-name="creditCardContext">
+                <result-to-field result-name="paymentMethodId" field-name="parameters.paymentMethodId"/>
+            </call-service>
+        </else>
+        </if-empty>
+        <set field="paymentMethodId" from-field="parameters.paymentMethodId"/>
+        <field-to-result field-name="parameters.paymentMethodId" result-name="paymentMethodId"/>
+    </simple-method>
+    
 </simple-methods>

Modified: ofbiz/trunk/applications/order/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services.xml?rev=692448&r1=692447&r2=692448&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/services.xml Fri Sep  5 07:08:18 2008
@@ -843,4 +843,66 @@
         <description>A service designed to be automatically run by job scheduler to create orders from subscriptions which need to be extended.
             This is done by looking for all subscriptions which are active and where the automaticExtend flag is set to "Y"</description>
     </service>
-</services>
+    
+    <service name="createUpdateShippingAddress" engine="simple"
+            location="org/ofbiz/order/order/OrderServices.xml" invoke="createUpdateShippingAddress" auth="true">
+        <description>Creates new shipping address and update existing address</description>
+        <attribute name="productStoreId" mode="IN" type="String" optional="true"/>
+        <attribute name="setDefaultShipping" mode="IN" type="String" optional="true"/>
+        <attribute name="keepAddressBook" mode="IN" type="String" optional="true"/>
+        <attribute name="partyId" mode="IN" type="String" optional="true"/>
+        <attribute name="userLogin" mode="IN" type="GenericValue" optional="true"/>
+        <attribute name="shipToAttnName" mode="IN" type="String" optional="true"/>
+        <attribute name="shipToToName" mode="IN" type="String" optional="true"/>
+        <attribute name="shipToAddress1" mode="IN" type="String" optional="false"/>
+        <attribute name="shipToAddress2" mode="IN" type="String" optional="true"/>
+        <attribute name="shipToCity" mode="IN" type="String" optional="false"/>
+        <attribute name="shipToStateProvinceGeoId" mode="IN" type="String" optional="false"/>
+        <attribute name="shipToPostalCode" mode="IN" type="String" optional="false"/>
+        <attribute name="shipToCountryGeoId" mode="IN" type="String" optional="false"/>
+        <attribute name="shipToContactMechId" mode="IN" type="String" optional="true"/>
+        <attribute name="contactMechId" mode="OUT" type="String" optional="false"/>
+        <attribute name="billToContactMechId" mode="IN" type="String" optional="true"/>
+    </service>
+
+    <service name="createUpdateBillingAddress" engine="simple"
+            location="org/ofbiz/order/order/OrderServices.xml" invoke="createUpdateBillingAddress" auth="true">
+        <description>Creates new billing address and update existing address</description>
+        <attribute name="productStoreId" mode="IN" type="String" optional="true"/>
+        <attribute name="setDefaultBilling" mode="IN" type="String" optional="true"/>
+        <attribute name="keepAddressBook" mode="IN" type="String" optional="true"/>
+        <attribute name="useShippingAddressForBilling" mode="IN" type="String" optional="true"/>
+        <attribute name="partyId" mode="IN" type="String" optional="true"/>
+        <attribute name="userLogin" mode="IN" type="GenericValue" optional="true"/>
+        <attribute name="billToAttnName" mode="IN" type="String" optional="true"/>
+        <attribute name="billToName" mode="IN" type="String" optional="true"/>
+        <attribute name="billToAddress1" mode="IN" type="String" optional="false"/>
+        <attribute name="billToAddress2" mode="IN" type="String" optional="true"/>
+        <attribute name="billToCity" mode="IN" type="String" optional="false"/>
+        <attribute name="billToStateProvinceGeoId" mode="IN" type="String" optional="false"/>
+        <attribute name="billToPostalCode" mode="IN" type="String" optional="false"/>
+        <attribute name="billToCountryGeoId" mode="IN" type="String" optional="false"/>
+        <attribute name="shipToContactMechId" mode="IN" type="String" optional="true"/>
+        <attribute name="billToContactMechId" mode="IN" type="String" optional="true"/>
+        <attribute name="contactMechId" mode="OUT" type="String" optional="false"/>
+    </service>
+
+    <service name="createUpdateCreditCard" engine="simple" auth="true" default-entity-name="CreditCard"
+            location="org/ofbiz/order/order/OrderServices.xml" invoke="createUpdateCreditCard">
+        <description>Create/Update credit card</description>
+        <attribute name="expMonth" type="String" mode="IN" optional="false"/>
+        <attribute name="expYear" type="String" mode="IN" optional="false"/>
+        <attribute name="cardType" type="String" mode="IN" optional="false"/>
+        <attribute name="cardNumber" type="String" mode="IN" optional="false"/>
+        <attribute name="partyId" type="String" mode="IN" optional="true"/>
+        <attribute name="companyNameOnCard" type="String" mode="IN" optional="true"/>
+        <attribute name="titleOnCard" type="String" mode="IN" optional="true"/>
+        <attribute name="firstNameOnCard" type="String" mode="IN" optional="false"/>
+        <attribute name="middleNameOnCard" type="String" mode="IN" optional="true"/>
+        <attribute name="lastNameOnCard" type="String" mode="IN" optional="false"/>
+        <attribute name="suffixOnCard" type="String" mode="IN" optional="true"/>
+        <attribute name="contactMechId" type="String" mode="IN" optional="true"/>
+        <attribute name="paymentMethodId" type="String" mode="IN" optional="true"/>
+        <attribute name="paymentMethodId" type="String" mode="OUT" optional="false"/>
+    </service>
+

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=692448&r1=692447&r2=692448&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  5 07:08:18 2008
@@ -925,5 +925,61 @@
         </if-empty>
         <field-to-result field-name="stateList"/>
     </simple-method>
+
+    <simple-method method-name="createUpdatePerson" short-description="Create and update a person" login-required="false">
+        <call-map-processor xml-resource="org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml"
+                processor-name="person" in-map-name="parameters" out-map-name="personMap"/>
+        <check-errors/>
+        <set field="partyId" from-field="parameters.partyId"/>
+        <set-service-fields service-name="createPerson" map-name="personMap" to-map-name="personContext"/>
+        <if-empty field="partyId">
+            <call-service service-name="createPerson" in-map-name="personContext">
+                <result-to-field result-name="partyId" field-name="partyId"/>
+            </call-service>
+        <else><!-- If partyId already exists. -->
+            <set field="personContext.partyId" from-field="partyId"/>
+            <set field="personContext.userLogin" from-field="parameters.userLogin"/>
+            <call-service service-name="updatePerson" in-map-name="personContext"/>
+            <log level="info" message="Party Updated partyId is ${partyId}"/>
+        </else>
+        </if-empty>
+        <field-to-result field-name="partyId"/>
+    </simple-method>
     
+    <simple-method method-name="createUpdateTelecomNumber" short-description="Create and update phone number" login-required="false">
+        <if-empty field="parameters.contactMechId">
+            <set-service-fields service-name="createPartyTelecomNumber" map-name="parameters" to-map-name="phoneContext"/>
+            <call-service service-name="createPartyTelecomNumber" in-map-name="phoneContext">
+                <result-to-field result-name="contactMechId" field-name="contactMechId"/>
+            </call-service>
+            <log level="info" message="Phone Contact created phoneContactMechId is ${contactMechId}"/>
+        <else>
+            <set-service-fields service-name="createPartyTelecomNumber" map-name="parameters" to-map-name="phoneContext"/>
+            <call-service service-name="updatePartyTelecomNumber" in-map-name="phoneContext">
+                <result-to-field result-name="contactMechId" field-name="contactMechId"/>
+            </call-service>
+            <log level="info" message="Phone Contact updated phoneContactMechId is ${contactMechId}"/>
+        </else>
+        </if-empty>
+        <field-to-result field-name="contactMechId"/>
+    </simple-method>
+    
+    <simple-method method-name="createUpdateEmailAddress" short-description="Create and update email address" login-required="false">
+        <if-empty field="parameters.contactMechId">
+            <set-service-fields service-name="createPartyEmailAddress" map-name="parameters" to-map-name="emailAddressContext"/>
+            <call-service service-name="createPartyEmailAddress" in-map-name="emailAddressContext">
+                <result-to-field result-name="contactMechId" field-name="contactMechId"/>
+            </call-service>
+            <log level="info" message="Email Contact Created emailContactMechId is ${contactMechId}"></log>
+        <else>
+            <set-service-fields service-name="updatePartyEmailAddress" map-name="parameters" to-map-name="emailAddressContext"/>
+            <call-service service-name="updatePartyEmailAddress" in-map-name="emailAddressContext">
+                <result-to-field result-name="contactMechId" field-name="contactMechId"/>
+            </call-service>
+            <log level="info" message="Email Contact updated emailContactMechId is ${contactMechId}"></log>
+        </else>
+        </if-empty>
+        <field-to-result field-name="contactMechId"/>
+    </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=692448&r1=692447&r2=692448&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/party/servicedef/services.xml Fri Sep  5 07:08:18 2008
@@ -1068,4 +1068,33 @@
         <auto-attributes entity-name="TelecomNumber" include="nonpk" mode="IN" optional="true"/>
         <attribute name="phoneContactMechId" type="String" mode="IN" optional="true"/>
     </service>
+    <service name="createUpdatePerson" engine="simple" default-entity-name="Person"
+            location="component://party/script/org/ofbiz/party/party/PartyServices.xml" invoke="createUpdatePerson" auth="false">
+        <description>Create and Update a person</description>
+        <auto-attributes mode="INOUT" include="pk" optional="true"/>
+        <auto-attributes mode="IN" include="nonpk" optional="true"/>
+        <attribute name="userLogin" type="GenericValue" mode="IN" optional="true"/>
+        <override name="firstName" optional="false"/>
+        <override name="lastName" optional="false"/>
+    </service>
+    <service name="createUpdateTelecomNumber" engine="simple"
+            location="component://party/script/org/ofbiz/party/party/PartyServices.xml" invoke="createUpdateTelecomNumber" auth="false">
+        <description>Create and Update telecom number</description>
+        <attribute name="partyId" type="String" mode="IN" optional="false"/>
+        <auto-attributes entity-name="PartyContactMech" include="all" mode="IN" optional="true"/>
+        <auto-attributes entity-name="TelecomNumber" include="nonpk" mode="IN" optional="true"/>
+        <attribute name="userLogin" type="GenericValue" mode="IN" optional="true"/>
+        <attribute name="contactMechPurposeTypeId" type="String" mode="IN" optional="true"/>
+        <attribute name="roleTypeId" type="String" mode="IN" optional="true"/>
+        <attribute name="contactMechId" type="String" mode="INOUT" optional="true"/>
+    </service>
+    <service name="createUpdateEmailAddress" engine="simple"
+        location="component://party/script/org/ofbiz/party/party/PartyServices.xml" invoke="createUpdateEmailAddress" auth="false">
+        <description>Create and Update email address</description>
+        <attribute name="partyId" type="String" mode="IN" optional="false"/>
+        <attribute name="userLogin" type="GenericValue" mode="IN" optional="true"/>
+        <attribute name="contactMechPurposeTypeId" type="String" mode="IN" optional="true"/>
+        <attribute name="emailAddress" type="String" mode="IN" optional="false"/>
+        <attribute name="contactMechId" type="String" mode="INOUT" optional="true"/>
+    </service>
 </services>