You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ha...@apache.org on 2009/10/16 04:48:27 UTC

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

Author: hansbak
Date: Fri Oct 16 02:48:27 2009
New Revision: 825745

URL: http://svn.apache.org/viewvc?rev=825745&view=rev
Log:
do not add duplicate email addresses to a party

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=825745&r1=825744&r2=825745&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 Fri Oct 16 02:48:27 2009
@@ -259,6 +259,22 @@
             <else><add-error><fail-property resource="PartyUiLabels" property="PartyEmailAddressNotFormattedCorrectly"/></add-error></else>
         </if-validate-method>
         <check-errors/>
+        
+        <!-- if e-mail address already exists simply return -->
+        <entity-condition list="partyAndContactMechs" entity-name="PartyAndContactMech">
+            <condition-list combine="and">
+                <condition-expr field-name="partyId" from-field="parameters.partyId"/>
+                <condition-expr field-name="infoString" from-field="parameters.emailAddress" ignore-case="true"/>
+            </condition-list>
+        </entity-condition>
+        <filter-list-by-date list="partyAndContactMechs"/>
+        <if-not-empty field="partyAndContactMechs">
+            <log level="info" message="E-mail address: ${parameters.emailAddress} already exists, did not add again.."/>
+            <first-from-list entry="existsPartyAndContactMech" list="partyAndContactMechs"/>
+            <field-to-result field="existsPartyAndContactMech.contactMechId" result-name="contactMechId"/>
+            <field-to-request field="existsPartyAndContactMech.contactMechId" request-name="contactMechId"/>
+            <return/>
+        </if-not-empty>
 
         <set-service-fields service-name="createPartyContactMech" map="parameters" to-map="createPartyContactMechMap"/>
         <set field="createPartyContactMechMap.infoString" from-field="parameters.emailAddress"/>