intoduce communication event roles and statusses and to display open and/or completed communication events

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@679499 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hans Bakker
2008-07-24 19:07:37 +00:00
parent 04eec810b9
commit 96874bc098
7 changed files with 315 additions and 42 deletions
@@ -18,6 +18,12 @@
under the License.
-->
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<property key="->Complete">
<value xml:lang="en">->Complete</value>
</property>
<property key="AllEvents">
<value xml:lang="en">All Communications</value>
</property>
<property key="MyCommunications">
<value xml:lang="en">My Communications</value>
<value xml:lang="fr">Mes communications</value>
@@ -34,10 +40,16 @@
<value xml:lang="en">New Message</value>
<value xml:lang="fr">Nouveau message</value>
</property>
<property key="OpenEvents">
<value xml:lang="en">Open Communications</value>
</property>
<property key="OtherCommunications">
<value xml:lang="en">Other Communications</value>
<value xml:lang="fr">Autres communications</value>
</property>
<property key="NoAccess">
<value xml:lang="en">You do not have access to this information</value>
</property>
<property key="CommunicationsOfParty">
<value xml:lang="en">Communications of party</value>
<value xml:lang="fr">Communications de l'acteur</value>
@@ -56,5 +56,125 @@ under the License.
<call-service service-name="setUserPreferenceGroup"
in-map-name="inMap" />
</simple-method>
<simple-method method-name="setCommEventToRead" short-description="">
<call-simple-method method-name="checkCommEventAccess"/>
<if-compare operator="equals" value="true" field="found">
<entity-one entity-name="CommunicationEventRole" value-name="communicationEventRole"/>
<if>
<condition>
<or>
<if-empty field="communicationEventRole.statusId"/>
<if-compare operator="equals" value="COM_ROLE_CREATED" field="communicationEventRole.statusId"/>
</or>
</condition>
<then>
<set-service-fields service-name="updateCommunicationEventRole" map-name="parameters" to-map-name="inMap"/>
<set field="inMap.statusId" value="COM_ROLE_READ" />
<call-service service-name="updateCommunicationEventRole" in-map-name="inMap"/>
</then>
</if>
<else>
<add-error><fail-property property="NoAccess" resource="MyPageUiLabels"/></add-error>
</else>
</if-compare>
</simple-method>
<simple-method method-name="setCommEventRoleToComplete" short-description="">
<call-simple-method method-name="checkCommEventAccess"/>
<if-compare operator="equals" value="true" field="found">
<entity-one entity-name="CommunicationEventRole" value-name="communicationEventRole"/>
<if>
<condition>
<or>
<if-empty field="communicationEventRole.statusId"/>
<if-compare operator="equals" value="COM_ROLE_READ" field="communicationEventRole.statusId"/>
</or>
</condition>
<then>
<set-service-fields service-name="updateCommunicationEventRole" map-name="parameters" to-map-name="inMap"/>
<set field="inMap.statusId" value="COM_ROLE_COMPLETED" />
<call-service service-name="updateCommunicationEventRole" in-map-name="inMap"/>
</then>
</if>
<else>
<add-error><fail-property property="NoAccess" resource="MyPageUiLabels"/></add-error>
</else>
</if-compare>
</simple-method>
<simple-method method-name="checkCommEventAccess" short-description="check if the user has access to the email of this party">
<set field="found" value="false"/>
<if-compare-field operator="not-equals" field="parameters.partyId" to-field="userLogin.partyId">
<entity-and list-name="emailOwners" entity-name="PartyRelationship" filter-by-date="true">
<field-map field-name="partyIdFrom" value="${userLogin.partyId}" />
<field-map field-name="roleTypeIdFrom" value="EMAIL_ADMIN" />
</entity-and>
<iterate entry-name="emailOwners" list-name="emailOwner">
<if-compare operator="equals" value="${userLogin.partyId}" field="emailOwner.partyIdTo">
<set field="found" value="true"/>
</if-compare>
</iterate>
<else>
<set field="found" value="true"/>
</else>
</if-compare-field>
</simple-method>
<simple-method method-name="createCommunicationEventRoles"
short-description="">
<entity-condition list-name="commEvents" entity-name="CommunicationEvent" />
<set field="count" value="0" type="Integer" />
<iterate entry-name="commEvent" list-name="commEvents">
<log level="always" message="====processing: ${commEvent.communicationEventId}"></log>
<get-related value-name="commEvent" relation-name="CommunicationEventRole"
list-name="roles" />
<if-empty field="roles">
<!--partyId To -->
<if-not-empty field="commEvent.partyIdTo">
<entity-one entity-name="PartyRole" value-name="partyRole">
<field-map field-name="partyId" value="${commEvent.partyIdTo}" />
<field-map field-name="roleTypeId" value="ADDRESSEE" />
</entity-one>
<if-empty field="partyRole">
<make-value entity-name="PartyRole" value-name="pr" />
<set field="pr.partyId" value="${commEvent.partyIdTo}" />
<set field="pr.roleTypeId" value="ADDRESSEE" />
<create-value value-name="pr" />
</if-empty>
<make-value entity-name="CommunicationEventRole"
value-name="commRole" />
<set field="commRole.communicationEventId" from-field="commEvent.communicationEventId" />
<set field="commRole.partyId" from-field="commEvent.partyIdTo" />
<set field="commRole.roleTypeId" value="ADDRESSEE" />
<set field="commRole.statusId" value="COM_ROLE_COMPLETED"/>
<create-value value-name="commRole" />
</if-not-empty>
<!-- partyIdFrom -->
<if-not-empty field="commEvent.partyIdFrom">
<entity-one entity-name="PartyRole" value-name="partyRole">
<field-map field-name="partyId" value="${commEvent.partyIdFrom}" />
<field-map field-name="roleTypeId" value="ORIGINATOR" />
</entity-one>
<if-empty field="partyRole">
<make-value entity-name="PartyRole" value-name="pr" />
<set field="pr.partyId" value="${commEvent.partyIdFrom}" />
<set field="pr.roleTypeId" value="ORIGINATOR" />
<create-value value-name="pr" />
</if-empty>
<set field="commRole.communicationEventId" from-field="commEvent.communicationEventId" />
<set field="commRole.partyId" from-field="commEvent.partyIdFrom" />
<set field="commRole.roleTypeId" value="ORIGINATOR" />
<set field="commRole.statusId" value="COM_ROLE_COMPLETED"/>
<create-value value-name="commRole" />
</if-not-empty>
<calculate field-name="count">
<number value="1" />
<calcop operator="add" field-name="count" />
</calculate>
</if-empty>
</iterate>
<log level="always" message="========${count} records updated" />
</simple-method>
</simple-methods>
@@ -244,6 +244,38 @@
<response name="success" type="view" value="otherCommunications"/>
<response name="error" type="view" value="ViewCommunicationEvent"/>
</request-map>
<request-map uri="setOtherCommEventRoleToComplete">
<security https="true" auth="true"/>
<event type="simple" path="org/ofbiz/mypage/Events.xml" invoke="setCommEventRoleToComplete"/>
<response name="success" type="view" value="otherCommunications"/>
<response name="error" type="view" value="otherCommunications"/>
</request-map>
<request-map uri="setMyCommEventRoleToComplete">
<security https="true" auth="true"/>
<event type="simple" path="org/ofbiz/mypage/Events.xml" invoke="setCommEventRoleToComplete"/>
<response name="success" type="view" value="myCommunications"/>
<response name="error" type="view" value="myCommunications"/>
</request-map>
<request-map uri="setCommEventRoleToComplete">
<security https="true" auth="true"/>
<event type="simple" path="org/ofbiz/mypage/Events.xml" invoke="setCommEventRoleToComplete"/>
<response name="success" type="view" value="main"/>
<response name="error" type="view" value="main"/>
</request-map>
<request-map uri="ViewCommunicationEvent">
<security https="true" auth="true"/>
<event type="simple" invoke="setCommEventToRead" path="org/ofbiz/mypage/Events.xml"/>
<response name="success" type="view" value="ViewCommunicationEvent"/>
<response name="error" type="view" value="main"/>
</request-map>
<!-- to clean up old data -->
<request-map uri="createCommEventRoles">
<security https="true" auth="true"/>
<event type="simple" invoke="createCommunicationEventRoles" path="org/ofbiz/mypage/Events.xml"/>
<response name="success" type="view" value="main"/>
<response name="error" type="view" value="main"/>
</request-map>
<view-map name="main" type="screen" page="component://mypage/widget/CommonScreens.xml#main"/>
<view-map name="preferences" type="screen" page="component://mypage/widget/CommonScreens.xml#preferences"/>
@@ -112,7 +112,7 @@ under the License.
<widgets>
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
<include-menu location="component://mypage/widget/MyPageMenus.xml" name="CommEventTabBar"/>
<!--include-menu location="component://mypage/widget/MyPageMenus.xml" name="CommEventTabBar"/-->
<include-menu location="component://party/webapp/partymgr/communication/CommMenus.xml" name="CommSubTabBar"/>
<decorator-section-include name="body"/>
</decorator-section>
+24 -4
View File
@@ -27,7 +27,7 @@ under the License.
<hyperlink also-hidden="false" description="${workEffortName}" target="/projectmgr/control/taskView?workEffortId=${workEffortId}" target-type="inter-app" target-window="_BLANK"/>
</field>
<field name="projectName" title="${uiLabelMap.ProjectMgrProjectName}"><hyperlink target="/projectmgr/control/projectView?projectId=${resultProject.projectId}" target-type="inter-app" target-window="_BLANK" description="${resultProject.projectName}"/></field>
<field name="roleTypeId" parameter-name="newRoleTypeId" title="${uiLabelMap.PartyRole}"><hidden value="${roleTypeId"/></field>
<field name="roleTypeId" parameter-name="newRoleTypeId" title="${uiLabelMap.PartyRole}"><hidden value="${roleTypeId}"/></field>
<field use-when="!headerItem.equals(&quot;main&quot;)" name="remove" title="${uiLabelMap.CommonRemove}"><hyperlink target="updateTaskAssigmentKey?workEffortId=${workEffortId}&amp;partyId=${partyId}&amp;roleTypeId=${roleTypeId}&amp;fromDate=${fromDate}&amp;statusId=PAS_ENDED" description="${uiLabelMap.CommonRemove}"/></field>
<field use-when="headerItem.equals(&quot;main&quot;)" name="remove" title="${uiLabelMap.CommonRemove}"><hyperlink target="updateTaskAssigment?workEffortId=${workEffortId}&amp;partyId=${partyId}&amp;roleTypeId=${roleTypeId}&amp;fromDate=${fromDate}&amp;statusId=PAS_ENDED" description="${uiLabelMap.CommonRemove}"/></field>
<field use-when="!headerItem.equals(&quot;main&quot;)" name="toComplete" title="${uiLabelMap.CommonStatustoComplete}"><hyperlink target="updateTaskAssigmentKey?workEffortId=${workEffortId}&amp;partyId=${partyId}&amp;roleTypeId=${roleTypeId}&amp;fromDate=${fromDate}&amp;statusId=PAS_COMPLETED" description="${uiLabelMap.CommonStatustoComplete}"/></field>
@@ -92,6 +92,9 @@ under the License.
</form>
<form name="ListPartyCommEvents" extends="ListCommEvents" extends-resource="component://party/webapp/partymgr/communication/CommForms.xml" type="list">
<row-actions>
<set field="toComplete" value="${bsh:&quot;COM_ROLE_COMPLETED&quot;.equals(roleStatusId)?&quot;&quot;:&quot;toComplete&quot;}"/>
</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}"/>
@@ -103,14 +106,31 @@ under the License.
<hyperlink also-hidden="false" description="${uiLabelMap.CommonDelete}" target="deletePartyCommunicationEventOthersRole?partyId=${partyId}&amp;communicationEventId=${communicationEventId}&amp;roleTypeId=${roleTypeId}"/>
</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;type=main"/>
<hyperlink description="${subject} " target="ViewCommunicationEvent?communicationEventId=${communicationEventId}&amp;partyId=${partyId}&amp;roleTypeId=${roleTypeId}&amp;type=main"/>
</field>
<field use-when="headerItem.equals(&quot;myCommunications&quot;)" name="subject" widget-style="buttontext" widget-area-style="fieldWidth300">
<hyperlink description="${subject} " target="ViewCommunicationEvent?communicationEventId=${communicationEventId}&amp;type=my" />
<hyperlink description="${subject} " target="ViewCommunicationEvent?communicationEventId=${communicationEventId}&amp;partyId=${partyId}&amp;roleTypeId=${roleTypeId}&amp;type=my" />
</field>
<field use-when="headerItem.equals(&quot;otherCommunications&quot;)" name="subject" widget-style="buttontext" widget-area-style="fieldWidth300">
<hyperlink description="${subject} " target="ViewCommunicationEvent?communicationEventId=${communicationEventId}&amp;type=other" />
<hyperlink description="${subject} " target="ViewCommunicationEvent?communicationEventId=${communicationEventId}&amp;partyId=${partyId}&amp;roleTypeId=${roleTypeId}&amp;type=other" />
</field>
<field use-when="headerItem.equals(&quot;main&quot;)" name="statusId" entry-name="roleStatusId" widget-style="buttontext" widget-area-style="fieldWidth300">
<display-entity entity-name="StatusItem" description="${description}">
<sub-hyperlink description="${uiLabelMap.${toComplete}}" target="setCommEventRoleToComplete?communicationEventId=${communicationEventId}&amp;partyId=${partyId}&amp;roleTypeId=${roleTypeId}"/>
</display-entity>
</field>
<field use-when="headerItem.equals(&quot;myCommunications&quot;)" name="statusId" entry-name="roleStatusId" widget-style="buttontext" widget-area-style="fieldWidth300">
<display-entity entity-name="StatusItem" description="${description}">
<sub-hyperlink description="${uiLabelMap.${toComplete}}" target="setMyCommEventRoleToComplete?communicationEventId=${communicationEventId}&amp;partyId=${partyId}&amp;roleTypeId=${roleTypeId}" />
</display-entity>
</field>
<field use-when="headerItem.equals(&quot;otherCommunications&quot;)" name="statusId" entry-name="roleStatusId" widget-style="buttontext" widget-area-style="fieldWidth300">
<display-entity entity-name="StatusItem" description="${description}">
<sub-hyperlink description="${uiLabelMap.${toComplete}}" target="setOtherCommEventRoleToComplete?communicationEventId=${communicationEventId}&amp;partyId=${partyId}&amp;roleTypeId=${roleTypeId}" />
</display-entity>
</field>
<field name="statusId" entry-name="roleStatusId"/>
<field name="createdStamp" entry-name="entryDate"/>
</form>
<form name="ListMyUnknownPartyEmails" type="multi"
extends="ListMyUnknownPartyEmails" extends-resource="component://party/webapp/partymgr/communication/CommForms.xml" use-row-submit="true">
+81 -11
View File
@@ -25,7 +25,7 @@ under the License.
<condition>
<not><if-empty field-name="userLogin"/></not>
</condition>
<link target="main"/>
<link target="main?status=open"/>
</menu-item>
<menu-item name="viewprofile" title="${uiLabelMap.MyProfile}">
<condition>
@@ -40,7 +40,7 @@ under the License.
<if-compare field-name="preferences.userPrefMap.myCommunications" operator="not-equals" value="Y"/>
</and>
</condition>
<link target="myCommunications"/>
<link target="myCommunications?status=open"/>
</menu-item>
<menu-item name="otherCommunications" title="${uiLabelMap.OtherCommunications}">
<condition>
@@ -49,7 +49,7 @@ under the License.
<if-compare field-name="preferences.userPrefMap.otherCommunications" operator="not-equals" value="Y"/>
</and>
</condition>
<link target="otherCommunications"/>
<link target="otherCommunications?status=open"/>
</menu-item>
<menu-item name="myCompanyComms" title="${uiLabelMap.MyCompanyComms}">
<condition>
@@ -107,12 +107,82 @@ under the License.
<condition><if-compare field-name="headerItem" operator="equals" value="main"/></condition>
<link target="newEvent"/>
</menu-item>
</menu>
<menu name="MyCommunicationsMenu">
<menu-item name="newEmail" title="${uiLabelMap.PartyNewEmail}"><link target="EditCommunicationEvent?communicationEventTypeId=EMAIL_COMMUNICATION"/></menu-item>
<menu-item name="newNote" title="${uiLabelMap.PartyNewInternalNote}"><link target="EditCommunicationEvent?communicationEventTypeId=COMMENT_NOTE"/></menu-item>
</menu>
</menu>
<menu name="communicationsMenu">
<menu-item name="newEmail" title="${uiLabelMap.PartyNewEmail}">
<link
target="EditCommunicationEvent?communicationEventTypeId=EMAIL_COMMUNICATION" />
</menu-item>
<menu-item name="newNote" title="${uiLabelMap.PartyNewInternalNote}">
<link target="EditCommunicationEvent?communicationEventTypeId=COMMENT_NOTE" />
</menu-item>
<menu-item name="openOtherEvents" title="${uiLabelMap.OpenEvents}">
<condition>
<and>
<if-compare field-name="parameters.status" operator="equals"
value="%" />
<if-compare field-name="headerItem" operator="equals"
value="otherCommunications" />
</and>
</condition>
<link target="otherCommunications?status=open" />
</menu-item>
<menu-item name="allOtherEvents" title="${uiLabelMap.AllEvents}">
<condition>
<and>
<if-compare field-name="parameters.status" operator="equals"
value="open" />
<if-compare field-name="headerItem" operator="equals"
value="otherCommunications" />
</and>
</condition>
<link target="otherCommunications" />
</menu-item>
<menu-item name="openMyEvents" title="${uiLabelMap.OpenEvents}">
<condition>
<and>
<if-compare field-name="status" operator="equals"
value="%" />
<if-compare field-name="headerItem" operator="equals"
value="myCommunications" />
</and>
</condition>
<link target="myCommunications?status=open" />
</menu-item>
<menu-item name="allMyEvents" title="${uiLabelMap.AllEvents}">
<condition>
<and>
<if-compare field-name="parameters.status" operator="equals"
value="open" />
<if-compare field-name="headerItem" operator="equals"
value="myCommunications" />
</and>
</condition>
<link target="myCommunications" />
</menu-item>
<menu-item name="openEvents" title="${uiLabelMap.OpenEvents}">
<condition>
<and>
<if-compare field-name="status" operator="equals"
value="%" />
<if-compare field-name="headerItem" operator="equals"
value="main" />
</and>
</condition>
<link target="main?status=open" />
</menu-item>
<menu-item name="allEvents" title="${uiLabelMap.AllEvents}">
<condition>
<and>
<if-compare field-name="parameters.status" operator="equals"
value="open" />
<if-compare field-name="headerItem" operator="equals"
value="main" />
</and>
</condition>
<link target="main" />
</menu-item>
</menu>
<menu name="MyTasksMenu" type="simple" menu-container-style="button-bar button-style-2" default-selected-style="selected" selected-menuitem-context-field-name="tabButtonItem">
<menu-item name="myTasks" title="myTasks"><link target="/projectmgr/control/MyTasks" url-mode="inter-app"/></menu-item>
@@ -140,7 +210,7 @@ under the License.
<menu-item name="myTime" title="myTime"><link target="/projectmgr/control/MyTimesheet" url-mode="inter-app"/></menu-item>
</menu>
<menu name="CommEventTabBar" default-selected-style="selected" type="simple"
<!-- menu name="CommEventTabBar" default-selected-style="selected" type="simple"
menu-container-style="button-bar tab-bar" selected-menuitem-context-field-name="tabButtonItem">
<menu-item name="OverView" title="${uiLabelMap.CommonOverview}">
<condition><not><if-empty field-name="communicationEvent"/></not></condition>
@@ -151,6 +221,6 @@ under the License.
<link target="ListCommContent?communicationEventId=${parameters.communicationEventId}"/>
</menu-item>
</menu>
</menu-->
</menus>
+45 -26
View File
@@ -195,32 +195,35 @@ under the License.
</widgets>
</section>
</screen>
<screen name="Communications">
<section>
<actions>
<entity-condition entity-name="CommunicationEventAndRole"
list-name="commEvents">
<condition-list combine="and">
<condition-expr field-name="statusId" operator="not-equals"
value="COM_UNKNOWN_PARTY" />
<screen name="Communications">
<section>
<actions>
<set field="status" from-field="parameters.status" default-value="%"/>
<entity-condition entity-name="CommunicationEventAndRole"
list-name="commEvents">
<condition-list combine="and">
<condition-expr field-name="statusId" operator="not-equals"
value="COM_UNKNOWN_PARTY" />
<condition-expr field-name="partyId" operator="equals"
value="${partyId}" />
<condition-list combine="or">
<condition-expr field-name="partyIdFrom" operator="equals"
value="${partyId}" />
<condition-expr field-name="partyIdTo" operator="equals"
value="${partyId}" />
<condition-expr field-name="partyId" operator="equals"
value="${partyId}" />
<condition-expr field-name="roleStatusId"
operator="not-equals" value="COM_ROLE_COMPLETED" />
<condition-expr field-name="roleStatusId"
operator="like" value="${status}" />
</condition-list>
</condition-list>
<order-by field-name="-datetimeStarted" />
</entity-condition>
<entity-condition entity-name="CommunicationEventAndRole"
list-name="commEventsUnknown">
</condition-list>
<order-by field-name="-datetimeStarted" />
</entity-condition>
<entity-condition entity-name="CommunicationEventAndRole"
list-name="commEventsUnknown">
<condition-list combine="and">
<condition-expr field-name="statusId" operator="equals"
value="COM_UNKNOWN_PARTY" />
<condition-expr field-name="partyIdTo" operator="equals"
env-name="partyId" />
<condition-expr field-name="roleStatusId" operator="not-equals"
value="COM_ROLE_COMPLETED" />
<condition-expr field-name="roleStatusId" operator="not-equals"
value="COM_ROLE_COMPLETED" />
<condition-expr field-name="partyId" operator="equals"
value="${partyId}" />
</condition-list>
@@ -232,9 +235,9 @@ under the License.
</actions>
<widgets>
<screenlet title="${uiLabelMap.CommunicationsOfParty}: ${partyName.firstName} ${partyName.middleName} ${partyName.lastName} ${partyName.groupName} [${partyId}] "
navigation-menu-name="MyCommunicationsMenu" navigation-form-name="ListPartyCommEvents"
navigation-menu-name="communicationsMenu" navigation-form-name="ListPartyCommEvents"
name="myComms">
<include-menu name="MyCommunicationsMenu"
<include-menu name="communicationsMenu"
location="component://mypage/widget/MyPageMenus.xml" />
<section>
<condition>
@@ -329,9 +332,6 @@ under the License.
<include-screen name="commEvent" />
</widgets>
</section>
</container>
<container style="righthalf">
<label style="h1" text="${uiLabelMap.CommonRelatedInformation}" />
<section>
<condition>
<not>
@@ -350,6 +350,25 @@ under the License.
<include-screen name="commEvent" />
</widgets>
</section>
</container>
<container style="righthalf">
<label style="h1" text="${uiLabelMap.CommonRelatedInformation}" />
<section>
<widgets>
<screenlet title="${uiLabelMap.PartyCommEventRoles}">
<include-form name="ListCommRoles"
location="component://party/webapp/partymgr/communication/CommForms.xml" />
</screenlet>
</widgets>
</section>
<section>
<widgets>
<screenlet title="${uiLabelMap.PartyCommContent}">
<include-form name="listCommContent"
location="component://party/webapp/partymgr/communication/CommForms.xml" />
</screenlet>
</widgets>
</section>
<section>
<actions>
<entity-and list-name="commEvents" entity-name="CommunicationEvent">