automatically update the role when either partyIdFro/to is modified on the communication event, delete unused ftl, corrected the add role to commevent screen

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@683754 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hans Bakker
2008-08-07 23:45:28 +00:00
parent 0e16880a69
commit f6b6ed7cb3
4 changed files with 74 additions and 141 deletions
@@ -105,16 +105,62 @@ under the License.
<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 @@ under the License.
<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 @@ under the License.
<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}]"/>
@@ -471,17 +471,15 @@ under the License.
<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 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="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>
<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 @@ under the License.
<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 @@ under the License.
</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>
@@ -1,107 +0,0 @@
<#--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<#if partyId?exists>
<div style="text-align: right;">
<a href="<@ofbizUrl>viewCommunicationEvent?partyIdFrom=${partyId}&partyId=${partyId}</@ofbizUrl>" class="buttontext">${uiLabelMap.PartyNewCommunication}</a>
</div>
</#if>
<br/>
<table class="basic-table" cellspacing="0">
<#assign target = requestAttributes.targetRequestUri>
<#if partyId?exists>
<#assign target = target + "?partyId=" + partyId + "&previousSort=" + previousSort>
<#else>
<#assign target = target + "?previousSort=" + previousSort>
</#if>
<#if eventList?has_content>
<tr>
<td colspan="9" width="50%">
<div align='right'>
<#if (eventListSize > 0)>
<#if (viewIndex > 1)>
<a href="<@ofbizUrl>${target}&VIEW_SIZE=${viewSize}&VIEW_INDEX=${viewIndex-1}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPrevious}</a>
<#else>
&nbsp;
</#if>
<#if (eventListSize > 0)>
<span class="label">${lowIndex} - ${highIndex} ${uiLabelMap.CommonOf} ${eventListSize}</span>
</#if>
<#if (eventListSize > highIndex)>
<a href="<@ofbizUrl>${target}&VIEW_SIZE=${viewSize}&VIEW_INDEX=${viewIndex+1}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonNext}</a>
<#else>
&nbsp;
</#if>
</#if>
&nbsp;
</div>
</td>
</tr>
<tr><td colspan="9">&nbsp;</td></tr>
</#if>
<tr>
<td><a href="<@ofbizUrl>${target}&VIEW_SIZE=${viewSize}&VIEW_INDEX=${viewIndex}&sort=communicationEventId</@ofbizUrl>">${uiLabelMap.PartyCommEvent} #</a></td>
<td><a href="<@ofbizUrl>${target}&VIEW_SIZE=${viewSize}&VIEW_INDEX=${viewIndex}&sort=communicationEventTypeId</@ofbizUrl>">${uiLabelMap.PartyType}</a></td>
<td><a href="<@ofbizUrl>${target}&VIEW_SIZE=${viewSize}&VIEW_INDEX=${viewIndex}&sort=contactMechTypeId</@ofbizUrl>">${uiLabelMap.PartyContactType}</a></td>
<td><a href="<@ofbizUrl>${target}&VIEW_SIZE=${viewSize}&VIEW_INDEX=${viewIndex}&sort=statusId</@ofbizUrl>">${uiLabelMap.PartyStatus}</a></td>
<td><a href="<@ofbizUrl>${target}&VIEW_SIZE=${viewSize}&VIEW_INDEX=${viewIndex}&sort=subject</@ofbizUrl>">${uiLabelMap.PartySubject}</a></td>
<td><a href="<@ofbizUrl>${target}&VIEW_SIZE=${viewSize}&VIEW_INDEX=${viewIndex}&sort=partyIdFrom</@ofbizUrl>">${uiLabelMap.PartyPartyFrom}</a></td>
<td><a href="<@ofbizUrl>${target}&VIEW_SIZE=${viewSize}&VIEW_INDEX=${viewIndex}&sort=partyIdTo</@ofbizUrl>">${uiLabelMap.PartyPartyTo}</a></td>
<td><a href="<@ofbizUrl>${target}&VIEW_SIZE=${viewSize}&VIEW_INDEX=${viewIndex}&sort=entryDate</@ofbizUrl>">${uiLabelMap.PartyEnteredDate}</a></td>
</tr>
<tr><td colspan="9"><hr></td></tr>
<#if eventList?has_content>
<#list eventList as event>
<#assign eventType = event.getRelatedOne("CommunicationEventType")?if_exists>
<#assign contactMechType = event.getRelatedOne("ContactMechType")?if_exists>
<#if event.statusId?exists>
<#assign statusItem = event.getRelatedOne("StatusItem")>
</#if>
<#if !partyId?exists>
<#assign partyId = event.partyIdFrom>
</#if>
<tr>
<td>${event.communicationEventId?if_exists}</td>
<td>${(eventType.get("description",locale))?default(uiLabelMap.CommonNA)}</td>
<td>${(contactMechType.get("description",locale))?default(uiLabelMap.CommonNA)}</td>
<td>${(statusItem.get("description",locale))?default(uiLabelMap.CommonNA)}</td>
<td>${event.subject?if_exists}</td>
<#if event.partyIdFrom?has_content>
<td><a href="<@ofbizUrl>viewprofile?partyId=${event.partyIdFrom}</@ofbizUrl>" class="buttontext">${event.partyIdFrom}</a></td>
<#else>
<td>${uiLabelMap.CommonNA}</td>
</#if>
<#if event.partyIdTo?has_content>
<td><a href="<@ofbizUrl>viewprofile?partyId=${event.partyIdTo}</@ofbizUrl>" class="buttontext">${event.partyIdTo}</a></td>
<#else>
<td>${uiLabelMap.CommonNA}</td>
</#if>
<td>${(event.entryDate?string)?if_exists}</td>
<td align="right"><a href="<@ofbizUrl>viewCommunicationEvent?partyId=${event.partyIdFrom?if_exists}&communicationEventId=${event.communicationEventId}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonView}</a>
</tr>
</#list>
<#else>
<tr>
<td colspan="8">${uiLabelMap.PartyNoCommunicationFound}</td>
</tr>
</#if>
</table>
@@ -48,7 +48,7 @@ under the License.
</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 @@ under the License.
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>