Author: hansbak
Date: Sun Jul 20 21:22:19 2008 New Revision: 678342 URL: http://svn.apache.org/viewvc?rev=678342&view=rev Log: added a communication set status service, some cleanups and usage of the roles in comunication selections Modified: ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml ofbiz/trunk/applications/party/servicedef/services.xml ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml ofbiz/trunk/applications/party/webapp/partymgr/communication/CommMenus.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=678342&r1=678341&r2=678342&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 Sun Jul 20 21:22:19 2008 @@ -21,6 +21,13 @@ <simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd"> <simple-method method-name="createCommunicationEvent" short-description="Create a CommunicationEvent"> + + <!-- change status of related comevent before creating new comevent so it shown in proper order on the list --> + <if-not-empty field="parameters.parentCommEventId"> + <set field="newStat.communicationEventId" from-field="parameters.parentCommEventId"/> + <set field="newStat.statusId" value="COM_COMPLETE"/> + <call-service service-name="setCommunicationEventStatus" in-map-name="newStat"/> + </if-not-empty> <if-empty field="parameters.statusId"> <set value="COM_ENTERED" field="parameters.statusId"/> @@ -37,7 +44,7 @@ </if-empty> <field-to-result field-name="newEntity.communicationEventId" result-name="communicationEventId"/> - <!-- if only contactmechid and no partyTo is provided for creation email address create it --> + <!-- if only contactmechid and no partyTo is provided for creation email address find the related party it --> <if-empty field="parameters.partyIdTo"> <if-not-empty field="parameters.contactMechIdTo"> <entity-and entity-name="PartyAndContactMech" list-name="partyContactMechs" filter-by-date="true"> @@ -65,11 +72,22 @@ <set from-field="newEntity.communicationEventId" field="eventOrder.communicationEventId"/> <create-value value-name="eventOrder"/> </if-not-empty> + <if-not-empty field="parameters.custReqId"> + <make-value value-name="eventRequest" entity-name="CustRequestCommEvent"/> + <set from-field="parameters.custReqId" field="eventRequest.custReqId"/> + <set from-field="newEntity.communicationEventId" field="eventRequest.communicationEventId"/> + <create-value value-name="eventRequest"/> + </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="deleteCommunicationEvent" short-description="Delete a CommunicationEvent"> @@ -191,7 +209,6 @@ <simple-method method-name="sendEmailDated" short-description="Checks for email communication events with the status COM_IN_PROGRESS and a startdate which is expired, then send the email"> - <transaction-begin/> <now-timestamp-to-env env-name="nowDate" /> <entity-condition entity-name="CommunicationEvent" list-name="communicationEvents"> <condition-list combine="and"> @@ -206,12 +223,9 @@ </condition-list> </condition-list> </entity-condition> - <transaction-commit/> <iterate entry-name="communicationEvent" list-name="communicationEvents"> - <transaction-begin/> <set-service-fields service-name="sendCommEventAsEmail" map-name="communicationEvent" to-map-name="inMap"/> - <call-service service-name="sendCommEventAsEmail" in-map-name="inMap"/> - <transaction-commit/> + <call-service service-name="sendCommEventAsEmail" in-map-name="inMap" require-new-transaction="true"/> </iterate> </simple-method> @@ -272,7 +286,7 @@ <set field="custRequest.description" from-field="communicationEvent.content"/> <set field="custRequest.fromPartyId" from-field="communicationEvent.partyIdFrom"/> <set field="custRequest.custRequestTypeId" value="RF_SUPPORT"/> - <set field="custRequest.statusId" value="CRQ_SUBMITTED"/> + <set field="custRequest.statusId" value="CRQ_ACCEPTED"/> <set-service-fields service-name="createCustRequest" map-name="parameters" to-map-name="custRequest"/> <call-service service-name="createCustRequest" in-map-name="custRequest"> @@ -280,6 +294,11 @@ </call-service> <set-service-fields service-name="createCustRequestCommEvent" map-name="parameters" to-map-name="custRequestCommEvent"/> <call-service service-name="createCustRequestCommEvent" in-map-name="custRequestCommEvent"/> + + <!-- update status from communication event --> + <set field="communicationEvent.statusId" value="COM_COMPLETE"/> + <store-value value-name="communicationEvent"/> + <field-to-result field-name="parameters.custRequestId" result-name="custRequestId"/> </simple-method> <simple-method method-name="createCustRequestCommEvent" short-description="Create CustRequestCommEvent" > @@ -287,4 +306,24 @@ <set-pk-fields map-name="parameters" value-name="newEntity"/> <create-value value-name="newEntity"/> </simple-method> + + <simple-method method-name="setCommunicationEventStatus" short-description="Set The Communication Event Status"> + <entity-one entity-name="CommunicationEvent" value-name="communicationEvent"/> + <field-to-result field-name="communicationEvent.statusId" result-name="oldStatusId"/> + <if-compare-field field="communicationEvent.statusId" to-field="parameters.statusId" operator="not-equals"> + <entity-one entity-name="StatusValidChange" value-name="statusChange"> + <field-map field-name="statusId" env-name="communicationEvent.statusId"/> + <field-map field-name="statusIdTo" env-name="parameters.statusId"/> + </entity-one> + <if-empty field="statusChange"> + <add-error><fail-message message="Status is not a valid change"/></add-error> + <log level="error" message="Cannot change from ${communicationEvent.statusId} to ${parameters.statusId}"/> + <check-errors/> + <else> + <set field="communicationEvent.statusId" from-field="parameters.statusId"/> + <store-value value-name="communicationEvent"/> + </else> + </if-empty> + </if-compare-field> + </simple-method> </simple-methods> Modified: ofbiz/trunk/applications/party/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/servicedef/services.xml?rev=678342&r1=678341&r2=678342&view=diff ============================================================================== --- ofbiz/trunk/applications/party/servicedef/services.xml (original) +++ ofbiz/trunk/applications/party/servicedef/services.xml Sun Jul 20 21:22:19 2008 @@ -630,6 +630,13 @@ </service> <!-- Communication Event Services --> + <service name="setCommunicationEventStatus" engine="simple" + location="org/ofbiz/party/communication/CommunicationEventServices.xml" invoke="setCommunicationEventStatus" auth="true"> + <description>Set the Communication event Status</description> + <attribute name="communicationEventId" type="String" mode="IN" optional="false"/> + <attribute name="statusId" type="String" mode="IN" optional="false"/> + <attribute name="oldStatusId" type="String" mode="OUT" optional="true"/> + </service> <service name="createCommunicationEvent" engine="simple" location="org/ofbiz/party/communication/CommunicationEventServices.xml" invoke="createCommunicationEvent" auth="true"> <description>Create a Communication Event</description> @@ -638,6 +645,7 @@ <auto-attributes entity-name="CommunicationEvent" include="pk" mode="INOUT" optional="true"/> <attribute name="productId" type="String" mode="IN" optional="true"/> <attribute name="orderId" type="String" mode="IN" optional="true"/> + <attribute name="custRequestId" type="String" mode="IN" optional="true"/> </service> <service name="updateCommunicationEvent" engine="simple" location="org/ofbiz/party/communication/CommunicationEventServices.xml" invoke="updateCommunicationEvent" auth="true"> @@ -645,6 +653,7 @@ <permission-service service-name="partyCommunicationEventPermissionCheck" main-action="UPDATE"/> <auto-attributes entity-name="CommunicationEvent" include="pk" mode="IN" optional="false"/> <auto-attributes entity-name="CommunicationEvent" include="nonpk" mode="IN" optional="true"/> + <attribute name="oldStatusId" type="String" mode="OUT" optional="true"/> </service> <service name="deleteCommunicationEvent" engine="simple" location="org/ofbiz/party/communication/CommunicationEventServices.xml" invoke="deleteCommunicationEvent" 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=678342&r1=678341&r2=678342&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml Sun Jul 20 21:22:19 2008 @@ -22,9 +22,7 @@ <form name="EditCommEvent" type="single" target="updateCommunicationEvent" default-map-name="communicationEvent"> <alt-target target="createCommunicationEvent" use-when="communicationEvent==null"/> - <field name="partyId" map-name="parameters"><hidden/></field> - - <field name="communicationEventId" use-when="communicationEvent==null"><display/></field> + <field name="communicationEventId" use-when="communicationEvent!=null"><display/></field> <field name="parentCommEventId" position="2"> <lookup target-form-name="LookupCommEvent"> <sub-hyperlink link-style="buttontext" target="EditCommunicationEvent?communicationEventId=${parentCommEventId}" description="${uiLabelMap.PartyGoToParent}" use-when="communicationEvent!=null&&communicationEvent.get("parentCommEventId")!=null"/> @@ -359,7 +357,7 @@ <service result-map-list-name="listIt" result-map-name="result" service-name="performFind"> <field-map env-name="parameters" field-name="inputFields"/> <field-map env-name="entityName" field-name="entityName"/> - <field-map value="datetimeStarted DESC" field-name="orderBy"/> + <field-map value="-createdStamp" field-name="orderBy"/> </service> </actions> <field name="removeLink" title="${uiLabelMap.CommonDelete}" widget-style="smallSubmit"> @@ -605,10 +603,12 @@ <form name="ListMyUnknownPartyEmails" type="multi" use-row-submit="true" title="Email List unknown parties" list-name="commEventsUnknown" - default-widget-style="tabletext" default-tooltip-style="tabletext" - target="deleteCommunicationEvents?communicationEventId=${communicationEventId}&delContentDataResource=Y" - default-entity-name="CommunicationEvent" + target="deleteCommunicationEvents" default-entity-name="CommunicationEvent" odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar"> + <row-actions> + <set field="subject" from-field="subject" default-value="${uiLabelMap.PartyNoSubject}"/> + </row-actions> + <field name="delContentDataResource"><hidden value="Y"/></field> <field name="communicationEventId"> <hidden /> </field> Modified: ofbiz/trunk/applications/party/webapp/partymgr/communication/CommMenus.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/communication/CommMenus.xml?rev=678342&r1=678341&r2=678342&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/communication/CommMenus.xml (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/communication/CommMenus.xml Sun Jul 20 21:22:19 2008 @@ -81,13 +81,19 @@ </menu-item> <menu-item name="reply" title="${uiLabelMap.PartyReply}"> <condition> - <not><if-empty field-name="parameters.communicationEventId"/></not> + <and> + <not><if-empty field-name="parameters.communicationEventId"/></not> + <not><if-empty field-name="communicationEvent.partyIdFrom"/></not> + </and> </condition> <link target="EditCommunicationEvent?parentCommEventId=${parameters.communicationEventId}"/> </menu-item> <menu-item name="createRequestFromCommEvent" title="${uiLabelMap.PartyCreateRequestFromCommEvent}"> <condition> - <not><if-empty field-name="parameters.communicationEventId"/></not> + <and> + <not><if-empty field-name="parameters.communicationEventId"/></not> + <not><if-empty field-name="communicationEvent.partyIdFrom"/></not> + </and> </condition> <link target="editRequestFromCommEvent?communicationEventId=${parameters.communicationEventId}"/> </menu-item> |
Free forum by Nabble | Edit this page |