Author: hansbak
Date: Thu Jul 24 14:19:05 2008
New Revision: 679549

URL: http://svn.apache.org/viewvc?rev=679549&view=rev
Log:
ad an optional parameter to the delete communication role service to delete the 
communication event if there are no roles left

Modified:
    
ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml
    ofbiz/trunk/applications/party/servicedef/services.xml
    ofbiz/trunk/specialpurpose/mypage/widget/MyPageForms.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=679549&r1=679548&r2=679549&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 Jul 24 14:19:05 2008
@@ -226,9 +226,17 @@
         </if-not-empty>
     </simple-method>
     <simple-method method-name="removeCommunicationEventRole" 
short-description="Remove a CommunicationEventRole">
-                
         <entity-one entity-name="CommunicationEventRole" 
value-name="eventRole"/>        
         <remove-value value-name="eventRole"/>
+        <if-compare field="parameters.deleteCommEventIfLast" operator="equals" 
value="Y">
+            <entity-and list-name="roles" entity-name="CommunicationEventRole">
+                <field-map field-name="communicationEventId" 
env-name="eventRole.communicationEventId"/>
+            </entity-and>
+            <if-empty field="roles">
+                <set-service-fields service-name="deleteCommunicationEvent" 
map-name="parameters" to-map-name="inMapDel"/>
+                <call-service service-name="deleteCommunicationEvent" 
in-map-name="inMapDel"/>
+            </if-empty>
+        </if-compare>
     </simple-method>
 
     <simple-method method-name="markEventRead" short-description="Marks a 
Communication Event as Read">

Modified: ofbiz/trunk/applications/party/servicedef/services.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/servicedef/services.xml?rev=679549&r1=679548&r2=679549&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/party/servicedef/services.xml Thu Jul 24 14:19:05 
2008
@@ -708,6 +708,8 @@
         <description>Remove a Communication Event Role</description>
         <permission-service 
service-name="partyCommunicationEventPermissionCheck" main-action="UPDATE"/>
         <auto-attributes entity-name="CommunicationEventRole" include="pk" 
mode="IN" optional="false"/>
+        <attribute name="deleteCommEventIfLast" mode="IN" type="String" 
optional="true"/><!-- "Y" for true -->
+        <attribute name="delContentDataResource" type="String" mode="IN" 
optional="true"/>
     </service>
     <service name="createCommEventWorkEffort" engine="simple" 
location="org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml" 
invoke="makeCommunicationEventWorkEffort" auth="true"  >
         <description>Creates a WorkEffort entity and 
CommunicationEventWorkEff</description>

Modified: ofbiz/trunk/specialpurpose/mypage/widget/MyPageForms.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/mypage/widget/MyPageForms.xml?rev=679549&r1=679548&r2=679549&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/mypage/widget/MyPageForms.xml (original)
+++ ofbiz/trunk/specialpurpose/mypage/widget/MyPageForms.xml Thu Jul 24 
14:19:05 2008
@@ -97,13 +97,13 @@
         </row-actions>
         <field name="roleTypeId"><display-entity entity-name="RoleType" 
description="${description}"/></field> 
         <field use-when="headerItem.equals(&quot;main&quot;)" 
name="removeLink" title="${uiLabelMap.CommonEmptyHeader}" 
widget-style="smallSubmit">
-            <hyperlink also-hidden="false" 
description="${uiLabelMap.CommonDelete}" 
target="deletePartyCommunicationEventRole?partyId=${partyId}&amp;communicationEventId=${communicationEventId}&amp;roleTypeId=${roleTypeId}"/>
+            <hyperlink also-hidden="false" 
description="${uiLabelMap.CommonDelete}" 
target="deletePartyCommunicationEventRole?partyId=${partyId}&amp;communicationEventId=${communicationEventId}&amp;roleTypeId=${roleTypeId}&amp;deleteCommEventIfLast=Y&amp;delContentDataResource=Y"/>
         </field>
         <field use-when="headerItem.equals(&quot;myCommunications&quot;)" 
name="removeLink" title="${uiLabelMap.CommonEmptyHeader}" 
widget-style="smallSubmit">
-            <hyperlink also-hidden="false" 
description="${uiLabelMap.CommonDelete}" 
target="deletePartyCommunicationEventMyRole?partyId=${partyId}&amp;communicationEventId=${communicationEventId}&amp;roleTypeId=${roleTypeId}"/>
+            <hyperlink also-hidden="false" 
description="${uiLabelMap.CommonDelete}" 
target="deletePartyCommunicationEventMyRole?partyId=${partyId}&amp;communicationEventId=${communicationEventId}&amp;roleTypeId=${roleTypeId}&amp;deleteCommEventIfLast=Y&amp;delContentDataResource=Y"/>
         </field>
         <field use-when="headerItem.equals(&quot;otherCommunications&quot;)" 
name="removeLink" title="${uiLabelMap.CommonEmptyHeader}" 
widget-style="smallSubmit">
-            <hyperlink also-hidden="false" 
description="${uiLabelMap.CommonDelete}" 
target="deletePartyCommunicationEventOthersRole?partyId=${partyId}&amp;communicationEventId=${communicationEventId}&amp;roleTypeId=${roleTypeId}"/>
+            <hyperlink also-hidden="false" 
description="${uiLabelMap.CommonDelete}" 
target="deletePartyCommunicationEventOthersRole?partyId=${partyId}&amp;communicationEventId=${communicationEventId}&amp;roleTypeId=${roleTypeId}&amp;deleteCommEventIfLast=Y&amp;delContentDataResource=Y"/>
         </field>
         <field use-when="headerItem.equals(&quot;main&quot;)" name="subject" 
widget-style="buttontext" widget-area-style="fieldWidth300">
             <hyperlink description="${subject} " 
target="ViewCommunicationEvent?communicationEventId=${communicationEventId}&amp;partyId=${partyId}&amp;roleTypeId=${roleTypeId}&amp;type=main"/>


Reply via email to