Author: hansbak
Date: Thu Aug  7 16:45:28 2008
New Revision: 683754

URL: http://svn.apache.org/viewvc?rev=683754&view=rev
Log:
automatically update the role when either partyIdFro/to is modified on the 
communication event, delete unused ftl, corrected the add role to commevent 
screen

Removed:
    
ofbiz/trunk/applications/party/webapp/partymgr/communication/listCommunications.ftl
Modified:
    
ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml
    ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml
    ofbiz/trunk/applications/party/widget/partymgr/CommunicationScreens.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=683754&r1=683753&r2=683754&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
 Thu Aug  7 16:45:28 2008
@@ -105,16 +105,62 @@
             <call-service service-name="createCommunicationEventRole" 
in-map-name="commRole"/>
         </if-not-empty>
     </simple-method>
-
-    <simple-method method-name="updateCommunicationEvent" 
short-description="Update a CommunicationEvent">
-        <entity-one entity-name="CommunicationEvent" value-name="event"/>
-        <set field="oldStatusId" from-field="event.statusId"/>
-        <set-nonpk-fields map-name="parameters" value-name="event"/>
-        <if-compare-field operator="not-equals" field="event.statusId" 
to-field="oldStatusId">
-            <call-simple-method  method-name="setCommunicationEventStatus"/>   
     
-        </if-compare-field>
-        <store-value value-name="event"/>
-    </simple-method>
+       <simple-method method-name="updateCommunicationEvent"
+               short-description="Update a CommunicationEvent">
+               <entity-one entity-name="CommunicationEvent" value-name="event" 
/>
+               <set field="oldStatusId" from-field="event.statusId" />
+               <set-nonpk-fields map-name="parameters" value-name="event" />
+               <if-compare-field operator="not-equals" field="event.statusId"
+                       to-field="oldStatusId">
+                       <call-simple-method 
method-name="setCommunicationEventStatus" />
+               </if-compare-field>
+               <store-value value-name="event" />
+        
+        <!-- if the from- or to-party changed change also the roles -->
+               <if-not-empty field="parameters.partyIdFrom">
+                       <if-compare operator="not-equals" 
value="parameters.partIdFrom" field="event.partyIdFrom">
+                <!-- check if role exist then delete old role -->
+                               <entity-one entity-name="CommunicationEventRole"
+                                       value-name="roleFrom">
+                                       <field-map 
field-name="communicationEventId" env-name="event.communicationEventId" />
+                                       <field-map field-name="partyId" 
env-name="parameters.partyIdFrom" />
+                    <field-map field-name="roleTypeId" value="ORIGINATOR" />
+                               </entity-one>
+                               <if-not-empty field="roleFrom">
+                                       <remove-value value-name="roleFrom" />
+                               </if-not-empty>
+                <!-- add new role -->
+                               <set field="newRoleFrom.communicationEventId" 
from-field="event.communicationEventId" />
+                               <set field="newRoleFrom.partyId" 
from-field="event.partyIdFrom" />
+                <set field="newRoleFrom.roleTypeId" value="ORIGINATOR" />
+                <set field="newRoleFrom.contactMechId" 
from-field="event.contactMechIdFrom" />
+                               <call-service 
service-name="createCommunicationEventRole"
+                                       in-map-name="newRoleFrom" />
+                       </if-compare>
+               </if-not-empty>
+               <if-not-empty field="parameters.partyIdTo">
+                       <if-compare operator="not-equals" 
value="parameters.partIdTo"
+                               field="event.partyIdTo">
+                <!-- check if role exist then delete old role -->
+                               <entity-one entity-name="CommunicationEventRole"
+                                       value-name="roleTo">
+                                       <field-map 
field-name="communicationEventId" env-name="event.communicationEventId" />
+                                       <field-map field-name="partyId" 
env-name="event.partyIdTo" />
+                                       <field-map field-name="roleTypeId" 
value="ADDRESSEE" />
+                    <set field="newRoleFrom.contactMechId" 
from-field="event.contactMechIdTo" />
+                               </entity-one>
+                               <if-not-empty field="roleTo">
+                                       <remove-value value-name="roleTo" />
+                               </if-not-empty>
+                <!-- add new role -->
+                               <set field="newRoleTo.communicationEventId" 
from-field="event.communicationEventId" />
+                               <set field="newRoleTo.partyId" 
from-field="event.partyIdTo" />
+                               <set field="newRoleTo.roleTypeId" 
value="ADDRESSEE" />
+                               <call-service 
service-name="createCommunicationEventRole"
+                                       in-map-name="newRoleTo" />
+                       </if-compare>
+               </if-not-empty>
+       </simple-method>
 
     <simple-method method-name="deleteCommunicationEvent" 
short-description="Delete a CommunicationEvent">
         <entity-one entity-name="CommunicationEvent" value-name="event"/>
@@ -323,8 +369,8 @@
                    <set field="newEmail.emailAddress" 
from-field="parameters.emailAddress" />
                    <call-service service-name="createPartyEmailAddress"
                            in-map-name="newEmail">
-                       <result-to-field result-name="contactMechId"
-                               field-name="inCom.contactMechIdFrom" />
+                           <result-to-field result-name="contactMechId"
+                                   field-name="inCom.contactMechIdFrom" />
                    </call-service>
            </if-not-empty>
 
@@ -333,15 +379,7 @@
         <set field="inCom.partyIdFrom" from-field="parameters.partyId"/>
         <set field="inCom.statusId" value="COM_ENTERED"/>
         <call-service service-name="updateCommunicationEvent" 
in-map-name="inCom"/>
-        
-        <!-- and add a role -->
-        <set field="inComRole.communicationEventId" 
from-field="parameters.communicationEventId"/>
-        <set field="inComRole.partyId" from-field="parameters.partyId"/>
-        <set field="inComRole.roleTypeId" value="ORIGINATOR"/>
-        <set field="inComRole.statusId" value="COM_ROLE_COMPLETED"/>
-        <set field="inComRole.contactMechId" 
from-field="inCom.contactMechIdFrom" />
-        <call-service service-name="createCommunicationEventRole" 
in-map-name="inComRole"/>
-        
+
         <field-to-request field-name="parameters.communicationEventId" 
request-name="communicationEventId"/>
         <entity-one entity-name="PartyNameView" value-name="nameView"/>
         <set field="_event_message_" value="Email addres: 
${parameters.emailAddress} allocated to party: 
${nameView.groupName}${nameView.firstName} ${nameView.middleName} 
${nameView.lastName}[${parameters.partyId}]"/>

Modified: 
ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml?rev=683754&r1=683753&r2=683754&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml 
(original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml 
Thu Aug  7 16:45:28 2008
@@ -471,17 +471,15 @@
                 <field-map field-name="communicationEventId" 
env-name="parameters.communicationEventId"/>
             </entity-and>
         </actions>
-    
-        <field name="editContent" widget-style="smallSubmit">
-            <hyperlink also-hidden="false" 
description="${uiLabelMap.CommonEdit}" 
target="EditCommContent?contentId=${contentId}&amp;dataResourceId=${dataResourceId}&amp;communicationEventId=${communicationEventId}&amp;fromDate=${fromDate}"/>
 
-        </field>
-        <field name="viewContent" widget-style="smallSubmit">
-            <hyperlink also-hidden="false" 
description="${uiLabelMap.CommonView}" 
target="ViewSimpleContent?contentId=${contentId}&amp;dataResourceId=${dataResourceId}&amp;communicationEventId=${communicationEventId}&amp;fromDate=${fromDate}"/>
 
+        <field name="contentName" widget-style="smallSubmit">
+            <hyperlink also-hidden="false" description="${contentName} 
[${contentId}]" 
target="ViewSimpleContent?contentId=${contentId}&amp;dataResourceId=${dataResourceId}&amp;communicationEventId=${communicationEventId}&amp;fromDate=${fromDate}"/>
 
         </field>
-        <field name="contentName"><display/></field>
-        <field name="contentId"><display/></field>
+        <field name="contentTypeId"><display-entity entity-name="ContentType" 
description="${description}"/></field>
         <field name="fromDate"><display/></field>
-        <field name="dataResourceId"><display/></field>
+        <field name="drDataResourceName" widget-style="smallSubmit">
+            <hyperlink also-hidden="false" description="${drDataResourceName} 
[${drDataResourceId}]" 
target="/content/control/editDataResource?dataResourceId=${drDataResourceId}" 
target-type="inter-app"/> 
+        </field>
+        <field name="drMimeTypeId"><display-entity entity-name="MimeType" 
description="${description}" key-field-name="mimeTypeId"/></field>
     </form>
 
     <form name="addCommContent" type="single" 
target="createCommContentDataResource" 
@@ -643,7 +641,7 @@
         <actions>
             <script 
location="component://party/webapp/partymgr/WEB-INF/actions/communication/getPartyEmailFromCommEventInfo.groovy"/>
         </actions>
-        <field name="donePage"><hidden value="${parameters.donePage}"/></field>
+        <field name="donePage"><hidden value="${donePage}"/></field>
         <field name="communicationEventId"><hidden 
value="${parameters.communicationEventId}"/></field>
         <field name="partyId" tooltip="leave empty for new 'Party'"><lookup 
target-form-name="LookupPartyName"/></field>
         <field name="emailAddress"><text/></field>
@@ -654,7 +652,7 @@
     </form>
     <form name="deleteEmail" type="single" title="delete the email"
         target="deleteUnknownCommunicationEvent">
-        <field name="donePage"><hidden value="${parameters.donePage}"/></field>
+        <field name="donePage"><hidden value="${donePage}"/></field>
         <field name="communicationEventId"><hidden 
value="${parameters.communicationEventId}"/></field>
         <field name="delContentDataResource"><hidden value="Y"/></field>
         <field name="" position="1"><display/></field>

Modified: 
ofbiz/trunk/applications/party/widget/partymgr/CommunicationScreens.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/widget/partymgr/CommunicationScreens.xml?rev=683754&r1=683753&r2=683754&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/widget/partymgr/CommunicationScreens.xml 
(original)
+++ ofbiz/trunk/applications/party/widget/partymgr/CommunicationScreens.xml Thu 
Aug  7 16:45:28 2008
@@ -48,7 +48,7 @@
                                 </section>
                                 <include-menu 
location="component://party/webapp/partymgr/communication/CommMenus.xml" 
name="CommFindTabBar"/>
                                 <container><label style="h1" 
text="${uiLabelMap.PartyPendingCommunicationEvents}"/></container>
-                                <container><link style="smallSubmit" 
target="viewCommunicationEvent?partyId=${partyId}" 
text="${uiLabelMap.PartyNewCommunication}"/></container>
+                                <container><link style="smallSubmit" 
target="ViewCommunicationEvent?partyId=${partyId}" 
text="${uiLabelMap.PartyNewCommunication}"/></container>
                                 <include-form 
location="component://party/webapp/partymgr/communication/CommForms.xml" 
name="ListPendingCommEvents"/>
                             </widgets>
                             <fail-widgets>
@@ -417,11 +417,15 @@
                     location="${parameters.mainDecoratorLocation}">
                     <decorator-section name="body">
                         <screenlet title="${uiLabelMap.PartyCommEventRoles}">
-                            <container style="button-bar"><link 
style="smallSubmit" 
target="UpdateCommRoles?communicationEventId=${communicationEventId}&amp;partyId=${partyId}"
 text="${uiLabelMap.PartyNewCommRole}"/></container>
                             <include-form
                                 
location="component://party/webapp/partymgr/communication/CommForms.xml"
                                 name="ListCommRoles" />
                         </screenlet>
+                        <screenlet title="${uiLabelMap.PartyCommEventRoles}">
+                            <include-form
+                                
location="component://party/webapp/partymgr/communication/CommForms.xml"
+                                name="AddEventRole" />
+                        </screenlet>
                     </decorator-section>
                 </decorator-screen>
             </widgets>


Reply via email to