svn commit: r822537 - /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: r822537 - /ofbiz/trunk/applications/party/script/org/ofbiz/party/contact/PartyContactMechServices.xml

jleroux@apache.org
Author: jleroux
Date: Tue Oct  6 23:29:09 2009
New Revision: 822537

URL: http://svn.apache.org/viewvc?rev=822537&view=rev
Log:
Fix a false log info

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=822537&r1=822536&r2=822537&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 Tue Oct  6 23:29:09 2009
@@ -56,11 +56,12 @@
                 <result-to-field result-name="contactMechId" field="newValue.contactMechId"/>
             </call-service>
             <log level="info" message="ContactMech created"/>
+            <log level="info" message="Creating a PartyContactMech with id: ${newValue.contactMechId}"/>
             <else>
                 <set field="newValue.contactMechId" from-field="parameters.contactMechId"/>
+                <log level="info" message="Creating a PartyContactMech with id: ${parameters.contactMechId}"/>
             </else>
         </if-empty>
-        <log level="info" message="Creating a PartyContactMech with id: ${parameters.contactMechId}"/>
         <set field="newValue.partyId" from-field="parameters.partyId"/>
         <field-to-result field="newValue.contactMechId" result-name="contactMechId"/>
         <field-to-request field="newValue.contactMechId" request-name="contactMechId"/>
@@ -301,21 +302,21 @@
         </if-empty>
         <set field="input.inputFields.infoString_ic" from-field="parameters.caseInsensitive"/>
         <log level="info" message="findPartyFromEmailAddress with case insensitive search: ${parameters.caseInsensitive}"/>
-        
+
         <if-empty field="parameters.fromDate">
             <set field="input.filterByDate" value="Y"/>
             <else>
                 <set field="input.filterByDateValue" from-field="parameters.fromDate"/>
             </else>
         </if-empty>
-        
+
         <!-- try primary email address -->
         <set field="input.inputFields.contactMechPurposeTypeId" value="PRIMARY_EMAIL"/>
         <set field="input.entityName" value="PartyContactDetailByPurpose"/>
         <call-service service-name="performFindItem" in-map-name="input">
             <results-to-map map-name="results"/>
         </call-service>
-        
+
         <!-- any other email address -->
         <if-empty field="results.item">
             <set field="input.entityName" value="PartyAndContactMech"/>
@@ -323,15 +324,15 @@
             <call-service service-name="performFindItem" in-map-name="input">
                 <results-to-map map-name="results"/>
             </call-service>
-        </if-empty>        
-        
+        </if-empty>
+
         <if-not-empty field="results.item">
             <field-to-result field="results.item.partyId" result-name="partyId"/>
             <field-to-result field="results.item.contactMechId" result-name="contactMechId"/>
         </if-not-empty>
-        
+
     </simple-method>
-    
+
     <simple-method method-name="findPartyFromTelephone" short-description="Find partyId from the telephone number">
 
         <entity-and entity-name="PartyAndContactMech" list="contactMechs" filter-by-date="true">
@@ -340,9 +341,46 @@
 
         <set field="dash" value="-"/>
         <set field="emptyString" value=""/>
-        <set field="inputTelno" value="${str:replaceAll(parameters.telno, dash, emptyString)}"/>
+        <!--set field="inputTelno" value="${str:replaceAll(parameters.telno, dash, emptyString)}"/-->
+        <log level="always" message="parameters.telno====================${parameters.telno}"></log>
+        <log level="always" message="inputTelno====================${inputTelno}"></log>
+        <iterate entry="contactMech" list="contactMechs">
+            <set field="telno" from-field="contactMech.tnContactNumber"/>
+            <!--set field="telno" value="${str:replace(contactMech.tnContactNumber, dash, emptyString)}"/-->
+            <if-compare-field field="inputTelno" operator="equals" to-field="telno">
+                <set field="partyId" from-field="contactMech.partyId"/>
+            </if-compare-field>
+            <set field="telno" value="${contactMech.tnAreaCode}${telno}"/>
+            <if-compare-field field="inputTelno" operator="equals" to-field="telno">
+                <set field="partyId" from-field="contactMech.partyId"/>
+            </if-compare-field>
+            <set field="telno" value="${contactMech.tnCountryCode}${telno}"/>
+            <if-compare-field field="inputTelno" operator="equals" to-field="telno">
+                <set field="partyId" from-field="contactMech.partyId"/>
+            </if-compare-field>
+            <set field="telno" value="+${telno}"/>
+            <if-compare-field field="inputTelno" operator="equals" to-field="telno">
+                <set field="partyId" from-field="contactMech.partyId"/>
+            </if-compare-field>
+        </iterate>
+        <if-not-empty field="partyId">
+            <field-to-result field="partyId"/>
+            <field-to-result field="contactMech.contactMechId" result-name="contactMechId"/>
+        </if-not-empty>
+    </simple-method>
+
+    <simple-method method-name="findPartyFromTelephoneComplete" short-description="Find partyId from the telephone number">
+
+        <entity-and entity-name="PartyAndContactMech" list="contactMechs" filter-by-date="true">
+            <field-map field-name="contactMechTypeId" value="TELECOM_NUMBER"/>
+        </entity-and>
+
+        <set field="dash" value="-"/>
+        <set field="emptyString" value=""/>
+        <set field="inputTelno" from-field="parameters.telno"/>
         <iterate entry="contactMech" list="contactMechs">
-            <set field="telno" value="${str:replace(contactMech.tnContactNumber, dash, emptyString)}"/>
+            <set field="telno" from-field="contactMech.tnContactNumber"/>
+            <!--set field="telno" value="${str:replace(contactMech.tnContactNumber, dash, emptyString)}"/-->
             <if-compare-field field="inputTelno" operator="equals" to-field="telno">
                 <set field="partyId" from-field="contactMech.partyId"/>
             </if-compare-field>
@@ -364,7 +402,7 @@
             <field-to-result field="contactMech.contactMechId" result-name="contactMechId"/>
         </if-not-empty>
     </simple-method>
-    
+
     <simple-method method-name="createPostalAddressAndPurposes" short-description="Create postal address, purposes and set them defaults" login-required="false">
         <call-service service-name="createPartyPostalAddress" in-map-name="parameters">
             <result-to-field result-name="contactMechId" field="parameters.contactMechId"/>
@@ -552,7 +590,7 @@
             </call-service>
         </if-not-empty>
     </simple-method>
-    
+
     <simple-method method-name="createUpdatePartyEmailAddress" short-description="Create and update email address" login-required="false">
         <if-empty field="parameters.contactMechId">
             <set-service-fields service-name="createPartyEmailAddress" map="parameters" to-map="emailAddressContext"/>
@@ -573,7 +611,7 @@
         <field-to-result field="contactMech.infoString" result-name="emailAddress"/>
         <field-to-result field="contactMechId"/>
     </simple-method>
-    
+
     <simple-method method-name="createUpdatePartyTelecomNumber" short-description="Create and update phone number" login-required="false">
         <if-empty field="parameters.contactMechId">
             <set-service-fields service-name="createPartyTelecomNumber" map="parameters" to-map="phoneContext"/>
@@ -591,4 +629,4 @@
         </if-empty>
         <field-to-result field="contactMechId"/>
     </simple-method>
-</simple-methods>
\ No newline at end of file
+</simple-methods>