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/09 07:44:36 UTC

svn commit: r823414 - /ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml

Author: hansbak
Date: Fri Oct  9 05:44:36 2009
New Revision: 823414

URL: http://svn.apache.org/viewvc?rev=823414&view=rev
Log:
move forward and eply actions together, closed the correct parent email, copy orginal and parent email id's

Modified:
    ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml

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=823414&r1=823413&r2=823414&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 Fri Oct  9 05:44:36 2009
@@ -44,8 +44,24 @@
                 <clear-field field="newEntity.partyIdTo"/>
                 <set field="newEntity.partyIdFrom" from-field="parameters.partyIdFrom"/>
                 <set field="newEntity.subject" value="Forw: ${newEntity.subject}"/>
+                <set field="newEntity.origCommEventId" from-field="parameters.origCommEventId"/>
+
+                <!-- Copy Attached Files For Forward Email-->
+                <entity-and entity-name="CommEventContentAssoc" list="commEventContentAssoc">
+                    <field-map field-name="communicationEventId" from-field="parameters.origCommEventId"/>
+                </entity-and>
+                <if-not-empty field="commEventContentAssoc">
+                    <iterate entry="createcommEventContentAssoc" list="commEventContentAssoc">
+                        <if-not-empty field="createcommEventContentAssoc">               
+                            <set field="contentAssoc.contentId" from-field="createcommEventContentAssoc.contentId"/>
+                            <set field="contentAssoc.communicationEventId" from-field="newEntity.communicationEventId"/>
+                            <call-service service-name="createCommEventContentAssoc" in-map-name="contentAssoc"></call-service>
+                        </if-not-empty>
+                    </iterate>
+                </if-not-empty>
             </if-not-empty>
         </if-compare>
+
         <if-empty field="newEntity">
             <make-value value-field="newEntity" entity-name="CommunicationEvent"/>
         </if-empty>
@@ -84,6 +100,7 @@
                 </if-compare>
                 <set field="newEntity.partyIdFrom" from-field="parameters.partyIdFrom" default-value="parameters.userLogin.partyId"/>
                 <set field="newEntity.partyIdTo" from-field="parentCommEvent.partyIdFrom"/>
+                <set field="newEntity.parentCommEventId" from-field="parentCommEvent.communicationEventId"/>
                 
                 <set field="newEntity.subject" value="RE: ${parentCommEvent.subject}"/>
                 
@@ -106,11 +123,29 @@
                     resultLine += &quot;\n&gt; &quot; + localContent.substring(startChar, localContent.indexOf(&quot;\n&quot;,startChar)==-1 ? localContent.length() : localContent.indexOf(&quot;\n&quot;,startChar));
                     return(resultLine);
                     }"/>
+
+                <!-- copy all other parties on the role list when reply to all -->
+                <if-compare field="parameters.action" value="REPLYALL" operator="equals">
+                    <entity-condition entity-name="CommunicationEventRole" list="roles">
+                        <condition-list combine="and">
+                            <condition-expr field-name="communicationEventId" from-field="parentCommEvent.communicationEventId"/>
+                            <condition-expr field-name="partyId" operator="not-equals" from-field="newEntity.partyIdTo"/>
+                            <condition-expr field-name="partyId" operator="not-equals" from-field="newEntity.partyIdFrom"/>
+                        </condition-list>
+                    </entity-condition>
+                    <if-not-empty field="roles">
+                        <iterate entry="role" list="roles">
+                            <set-service-fields service-name="createCommunicationEventRole" map="role" to-map="newRole"/>
+                            <set field="newRole.communicationEventId" from-field="newEntity.communicationEventId"/>
+                            <call-service service-name="createCommunicationEventRole" in-map-name="newRole"/>
+                        </iterate>
+                    </if-not-empty>
+                </if-compare>
                 
-                <!-- set rolestatus from original email to completed -->
+                <!-- set role status from yhe parent commevent to completed -->
                 <entity-and list="roles" entity-name="CommunicationEventRole">
                     <field-map field-name="communicationEventId" from-field="parentCommEvent.communicationEventId"/>
-                    <field-map field-name="partyId" from-field="parentCommEvent.partyIdTo"/>
+                    <field-map field-name="partyId" from-field="newEntity.partyIdFrom"/>
                 </entity-and>
                 <if-not-empty field="roles">
                     <first-from-list list="roles" entry="role"/>
@@ -174,23 +209,6 @@
         <now-timestamp field="newEntity.entryDate"/>
         <create-value value-field="newEntity"/>
 
-        <if-compare field="parameters.action" value="REPLYALL" operator="equals">
-            <entity-condition entity-name="CommunicationEventRole" list="roles">
-                <condition-list combine="and">
-                    <condition-expr field-name="communicationEventId" from-field="parentCommEvent.communicationEventId"/>
-                    <condition-expr field-name="partyId" operator="not-equals" from-field="newEntity.partyIdTo"/>
-                    <condition-expr field-name="partyId" operator="not-equals" from-field="newEntity.partyIdFrom"/>
-                </condition-list>
-            </entity-condition>
-            <if-not-empty field="roles">
-                <iterate entry="role" list="roles">
-                    <set-service-fields service-name="createCommunicationEventRole" map="role" to-map="newRole"/>
-                    <set field="newRole.communicationEventId" from-field="newEntity.communicationEventId"/>
-                    <call-service service-name="createCommunicationEventRole" in-map-name="newRole"/>
-                </iterate>
-            </if-not-empty>
-        </if-compare>
-        
         <if-not-empty field="parameters.productId">
             <make-value value-field="eventProduct" entity-name="CommunicationEventProduct"/>
             <set from-field="parameters.productId" field="eventProduct.productId"/>
@@ -229,20 +247,6 @@
             <call-service service-name="createCommunicationEventRoleWithoutPermission" in-map-name="commRole"/>
         </if-not-empty>
         
-        <!-- Check Attach File For Forward Email-->
-        <if-compare field="parameters.action" value="FORWARD" operator="equals">
-            <entity-and entity-name="CommEventContentAssoc" list="commEventContentAssoc">
-                <field-map field-name="communicationEventId" from-field="parameters.origCommEventId"/>
-            </entity-and>
-            <iterate entry="createcommEventContentAssoc" list="commEventContentAssoc">
-                <if-not-empty field="createcommEventContentAssoc">               
-                    <!-- Create communication event and content association -->
-                    <set field="contentAssoc.contentId" from-field="createcommEventContentAssoc.contentId"/>
-                    <set field="contentAssoc.communicationEventId" from-field="newEntity.communicationEventId"/>
-                    <call-service service-name="createCommEventContentAssoc" in-map-name="contentAssoc"></call-service>
-                </if-not-empty>
-            </iterate>
-        </if-compare>  
     </simple-method>
 
     <simple-method method-name="updateCommunicationEvent"