Author: hansbak
Date: Fri Oct  9 07:41:06 2009
New Revision: 823439

URL: http://svn.apache.org/viewvc?rev=823439&view=rev
Log:
partly revert 823414: move reply/forward together

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=823439&r1=823438&r2=823439&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 07:41:06 2009
@@ -45,20 +45,6 @@
                 <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>
 
@@ -101,7 +87,7 @@
                 <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}"/>
                 
                 <set field="newEntity.content" value="${groovy:
@@ -123,26 +109,8 @@
                     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 role status from yhe parent commevent to completed -->
+                <!-- set role status from the 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="newEntity.partyIdFrom"/>
@@ -209,6 +177,24 @@
         <now-timestamp field="newEntity.entryDate"/>
         <create-value value-field="newEntity"/>
 
+        <!-- below actions can only be done when the the commevent exists -->
+        <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"/>
@@ -247,6 +233,20 @@
             <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"


Reply via email to