Wouldn't it be better to change it so that when the crmsfa module is
added to a stock OFBiz installation that it doesn't break other
functionality or destroy data because of something like this?
It shouldn't be too hard to somehow model that a certain WorkEffort
is dependent on a CommunicationEvent record and should therefore be
deleted with the CommunicationEvent is deleted.
Of course, stepping back a bit from that: why would you ever want to
delete a CommunicationEvent?
-David
On Nov 24, 2006, at 12:06 PM, Si Chen wrote:
David, Hans -
I think I can shed some light on this. In the opentaps CRMSFA each
incoming and outgoing email communicationevent is wrapped with a
workeffort, so Hans is probably trying to clear out these
workefforts when the related commevents are removed. I do agree
with David, however, in that this may not be the right practice for
the core OFBIZ core, because there is not necessarily a commevent -
workeffort linkage here. For example, a workeffort could be a
manufacturig production step, and the commevent could be a message
related to that production task. Under those circumstances,
canceling or removing the commevent should not cause the workeffort
to be removed as well.
Hans - I think it's best that you revert this here in ofbiz and
then do something to tie the two together in your branch of the
opentaps crmsfa module, like a seca or a wrapper service?
On Nov 22, 2006, at 12:49 PM, David E Jones wrote:
Hans,
Could you explain what you're shooting for here?
It seems a little funny to remove a WorkEffort when a
CommunicationEvent is associated with it and it is the only
CommunicationEvent associated with that WorkEffort. That assumes
that the CommunicationEvent is the dominant entity and controls
what happens with a WorkEffort when they are used together. I'm
having a hard time coming up with a situation where that would be
the case, but I can think of various situations where the
WorkEffort is the dominant entity and you wouldn't want it removed
when a CommunicationEvent associated with it is removed if it's
the only comm-event...
-David
On Nov 22, 2006, at 2:17 AM, [EMAIL PROTECTED] wrote:
Author: hansbak
Date: Wed Nov 22 01:17:30 2006
New Revision: 478095
URL: http://svn.apache.org/viewvc?view=rev&rev=478095
Log:
the delete communicationEvent service now also deletes the
related workeffort if this commubication event is the only one
attached to the woreffort.
Modified:
incubator/ofbiz/trunk/applications/party/script/org/ofbiz/
party/communication/CommunicationEventServices.xml
incubator/ofbiz/trunk/applications/party/servicedef/services.xml
Modified: incubator/ofbiz/trunk/applications/party/script/org/
ofbiz/party/communication/CommunicationEventServices.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/
applications/party/script/org/ofbiz/party/communication/
CommunicationEventServices.xml?
view=diff&rev=478095&r1=478094&r2=478095
====================================================================
==========
--- incubator/ofbiz/trunk/applications/party/script/org/ofbiz/
party/communication/CommunicationEventServices.xml (original)
+++ incubator/ofbiz/trunk/applications/party/script/org/ofbiz/
party/communication/CommunicationEventServices.xml Wed Nov 22
01:17:30 2006
@@ -16,8 +16,9 @@
under the License.
-->
-<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance"
- xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/
simple-methods.xsd">
+<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance"
+ xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/
simple-methods.xsd">
+ <!-- xsi:noNamespaceSchemaLocation="../../../../../../../
framework/minilang/dtd/simple-methods.xsd"-->
<simple-method method-name="createCommunicationEvent" short-
description="Create a CommunicationEvent">
<if>
<condition>
@@ -110,8 +111,25 @@
</if-compare>
</iterate>
</if-not-empty>
+ <!-- remove related workeffort when this is the only
communicationevent connected to it -->
+ <get-related value-name="event" relation-
name="CommunicationEventWorkEff" list-name="workEffortComs"/>
+ <if-not-empty field-name="workEffortComs">
+ <iterate entry-name="workEffortCom" list-
name="workEffortComs">
+ <remove-value value-name="workEffortCom"/>
+ <get-related-one value-name="workEffortCom"
relation-name="WorkEffort" to-value-name="workEffort"/>
+ <get-related value-name="workEffort" relation-
name="CommunicationEventWorkEff" list-name="otherComs"/>
+ <if-empty field-name="otherComs">
+ <log level="info" message="remove workeffort
${workEffort.workEffortId} and related parties and status"/>
+ <remove-related value-name="workEffort"
relation-name="WorkEffortPartyAssignment"/>
+ <remove-related value-name="workEffort"
relation-name="WorkEffortStatus"/>
+ <remove-value value-name="workEffort"/>
+ <set field="workEffortMessage" value="and
worEffort [${workEffort.workEffortId}]"/>
+ </if-empty>
+ </iterate>
+ </if-not-empty>
<!-- delete the event itself -->
<remove-value value-name="event"/>
+ <set field="successMessage" value="Communication [$
{event.communicationEventId}] ${workEffortMessage} deleted "/>
</simple-method>
<!-- since these ancillary operations on communication event
cause them to be updated,
they will all use the CME_UPDATE permission -->
Modified: incubator/ofbiz/trunk/applications/party/servicedef/
services.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/
applications/party/servicedef/services.xml?
view=diff&rev=478095&r1=478094&r2=478095
====================================================================
==========
--- incubator/ofbiz/trunk/applications/party/servicedef/
services.xml (original)
+++ incubator/ofbiz/trunk/applications/party/servicedef/
services.xml Wed Nov 22 01:17:30 2006
@@ -591,7 +591,8 @@
</service>
<service name="deleteCommunicationEvent" engine="simple"
location="org/ofbiz/party/communication/
CommunicationEventServices.xml" invoke="deleteCommunicationEvent"
auth="true">
- <description>Delete a Communication Event</description>
+ <description>Delete a Communication Event, optionally
delete the attached content and dataresource
+ and when this is the only communication
event connected to a workeffort delete the workeffort too.</
description>
<auto-attributes entity-name="CommunicationEvent"
include="pk" mode="IN" optional="false"/>
<attribute name="delContentDataResource" type="String"
mode="IN" optional="true"/>
</service>
Best Regards,
Si
[EMAIL PROTECTED]