svn commit: r954583 - /ofbiz/trunk/applications/party/script/org/ofbiz/party/contact/PartyContactMechServices.xml

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

svn commit: r954583 - /ofbiz/trunk/applications/party/script/org/ofbiz/party/contact/PartyContactMechServices.xml

jleroux@apache.org
Author: jleroux
Date: Mon Jun 14 18:40:05 2010
New Revision: 954583

URL: http://svn.apache.org/viewvc?rev=954583&view=rev
Log:
Fix a bug that seems to have been introduced at r934389 for (https://issues.apache.org/jira/browse/OFBIZ-3703) - OFBIZ-3703

This fix a bug in updatePartyContactMech. When you wanted to update only the extension of a phone number it did not get stored.
I said "that seems to have been introduced" because it's working in stable demo.

I also remove a useless couple of lines at the beginning of the updatePartyContactMech service.

Finally I must say that I find very weird to have extension in PartyContactMech entity. It would be certainly more logical to have in TelecomNumber. Is it really used for anything else than phone number extension?

Modified:
    ofbiz/trunk/applications/party/script/org/ofbiz/party/contact/PartyContactMechServices.xml

Modified: ofbiz/trunk/applications/party/script/org/ofbiz/party/contact/PartyContactMechServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/script/org/ofbiz/party/contact/PartyContactMechServices.xml?rev=954583&r1=954582&r2=954583&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/script/org/ofbiz/party/contact/PartyContactMechServices.xml (original)
+++ ofbiz/trunk/applications/party/script/org/ofbiz/party/contact/PartyContactMechServices.xml Mon Jun 14 18:40:05 2010
@@ -71,11 +71,6 @@ under the License.
     </simple-method>
 
     <simple-method method-name="updatePartyContactMech" short-description="Update a PartyContactMech">
-        <make-value entity-name="PartyContactMech" value-field="newPartyContactMech"/>
-        <if-empty field="parameters.partyId">
-            <set field="parameters.partyId" from-field="userLogin.partyId"/>
-        </if-empty>
-
         <!-- Find old value -->
         <make-value entity-name="PartyContactMech" value-field="partyContactMechMap"/>
         <set-pk-fields value-field="partyContactMechMap" map="parameters"/>
@@ -85,11 +80,10 @@ under the License.
         <if-empty field="partyContactMech">
             <add-error><fail-property resource="PartyUiLabels" property="PartyCannotUpdateContactBecauseNotWithSpecifiedParty"/></add-error>
         </if-empty>
-
         <check-errors/>
 
         <clone-value value-field="partyContactMech" new-value-field="newPartyContactMech"/>
-
+        
         <!-- If we already have a new contactMechId don't update ContactMech -->
         <if-empty field="parameters.newContactMechId">
             <set-service-fields service-name="updateContactMech" map="parameters" to-map="updateContactMechMap"/>
@@ -102,12 +96,11 @@ under the License.
                 <log level="info" message="Using supplied new contact mech id: ${newPartyContactMech.contactMechId}"/>
             </else>
         </if-empty>
-
-        <set-nonpk-fields value-field="newPartyContactMech" map="parameters"/>
-        <now-timestamp field="newPartyContactMech.fromDate"/>
-        <now-timestamp field="partyContactMech.thruDate"/>
-
+        
         <if-compare-field to-field="newPartyContactMech.contactMechId" field="parameters.contactMechId" operator="not-equals">
+            <set-nonpk-fields value-field="newPartyContactMech" map="parameters"/>
+            <now-timestamp field="newPartyContactMech.fromDate"/>
+            <now-timestamp field="partyContactMech.thruDate"/>
             <store-value value-field="partyContactMech"/>
             <create-value value-field="newPartyContactMech"/>
             <get-related value-field="partyContactMech" relation-name="PartyContactMechPurpose" list="partyContactMechPurposes"/>
@@ -127,11 +120,21 @@ under the License.
                     <create-value value-field="partyContactMechPurpose"/>
                 </if-empty>
             </iterate>
+            <log level="info" message="Setting id to result: ${newPartyContactMech.contactMechId}"/>
+            <field-to-result field="newPartyContactMech.contactMechId" result-name="contactMechId"/>
+            <field-to-request field="newPartyContactMech.contactMechId" request-name="contactMechId"/>
+            <else>
+                <if-compare-field field="parameters.extension" operator="not-equals" to-field="partyContactMech.extension">
+                    <set field="partyContactMech.extension" from-field="parameters.extension"/>
+                    <set field="partyContactMech.thruDate" value=""/>
+                    <store-value value-field="partyContactMech"/>
+                </if-compare-field>
+                <log level="info" message="Setting id to result: ${partyContactMech.contactMechId}"/>
+                <field-to-result field="partyContactMech.contactMechId" result-name="contactMechId"/>
+                <field-to-request field="partyContactMech.contactMechId" request-name="contactMechId"/>
+            </else>
         </if-compare-field>
 
-        <log level="info" message="Setting id to result: ${newPartyContactMech.contactMechId}"/>
-        <field-to-result field="newPartyContactMech.contactMechId" result-name="contactMechId"/>
-        <field-to-request field="newPartyContactMech.contactMechId" request-name="contactMechId"/>
     </simple-method>
 
     <simple-method method-name="deletePartyContactMech" short-description="Delete a PartyContactMech">