Author: hansbak
Date: Wed May 13 09:26:54 2009 New Revision: 774264 URL: http://svn.apache.org/viewvc?rev=774264&view=rev Log: fix the send and receive of 'other' party commevents Modified: ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/PrepCommEventForward.groovy ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/PrepCommEventReply.groovy ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml ofbiz/trunk/applications/party/widget/partymgr/CommunicationScreens.xml ofbiz/trunk/applications/party/widget/partymgr/PartyMenus.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=774264&r1=774263&r2=774264&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 Wed May 13 09:26:54 2009 @@ -70,7 +70,7 @@ + " " + (partyNameView.lastName!=null?partyNameView.lastName:" ") + " wrote:"; - resultLine += "\n -------------------------------------------------------------------- "; + resultLine += "\n\n\n\n\n -------------------------------------------------------------------- "; resultLine += "\n> " + localContent.substring(0, localContent.indexOf("\n",0)); startChar = localContent.indexOf("\n",0); while(startChar != -1 && (startChar = localContent.indexOf("\n",startChar) + 1) != 0) @@ -80,8 +80,8 @@ <!-- set rolestatus from original email to completed if logged-on userId can be found --> <entity-and list="roles" entity-name="CommunicationEventRole"> - <field-map field-name="communicationEventId" from-field="parameters.parentCommEventId"/> - <field-map field-name="partyId" from-field="userLogin.partyId"/> + <field-map field-name="communicationEventId" from-field="parentCommEvent.parentCommEventId"/> + <field-map field-name="partyId" from-field="parentCommEvent.partyIdTo"/> </entity-and> <if-not-empty field="roles"> <first-from-list list="roles" entry="role"/> @@ -167,42 +167,10 @@ <simple-method method-name="updateCommunicationEvent" short-description="Update a CommunicationEvent"> <entity-one entity-name="CommunicationEvent" value-field="event"/> - <set field="oldStatusId" from-field="event.statusId"/> - <set-nonpk-fields map="parameters" value-field="event"/> - <if-compare-field operator="not-equals" field="event.statusId" - to-field="oldStatusId"> + <if-compare-field to-field="parameters.statusId" operator="not-equals" field="event.statusId"> <call-simple-method method-name="setCommunicationEventStatus"/> </if-compare-field> - - <!-- if the from- or to-party changed change also the roles --> - <if-not-empty field="parameters.partyIdFrom"> - <if> - <condition> - <or> - <if-compare operator="not-equals" value="parameters.partIdFrom" field="event.partyIdFrom"/> - <if-compare operator="not-equals" value="parameters.contactIdFrom" field="event.contactIdFrom"/> - </or> - </condition> - <then> - <!-- check if role exist then delete old role --> - <entity-one entity-name="CommunicationEventRole" value-field="roleFrom"> - <field-map field-name="communicationEventId" from-field="event.communicationEventId"/> - <field-map field-name="partyId" from-field="parameters.partyIdFrom"/> - <field-map field-name="roleTypeId" value="ORIGINATOR"/> - </entity-one> - <if-not-empty field="roleFrom"> - <remove-value value-field="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"/> - </then> - </if> - </if-not-empty> + <!-- get partyId from email address if required --> <if-empty field="parameters.partyIdTo"> <if-not-empty field="parameters.contactMechIdTo"> <entity-and entity-name="PartyAndContactMech" list="partyContactMechs" filter-by-date="true"> @@ -211,16 +179,61 @@ </entity-and> <first-from-list entry="partyContactMech" list="partyContactMechs"/> <set field="parameters.partyIdTo" from-field="partyContactMech.partyId"/> - <set field="event.partyIdTo" from-field="partyContactMech.partyId"/> </if-not-empty> </if-empty> - <if-not-empty field="parameters.partyIdTo"> - <if-compare operator="not-equals" value="parameters.partIdTo" - field="event.partyIdTo"> + <!-- if the from-party changed, change also the roles --> + <if> + <condition> + <or> + <and> + <not><if-empty field="parameters.partyIdFrom"/></not> + <if-compare-field field="parameters.partyIdFrom" operator="not-equals" to-field="event.partyIdFrom"/> + </and> + <and> + <not><if-empty field="parameters.contactMechIdFrom"/></not> + <if-compare-field field="parameters.contactMechIdFrom" operator="not-equals" to-field="event.contactMechIdFrom"/> + </and> + </or> + </condition> + <then> + <!-- updating partyId from old: --> + <entity-one entity-name="CommunicationEventRole" value-field="roleFrom"> + <field-map field-name="communicationEventId" from-field="event.communicationEventId"/> + <field-map field-name="partyId" from-field="parameters.partyIdFrom"/> + <field-map field-name="roleTypeId" value="ORIGINATOR"/> + </entity-one> + <if-not-empty field="roleFrom"> + <remove-value value-field="roleFrom"/> + </if-not-empty> + <!-- add new role --> + <set field="newRoleFrom.communicationEventId" from-field="event.communicationEventId"/> + <set field="newRoleFrom.partyId" from-field="parameters.partyIdFrom"/> + <set field="newRoleFrom.roleTypeId" value="ORIGINATOR"/> + <set field="newRoleFrom.statusId" from-field="roleFrom.statusId"/> + <set field="newRoleFrom.contactMechId" from-field="parameters.contactMechIdFrom"/> + <call-service service-name="createCommunicationEventRole" + in-map-name="newRoleFrom"/> + </then> + </if> + <!-- if the to-party changed, change also the roles --> + <if> + <condition> + <or> + <and> + <not><if-empty field="parameters.partyIdTo"/></not> + <if-compare-field field="parameters.partyIdTo" operator="not-equals" to-field="event.partyIdTo"/> + </and> + <and> + <not><if-empty field="parameters.contactMechIdTo"/></not> + <if-compare-field field="parameters.contactMechIdTo" operator="not-equals" to-field="event.contactMechIdTo"/> + </and> + </or> + </condition> + <then> <!-- check if role exist then delete old role --> <entity-one entity-name="CommunicationEventRole" value-field="roleTo"> <field-map field-name="communicationEventId" from-field="event.communicationEventId"/> - <field-map field-name="partyId" from-field="event.partyIdTo"/> + <field-map field-name="partyId" from-field="parameters.partyIdTo"/> <field-map field-name="roleTypeId" value="ADDRESSEE"/> </entity-one> <if-not-empty field="roleTo"> @@ -228,13 +241,15 @@ </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.partyId" from-field="parameters.partyIdTo"/> <set field="newRoleTo.roleTypeId" value="ADDRESSEE"/> - <set field="newRoleTo.contactMechId" from-field="event.contactMechIdTo"/> + <set field="newRoleTo.statusId" from-field="roleTo.statusId"/> + <set field="newRoleTo.contactMechId" from-field="parameters.contactMechIdTo"/> <call-service service-name="createCommunicationEventRole" in-map-name="newRoleTo"/> - </if-compare> - </if-not-empty> + </then> + </if> + <set-nonpk-fields map="parameters" value-field="event"/> <store-value value-field="event"/> </simple-method> @@ -488,14 +503,6 @@ <else> <set field="communicationEvent.statusId" from-field="parameters.statusId"/> <store-value value-field="communicationEvent"/> - <!-- if complete, set all role status fields to 'complete' (intentionally ignoring the status change checking)--> - <if-compare operator="equals" value="COM_COMPLETE" field="parameters.statusId"> - <get-related value-field="communicationEvent" relation-name="CommunicationEventRole" list="updRoles"/> - <iterate entry="updRole" list="updRoles"> - <set field="updRole.statusId" value="COM_ROLE_COMPLETED"/> - <store-value value-field="updRole"/> - </iterate> - </if-compare> </else> </if-empty> </if-compare-field> Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/PrepCommEventForward.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/PrepCommEventForward.groovy?rev=774264&r1=774263&r2=774264&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/PrepCommEventForward.groovy (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/PrepCommEventForward.groovy Wed May 13 09:26:54 2009 @@ -22,7 +22,6 @@ import java.lang.String; import org.ofbiz.base.util.*; - originalCommEventId = parameters.originalCommEventId; if (originalCommEventId) { @@ -33,7 +32,7 @@ parameters.origCommEventId = orgEventId; parameters.originalCommEventId = originalCommEventId; parameters.contactMechIdFrom = originalEvent.contactMechIdTo; - parameters.partyIdFrom = userLogin.partyId; + parameters.partyIdFrom = communicationEvent.partyIdTo; parameters.statusId = "COM_IN_PROGRESS"; parameters.subject = "FW: " + originalEvent.subject; Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/PrepCommEventReply.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/PrepCommEventReply.groovy?rev=774264&r1=774263&r2=774264&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/PrepCommEventReply.groovy (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/PrepCommEventReply.groovy Wed May 13 09:26:54 2009 @@ -18,6 +18,7 @@ */ import org.ofbiz.base.util.*; +import org.ofbiz.entity.*; import org.ofbiz.party.contact.ContactMechWorker; parentCommEventId = parameters.parentCommEventId; @@ -45,7 +46,7 @@ } parameters.contactMechIdFrom = parentEvent.contactMechIdTo; - parameters.partyIdFrom = userLogin.partyId; + parameters.partyIdFrom = parentEvent.partyIdTo; parameters.partyIdTo = parentEvent.partyIdFrom; parameters.statusId = "COM_IN_PROGRESS"; Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml?rev=774264&r1=774263&r2=774264&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml Wed May 13 09:26:54 2009 @@ -693,8 +693,8 @@ <request-map uri="setCommunicationEventRoleStatus"> <security https="true" auth="true"/> <event type="service" invoke="setCommunicationEventRoleStatus"/> - <response name="success" type="view-last"/> - <response name="error" type="view-last"/> + <response name="success" type="view-home"/> + <response name="error" type="view-home"/> </request-map> <request-map uri="MyCommunicationEvents"> <security https="true" auth="true"/> @@ -714,12 +714,12 @@ </request-map> <request-map uri="EditCommunicationEvent"> <security https="true" auth="true"/> - <response name="success" type="view" value="EditCommunicationEvent" save-current-view="true"/> + <response name="success" type="view" value="EditCommunicationEvent"/> </request-map> <request-map uri="ViewCommunicationEvent"> <security https="true" auth="true"/> <event type="simple" invoke="setCommEventToRead" path="component://party/script/org/ofbiz/party/communication/CommunicationEventEvents.xml"/> - <response name="success" type="view" value="ViewCommunicationEvent" save-last-view="true"/> + <response name="success" type="view" value="ViewCommunicationEvent"/> </request-map> <request-map uri="addContentToCommEvent"> <security https="true" auth="true"/> 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=774264&r1=774263&r2=774264&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml Wed May 13 09:26:54 2009 @@ -22,7 +22,6 @@ <form name="EditCommEvent" type="single" target="updateCommunicationEvent" default-map-name="communicationEvent"> <alt-target target="createCommunicationEvent" use-when="communicationEvent==null"/> - <field name="donePage" ><hidden value="${parameters.donePage}"/></field> <field name="communicationEventId" use-when="communicationEvent!=null"><display/></field> <field name="parentCommEventId" position="2"> <lookup target-form-name="LookupCommEvent"> @@ -126,7 +125,7 @@ <set field="nowDate" value="${bsh:org.ofbiz.base.util.UtilDateTime.nowDateString("yyyy-MM-dd HH:mm:ss.S")}" type="String"/> <entity-condition entity-name="PartyContactWithPurpose" list="emailAddresses"> <condition-list combine="and"> - <condition-expr field-name="partyId" value="${userLogin.partyId}"/> + <condition-expr field-name="partyId" value="${communicationEvent.partyIdFrom}"/> <condition-expr field-name="contactFromDate" operator="less-equals" from-field="nowDate"/> <condition-list combine="or"> <condition-expr field-name="contactThruDate" from-field="null"/> @@ -149,7 +148,7 @@ <field name="statusId"><hidden value="COM_IN_PROGRESS"/></field> <field name="parentCommEventId" use-when="parentCommEventId != null"><hidden value="${parameters.parentCommEventId}"/></field> <field name="parentCommEventId" use-when="originalCommEventId != null"><hidden value="${parameters.originalCommEventId}"/></field> - <field name="partyIdFrom"><hidden value="${userLogin.partyId}"/></field> + <field name="partyIdFrom"><hidden/></field> <field name="emailAddress" parameter-name="contactMechIdFrom"> <drop-down> <list-options list-name="emailAddresses" description="${infoString}" key-name="contactMechId"/> @@ -180,7 +179,7 @@ <field name="communicationEventTypeId"><hidden value="COMMENT_NOTE"/></field> <field name="parentCommEventId"><hidden value="${parameters.parentCommEventId}"/></field> <field name="statusId"><hidden value="COM_PENDING"/></field> - <field name="partyIdFrom"><hidden value="${userLogin.partyId}"/></field> + <field name="partyIdFrom"><hidden/></field> <field name="partyIdTo" title="${uiLabelMap.PartyPartyTo}"> <drop-down> <list-options list-name="recentParties" key-name="partyId" description="${firstName} ${middleName} ${lastName} ${groupName}"/> @@ -783,16 +782,7 @@ </form> <form name="ListDraftEmails" type="list" extends="ListCommEvents" extends-resource="component://party/webapp/partymgr/communication/CommForms.xml" target="deleteCommunicationEvent" - use-row-submit="true" header-row-style="header-row-2"> - <actions> - <entity-condition entity-name="CommunicationEvent" list="commEvents"> - <condition-list combine="and"> - <condition-expr field-name="statusId" operator="equals" value="COM_PENDING"/> - <condition-expr field-name="partyIdFrom" operator="equals" value="${partyId}"/> - </condition-list> - <order-by field-name="-lastUpdatedStamp"/> - </entity-condition> - </actions> + use-row-submit="true" header-row-style="header-row-2" list-name="commEventDraft"> <field name="subject"> <hyperlink description="${subject}" target="EditCommunicationEvent"> <parameter param-name="communicationEventId"/> Modified: ofbiz/trunk/applications/party/widget/partymgr/CommunicationScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/widget/partymgr/CommunicationScreens.xml?rev=774264&r1=774263&r2=774264&view=diff ============================================================================== --- ofbiz/trunk/applications/party/widget/partymgr/CommunicationScreens.xml (original) +++ ofbiz/trunk/applications/party/widget/partymgr/CommunicationScreens.xml Wed May 13 09:26:54 2009 @@ -385,7 +385,7 @@ <if-empty field="communicationEvent"/> </condition> <widgets> - <screenlet title="${uiLabelMap.PartyCreateAddEmail} ${parameters.communicationEventId}"> + <screenlet title="${uiLabelMap.PartyCreateAddEmail} ${parameters.communicationEventId} ${uiLabelMap.CommonFrom} ${communicationEvent.partyIdFrom}"> <include-form location="component://party/webapp/partymgr/communication/CommForms.xml" name="EditEmail"/> </screenlet> </widgets> @@ -426,7 +426,7 @@ </widgets> <fail-widgets> <container style="lefthalf"> - <screenlet id="EditCommunicationEventPanel" title="${uiLabelMap.PartyEditCommunicationEvent} ${parameters.communicationEventId}"> + <screenlet id="EditCommunicationEventPanel" title="${uiLabelMap.PartyEditCommunicationEvent} ${parameters.communicationEventId} ${uiLabelMap.CommonFrom} ${communicationEvent.partyIdFrom}"> <include-form location="component://party/webapp/partymgr/communication/CommForms.xml" name="EditInternalNote"/> </screenlet> </container> @@ -819,8 +819,7 @@ <actions> <script location="component://common/webcommon/WEB-INF/actions/includes/retrievePortletAttributes.groovy"/> <set field="internalNotesOnly" from-field="internalNotesOnly" default-value="true"/> - <set field="partyId" from-field="parameters.partyId" default-value="${communicationPartyId}"/> - <set field="partyId" from-field="partyId" default-value="${userLogin.partyId}"/> + <set field="partyId" from-field="communicationPartyId" default-value="${userLogin.partyId}"/> <set field="all" from-field="parameters.all"/> <entity-condition entity-name="CommunicationEventAndRole" list="commEvents"> <condition-list combine="and"> @@ -850,10 +849,9 @@ </entity-condition> <entity-condition entity-name="CommunicationEventAndRole" list="commEventDraft"> <condition-list combine="and"> - <condition-expr field-name="statusId" operator="equals" - value="COM_PENDING"/> - <condition-expr field-name="partyId" operator="equals" - value="${partyId}"/> + <condition-expr field-name="statusId" operator="equals" value="COM_PENDING"/> + <condition-expr field-name="partyId" operator="equals" value="${partyId}"/> + <condition-expr field-name="roleTypeId" operator="equals" value="ORIGINATOR"/> </condition-list> <order-by field-name="-entryDate"/> </entity-condition> Modified: ofbiz/trunk/applications/party/widget/partymgr/PartyMenus.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/widget/partymgr/PartyMenus.xml?rev=774264&r1=774263&r2=774264&view=diff ============================================================================== --- ofbiz/trunk/applications/party/widget/partymgr/PartyMenus.xml (original) +++ ofbiz/trunk/applications/party/widget/partymgr/PartyMenus.xml Wed May 13 09:26:54 2009 @@ -309,6 +309,7 @@ </condition> <link target="NewDraftCommunicationEvent"> <parameter param-name="communicationEventTypeId" value="EMAIL_COMMUNICATION"/> + <parameter param-name="partyIdFrom" from-field="partyId"/> <parameter param-name="my" value="My"/> <parameter param-name="statusId" value="COM_PENDING"/> </link> @@ -319,6 +320,7 @@ </condition> <link target="NewDraftCommunicationEvent"> <parameter param-name="communicationEventTypeId" value="COMMENT_NOTE"/> + <parameter param-name="partyIdFrom" from-field="partyId"/> <parameter param-name="my" value="My"/> <parameter param-name="statusId" value="COM_PENDING"/> </link> @@ -358,6 +360,7 @@ </condition> <link target="NewDraftCommunicationEvent"> <parameter param-name="communicationEventTypeId" value="EMAIL_COMMUNICATION"/> + <parameter param-name="partyIdFrom" from-field="partyId"/> <parameter param-name="my" value="My"/> <parameter param-name="statusId" value="COM_PENDING"/> </link> @@ -371,6 +374,7 @@ </condition> <link target="NewDraftCommunicationEvent"> <parameter param-name="communicationEventTypeId" value="COMMENT_NOTE"/> + <parameter param-name="partyIdFrom" from-field="partyId"/> <parameter param-name="my" value="My"/> <parameter param-name="statusId" value="COM_PENDING"/> </link> @@ -381,7 +385,7 @@ <not><if-empty field="communicationEvent"/></not> <not><if-empty field="communicationEvent.partyIdFrom"/></not> <if-compare field="communicationEvent.statusId" operator="not-equals" value="COM_PENDING"/> - <if-compare field="communicationEvent.partyIdFrom" operator="not-equals" value="${userLogin.partyId}"/> + <if-compare field="communicationEvent.partyIdFrom" operator="not-equals" value="${partyId}"/> <if-has-permission permission="PARTYMGR_CME-EMAIL_UPDATE"/> <if-has-permission permission="PARTYMGR_CME-NOTE_CREATE"/> </and> @@ -389,12 +393,13 @@ <link target="NewDraftCommunicationEvent"> <parameter param-name="communicationEventTypeId" from-field="communicationEvent.communicationEventTypeId"/> <parameter param-name="parentCommEventId" from-field="parameters.communicationEventId"/> + <parameter param-name="partyIdFrom" from-field="partyId"/> <parameter param-name="my" value="My"/> <parameter param-name="statusId" value="COM_PENDING"/> <parameter param-name="partyIdTo" from-field="communicationEvent.partyIdFrom"/> </link> </menu-item> - <menu-item name="forward" title="${uiLabelMap.PartyForward}"> + <menu-item name="forward" title="${uiLabelMap.PartyForward}(${partyId})"> <condition> <and> <not><if-empty field="communicationEvent"/></not> @@ -406,6 +411,7 @@ <link target="NewDraftCommunicationEvent"> <parameter param-name="communicationEventTypeId" from-field="communicationEvent.communicationEventTypeId"/> <parameter param-name="originalCommEventId" from-field="parameters.communicationEventId"/> + <parameter param-name="partyIdFrom" from-field="partyId"/> <parameter param-name="my" value="My"/> <parameter param-name="statusId" value="COM_PENDING"/> </link> |
Free forum by Nabble | Edit this page |