svn commit: r699636 - in /ofbiz/trunk/applications: ecommerce/webapp/ecommerce/WEB-INF/controller.xml party/script/org/ofbiz/party/communication/CommunicationEventServices.xml party/servicedef/services.xml

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

svn commit: r699636 - in /ofbiz/trunk/applications: ecommerce/webapp/ecommerce/WEB-INF/controller.xml party/script/org/ofbiz/party/communication/CommunicationEventServices.xml party/servicedef/services.xml

jleroux@apache.org
Author: jleroux
Date: Sat Sep 27 06:18:56 2008
New Revision: 699636

URL: http://svn.apache.org/viewvc?rev=699636&view=rev
Log:
Solves CommunicationEventRole issues in eCommerce
1) Contact us (request contactsubmit)  
2) Send  email (request sendmessage)
Should not affect other createCommunicationEvent or createCommunicationEventRole calls

Modified:
    ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml
    ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml
    ofbiz/trunk/applications/party/servicedef/services.xml

Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml?rev=699636&r1=699635&r2=699636&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml Sat Sep 27 06:18:56 2008
@@ -1222,7 +1222,7 @@
     </request-map>
     <request-map uri="sendmessage">
         <security https="true" auth="true"/>
-        <event type="service" invoke="createCommunicationEvent"/>
+        <event type="service" invoke="createCommunicationEventWithoutPermission"/>
         <response name="success" type="view" value="messagelist"/>
         <response name="error" type="view" value="messagecreate"/>
     </request-map>
@@ -1233,7 +1233,7 @@
     </request-map>
     <request-map uri="contactsubmit">
         <security https="true" auth="true"/>
-        <event type="service" invoke="createCommunicationEvent"/>
+        <event type="service" invoke="createCommunicationEventWithoutPermission"/>
         <response name="success" type="view" value="contactus"/>
         <response name="error" type="view" value="contactus"/>
     </request-map>

Modified: ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml?rev=699636&r1=699635&r2=699636&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml (original)
+++ ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml Sat Sep 27 06:18:56 2008
@@ -20,7 +20,19 @@
 
 <simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd">
-    <simple-method method-name="createCommunicationEvent" short-description="Create a CommunicationEvent">
+    
+    
+    <simple-method method-name="createCommunicationEventWithPermission" short-description="Create a CommunicationEvent with permission check">
+        <set field="parameters.permission" value="true"/>
+        <call-simple-method method-name="createCommunicationEvent"/>
+    </simple-method>
+        
+    <simple-method method-name="createCommunicationEventWithoutPermission" short-description="Create a CommunicationEvent without permission check">
+        <set field="parameters.permission" value="false"/>
+        <call-simple-method method-name="createCommunicationEvent"/>
+    </simple-method>
+        
+    <simple-method method-name="createCommunicationEvent" short-description="Create a CommunicationEvent with or w/o permission check">
         <if-not-empty field="parameters.parentCommEventId">
             <entity-and list-name="roles" entity-name="CommunicationEventRole">
                 <field-map field-name="communicationEventId" env-name="parameters.parentCommEventId"/>
@@ -92,7 +104,12 @@
             <set field="commRole.roleTypeId" value="ADDRESSEE" />
             <set field="commRole.contactMechId" from-field="newEntity.contactMechIdTo" />
             <set field="commRole.statusId" value="COM_ROLE_CREATED" />
-            <call-service service-name="createCommunicationEventRole" in-map-name="commRole"/>
+            <if-compare field="parameters.permission" value="true" operator="equals">
+                <call-service service-name="createCommunicationEventRole" in-map-name="commRole"/>
+                <else>
+                    <call-service service-name="createCommunicationEventRoleWithoutPermission" in-map-name="commRole"/>
+                </else>
+            </if-compare>
         </if-not-empty>
     
         <!-- partyIdFrom role-->
@@ -101,10 +118,16 @@
             <set field="commRole.partyId" from-field="newEntity.partyIdFrom" />
             <set field="commRole.roleTypeId" value="ORIGINATOR" />
             <set field="commRole.contactMechId" from-field="newEntity.contactMechIdFrom" />
-            <set field="commRole.statusId" value="COM_ROLE_COMPLETED" />
-            <call-service service-name="createCommunicationEventRole" in-map-name="commRole"/>
+            <set field="commRole.statusId" value="COM_ROLE_COMPLETED" />            
+            <if-compare field="parameters.permission" value="true" operator="equals">
+                <call-service service-name="createCommunicationEventRole" in-map-name="commRole"/>
+                <else>
+                    <call-service service-name="createCommunicationEventRoleWithoutPermission" in-map-name="commRole"/>
+                </else>
+            </if-compare>
         </if-not-empty>
     </simple-method>
+
     <simple-method method-name="updateCommunicationEvent"
         short-description="Update a CommunicationEvent">
         <entity-one entity-name="CommunicationEvent" value-name="event" />

Modified: ofbiz/trunk/applications/party/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/servicedef/services.xml?rev=699636&r1=699635&r2=699636&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/party/servicedef/services.xml Sat Sep 27 06:18:56 2008
@@ -647,16 +647,27 @@
         <attribute name="statusId" type="String" mode="IN" optional="false"/>
         <attribute name="oldStatusId" type="String" mode="OUT" optional="true"/>
     </service>
-    <service name="createCommunicationEvent" engine="simple"
-            location="org/ofbiz/party/communication/CommunicationEventServices.xml" invoke="createCommunicationEvent" auth="true">
-        <description>Create a Communication Event</description>
-        <permission-service service-name="partyCommunicationEventPermissionCheck" main-action="CREATE"/>
+
+    <service name="createCommunicationEventInterface" engine="interface" location="" invoke="">
+        <description>Create a Communication Event with or w/o permission check</description>
         <auto-attributes entity-name="CommunicationEvent" include="nonpk" mode="IN" optional="true"/>
         <auto-attributes entity-name="CommunicationEvent" include="pk" mode="INOUT" optional="true"/>
         <attribute name="productId" type="String" mode="IN" optional="true"/>
         <attribute name="orderId" type="String" mode="IN" optional="true"/>
         <attribute name="custRequestId" type="String" mode="IN" optional="true"/>
+    </service>    
+    <service name="createCommunicationEvent" engine="simple"
+            location="org/ofbiz/party/communication/CommunicationEventServices.xml" invoke="createCommunicationEventWithPermission" auth="true">
+        <description>Create a Communication Event with permission check</description>
+        <permission-service service-name="partyCommunicationEventPermissionCheck" main-action="CREATE"/>
+        <implements service="createCommunicationEventInterface"/>
+    </service>
+    <service name="createCommunicationEventWithoutPermission" engine="simple"
+            location="org/ofbiz/party/communication/CommunicationEventServices.xml" invoke="createCommunicationEventWithoutPermission" auth="true">
+        <description>Create a Communication Event without permission check</description>
+        <implements service="createCommunicationEventInterface"/>
     </service>
+
     <service name="updateCommunicationEvent" engine="simple"
             location="org/ofbiz/party/communication/CommunicationEventServices.xml" invoke="updateCommunicationEvent" auth="true">
         <description>Update a Communication Event</description>
@@ -699,12 +710,21 @@
         <permission-service service-name="partyCommunicationEventPermissionCheck" main-action="DELETE"/>
         <auto-attributes entity-name="CommunicationEventPurpose" include="pk" mode="IN" optional="false"/>
     </service>
+    <service name="createCommunicationEventRoleInterface" engine="interface" location="" invoke="">
+        <description>Create a Communication Event Role with or w/o permission check</description>
+        <auto-attributes entity-name="CommunicationEventRole" include="pk" mode="IN" optional="false"/>
+        <auto-attributes entity-name="CommunicationEventRole" include="nonpk" mode="IN" optional="true"/>
+    </service>    
     <service name="createCommunicationEventRole" engine="simple"
             location="org/ofbiz/party/communication/CommunicationEventServices.xml" invoke="createCommunicationEventRole" auth="true">
-        <description>Create a Communication Event Role</description>
+        <description>Create a Communication Event Role with permission check</description>
         <permission-service service-name="partyCommunicationEventPermissionCheck" main-action="CREATE"/>
-        <auto-attributes entity-name="CommunicationEventRole" include="pk" mode="IN" optional="false"/>
-        <auto-attributes entity-name="CommunicationEventRole" include="nonpk" mode="IN" optional="true"/>
+        <implements service="createCommunicationEventRoleInterface"/>
+    </service>
+    <service name="createCommunicationEventRoleWithoutPermission" engine="simple"
+            location="org/ofbiz/party/communication/CommunicationEventServices.xml" invoke="createCommunicationEventRole" auth="true">
+        <description>Create a Communication Event Role without permission check</description>
+        <implements service="createCommunicationEventRoleInterface"/>
     </service>
     <service name="updateCommunicationEventRole" engine="simple"
             location="org/ofbiz/party/communication/CommunicationEventServices.xml" invoke="updateCommunicationEventRole" auth="true">