svn commit: r1821486 - in /ofbiz/ofbiz-framework/trunk: applications/datamodel/entitydef/ applications/order/config/ applications/order/entitydef/ applications/order/servicedef/ applications/order/src/main/java/org/apache/ofbiz/order/order/ application...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1821486 - in /ofbiz/ofbiz-framework/trunk: applications/datamodel/entitydef/ applications/order/config/ applications/order/entitydef/ applications/order/servicedef/ applications/order/src/main/java/org/apache/ofbiz/order/order/ application...

rishi
Author: rishi
Date: Thu Jan 18 11:34:01 2018
New Revision: 1821486

URL: http://svn.apache.org/viewvc?rev=1821486&view=rev
Log:
Implemented: Add ability to record Return Communication. Added support to record communication event against return. Added new entity CommunicationEventReturn, crund and supporting screens. Also added support in the existing email services to handle the return cases.
(OFBIZ-9911)
Thanks to Ratnesh Upadhyay for your contribution.

Modified:
    ofbiz/ofbiz-framework/trunk/applications/datamodel/entitydef/order-entitymodel.xml
    ofbiz/ofbiz-framework/trunk/applications/order/config/OrderUiLabels.xml
    ofbiz/ofbiz-framework/trunk/applications/order/entitydef/entitymodel_view.xml
    ofbiz/ofbiz-framework/trunk/applications/order/servicedef/services_return.xml
    ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java
    ofbiz/ofbiz-framework/trunk/applications/party/config/PartyUiLabels.xml
    ofbiz/ofbiz-framework/trunk/applications/party/minilang/communication/CommunicationEventServices.xml
    ofbiz/ofbiz-framework/trunk/applications/party/servicedef/services.xml
    ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java
    ofbiz/ofbiz-framework/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml
    ofbiz/ofbiz-framework/trunk/applications/party/widget/partymgr/CommunicationEventForms.xml
    ofbiz/ofbiz-framework/trunk/applications/party/widget/partymgr/CommunicationEventScreens.xml
    ofbiz/ofbiz-framework/trunk/applications/party/widget/partymgr/PartyMenus.xml
    ofbiz/ofbiz-framework/trunk/framework/common/servicedef/services_email.xml
    ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java

Modified: ofbiz/ofbiz-framework/trunk/applications/datamodel/entitydef/order-entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/datamodel/entitydef/order-entitymodel.xml?rev=1821486&r1=1821485&r2=1821486&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/datamodel/entitydef/order-entitymodel.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/datamodel/entitydef/order-entitymodel.xml Thu Jan 18 11:34:01 2018
@@ -2755,6 +2755,21 @@ under the License.
             <key-map field-name="contactMechPurposeTypeId"/>
         </relation>
     </entity>
+    
+    <entity entity-name="CommunicationEventReturn"
+            package-name="org.apache.ofbiz.order.return"
+            title="Communication Event Return Entity">
+      <field name="returnId" type="id"></field>
+      <field name="communicationEventId" type="id"></field>
+      <prim-key field="returnId"/>
+      <prim-key field="communicationEventId"/>
+      <relation type="one" fk-name="COMEV_ORDER_RETURN" rel-entity-name="ReturnHeader">
+        <key-map field-name="returnId"/>
+      </relation>
+      <relation type="one" fk-name="COMEV_RETURN_CMEV" rel-entity-name="CommunicationEvent">
+        <key-map field-name="communicationEventId"/>
+      </relation>
+    </entity>
 
   <!-- ========================================================= -->
   <!-- org.apache.ofbiz.order.shoppingcart -->

Modified: ofbiz/ofbiz-framework/trunk/applications/order/config/OrderUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/config/OrderUiLabels.xml?rev=1821486&r1=1821485&r2=1821486&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/config/OrderUiLabels.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/config/OrderUiLabels.xml Thu Jan 18 11:34:01 2018
@@ -9072,6 +9072,9 @@
         <value xml:lang="zh-CN">退货单</value>
         <value xml:lang="zh-TW">退貨</value>
     </property>
+    <property key="OrderReturnHeaderType">
+        <value xml:lang="en">Return Header Type</value>
+    </property>
     <property key="OrderOrderShortcuts">
         <value xml:lang="ar">اختصارات</value>
         <value xml:lang="de">Abkürzungen</value>

Modified: ofbiz/ofbiz-framework/trunk/applications/order/entitydef/entitymodel_view.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/entitydef/entitymodel_view.xml?rev=1821486&r1=1821485&r2=1821486&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/entitydef/entitymodel_view.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/entitydef/entitymodel_view.xml Thu Jan 18 11:34:01 2018
@@ -1651,7 +1651,19 @@ under the License.
         <key-map field-name="communicationEventId"/>
       </view-link>
     </view-entity>
-
+    
+    <view-entity entity-name="CommunicationEventAndReturn"
+                 package-name="org.apache.ofbiz.return.communication"
+                 title="Communication Event And Return View Entity">
+      <member-entity entity-alias="CR" entity-name="CommunicationEventReturn"/>
+      <member-entity entity-alias="CE" entity-name="CommunicationEvent"/>
+      <alias-all entity-alias="CR"/>
+      <alias-all entity-alias="CE"/>
+      <view-link entity-alias="CR" rel-entity-alias="CE">
+        <key-map field-name="communicationEventId"/>
+      </view-link>
+    </view-entity>
+    
     <view-entity entity-name="OrderItemAndShipGrpInvResAndItemSum"
             package-name="org.apache.ofbiz.order.order"
             never-cache="true"

Modified: ofbiz/ofbiz-framework/trunk/applications/order/servicedef/services_return.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/servicedef/services_return.xml?rev=1821486&r1=1821485&r2=1821486&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/servicedef/services_return.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/servicedef/services_return.xml Thu Jan 18 11:34:01 2018
@@ -474,4 +474,13 @@ under the License.
         <description>Delete a ReturnType record</description>
         <auto-attributes include="pk" mode="IN"/>
     </service>
+    
+    <service name="createCommunicationEventReturn" default-entity-name="CommunicationEventReturn" engine="entity-auto" invoke="create" auth="true">
+        <description>Create a Communication Event Return</description>
+        <auto-attributes entity-name="CommunicationEventReturn" include="pk" mode="IN"/>
+    </service>
+    <service name="removeCommunicationEventReturn" default-entity-name="CommunicationEventReturn" engine="entity-auto" invoke="delete" auth="true">
+        <description>Remove a Communication Event Return</description>
+        <auto-attributes entity-name="CommunicationEventReturn" include="pk" mode="IN"/>
+    </service>
 </services>

Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java?rev=1821486&r1=1821485&r2=1821486&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java Thu Jan 18 11:34:01 2018
@@ -277,6 +277,7 @@ public class OrderReturnServices {
                 sendMap.put("sendBcc", productStoreEmail.get("bccAddress"));
                 sendMap.put("sendTo", emailAddress);
                 sendMap.put("partyId", returnHeader.getString("fromPartyId"));
+                sendMap.put("returnId", returnId);
 
                 sendMap.put("userLogin", userLogin);
 

Modified: ofbiz/ofbiz-framework/trunk/applications/party/config/PartyUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/config/PartyUiLabels.xml?rev=1821486&r1=1821485&r2=1821486&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/party/config/PartyUiLabels.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/party/config/PartyUiLabels.xml Thu Jan 18 11:34:01 2018
@@ -3120,6 +3120,10 @@
         <value xml:lang="zh">添加沟通事件产品</value>
         <value xml:lang="zh-TW">增加通訊事件產品</value>
     </property>
+    <property key="PartyAddCommEventReturn">
+        <value xml:lang="en">Add Communication Event Return</value>
+        <value xml:lang="hi-IN">संचार घटना रिटर्न जोड़ें</value>
+    </property>
     <property key="PartyAddListToCart">
         <value xml:lang="ar">إضافة القائمة للسلة</value>
         <value xml:lang="de">Liste zum Einkaufswagen hinzufügen</value>
@@ -4568,6 +4572,10 @@
         <value xml:lang="zh">沟通事件目的</value>
         <value xml:lang="zh-TW">通訊事件目的</value>
     </property>
+    <property key="PartyCommEventReturns">
+        <value xml:lang="en">Communication Event Returns</value>
+        <value xml:lang="hi-IN">संचार घटना रिटर्न</value>
+    </property>
     <property key="PartyCommEventRoles">
         <value xml:lang="ar">أدوار الإتصال</value>
         <value xml:lang="de">Kommunikationsereignis Rollen</value>
@@ -6844,6 +6852,10 @@
         <value xml:lang="zh">按订单查找沟通</value>
         <value xml:lang="zh-TW">按訂單查詢通訊</value>
     </property>
+    
+    <property key="PartyFindCommunicationsByReturn">
+        <value xml:lang="en">Find Communications by Return</value>
+    </property>
     <property key="PartyFindParty">
         <value xml:lang="ar">إيجاد الطرف</value>
         <value xml:lang="de">Akteur suchen</value>
@@ -9937,6 +9949,10 @@
         <value xml:lang="zh">订单——上次</value>
         <value xml:lang="zh-TW">訂單——上次</value>
     </property>
+    <property key="PartyReturnAdd">
+        <value xml:lang="en">Return Add</value>
+        <value xml:lang="hi-IN">वापसी जोड़ें</value>
+    </property>
     <property key="PartyOrganizationParty">
         <value xml:lang="ar">طرف المنظمة</value>
         <value xml:lang="de">Organisation Akteur</value>
@@ -13605,6 +13621,11 @@
         <value xml:lang="zh">浏览沟通产品</value>
         <value xml:lang="zh-TW">檢視通訊產品</value>
     </property>
+    
+    <property key="PartyViewCommReturns">
+        <value xml:lang="en">View Communication Returns</value>
+        <value xml:lang="hi-IN">संचार रिटर्न देखें</value>
+    </property>
     <property key="PartyViewCommunicationEvent">
         <value xml:lang="ar">إستعراض الإتصال</value>
         <value xml:lang="cs">Zobrazit komunikační událost</value>

Modified: ofbiz/ofbiz-framework/trunk/applications/party/minilang/communication/CommunicationEventServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/minilang/communication/CommunicationEventServices.xml?rev=1821486&r1=1821485&r2=1821486&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/party/minilang/communication/CommunicationEventServices.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/party/minilang/communication/CommunicationEventServices.xml Thu Jan 18 11:34:01 2018
@@ -206,6 +206,12 @@ under the License.
             <set from-field="newEntity.communicationEventId" field="eventOrder.communicationEventId"/>
             <create-value value-field="eventOrder"/>
         </if-not-empty>
+        <if-not-empty field="parameters.returnId">
+            <make-value entity-name="CommunicationEventReturn" value-field="eventReturn"/>
+            <set from-field="parameters.returnId" field="eventReturn.returnId"/>
+            <set from-field="newEntity.communicationEventId" field="eventReturn.communicationEventId"/>
+            <create-value value-field="eventReturn"/>
+        </if-not-empty>
         <if-not-empty field="parameters.custRequestId">
             <set from-field="parameters.custRequestId" field="CustRequestCommEvent.custRequestId"/>
             <set from-field="newEntity.communicationEventId" field="CustRequestCommEvent.communicationEventId"/>

Modified: ofbiz/ofbiz-framework/trunk/applications/party/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/servicedef/services.xml?rev=1821486&r1=1821485&r2=1821486&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/party/servicedef/services.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/party/servicedef/services.xml Thu Jan 18 11:34:01 2018
@@ -746,6 +746,7 @@ under the License.
         <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="returnId" type="String" mode="IN" optional="true"/>
         <attribute name="custRequestId" type="String" mode="IN" optional="true"/>
         <attribute name="action" type="String" mode="IN" optional="true"/><!-- to indicate any special action like: REPLY, REPLYALL, FORWARD or empty for no special action-->
         <override name="headerString" allow-html="any"/>
@@ -899,6 +900,7 @@ under the License.
         <attribute name="contentType" type="String" mode="IN" optional="true"/>
         <attribute name="statusId" type="String" mode="IN" optional="true"/>
         <attribute name="orderId" type="String" mode="IN" optional="true"/>
+        <attribute name="returnId" type="String" mode="IN" optional="true"/>
         <attribute name="communicationEventId" type="String" mode="OUT"/>
     </service>
     <service name="updateCommEventAfterEmail" engine="java"

Modified: ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java?rev=1821486&r1=1821485&r2=1821486&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java Thu Jan 18 11:34:01 2018
@@ -542,6 +542,7 @@ public class CommunicationEventServices
         String contentType = (String) context.get("contentType");
         String statusId = (String) context.get("statusId");
         String orderId = (String) context.get("orderId");
+        String returnId = (String) context.get("returnId");
         if (statusId == null) {
             statusId = "COM_PENDING";
         }
@@ -594,6 +595,9 @@ public class CommunicationEventServices
         if (UtilValidate.isNotEmpty(orderId)) {
             commEventMap.put("orderId", orderId);
         }
+        if (UtilValidate.isNotEmpty(returnId)) {
+            commEventMap.put("returnId", returnId);
+        }
 
         Map<String, Object> createResult;
         try {

Modified: ofbiz/ofbiz-framework/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml?rev=1821486&r1=1821485&r2=1821486&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml Thu Jan 18 11:34:01 2018
@@ -732,6 +732,10 @@ under the License.
         <security https="true" auth="true"/>
         <response name="success" type="view" value="FindCommunicationByOrder"/>
     </request-map>
+    <request-map uri="FindCommunicationByReturn">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="FindCommunicationByReturn"/>
+    </request-map>
     <request-map uri="editRequestFromCommEvent">
         <security https="true" auth="true"/>
         <response name="success" type="view" value="EditRequestFromCommEvent" save-last-view="true"/>
@@ -1125,6 +1129,22 @@ under the License.
         <response name="success" type="view" value="UpdateCommOrders"/>
         <response name="error" type="view" value="UpdateCommOrders"/>
     </request-map>
+    <request-map uri="UpdateCommReturns">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="UpdateCommReturns"/>
+    </request-map>
+    <request-map uri="createCommunicationEventReturn">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="createCommunicationEventReturn"/>
+        <response name="success" type="view" value="UpdateCommReturns"/>
+        <response name="error" type="view" value="UpdateCommReturns"/>
+    </request-map>
+    <request-map uri="deleteCommunicationEventReturn">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="removeCommunicationEventReturn"/>
+        <response name="success" type="view" value="UpdateCommReturns"/>
+        <response name="error" type="view" value="UpdateCommReturns"/>
+    </request-map>
 
     <!-- Product communication event requests -->
     <request-map uri="UpdateCommProducts">
@@ -1345,6 +1365,7 @@ under the License.
     <view-map name="ListPartyCommEvents" type="screen" page="component://party/widget/partymgr/CommunicationEventScreens.xml#ListPartyCommEvents"/>
     <view-map name="ListUnknownPartyComms" type="screen" page="component://party/widget/partymgr/CommunicationEventScreens.xml#ListUnknownPartyComms"/>
     <view-map name="FindCommunicationByOrder" type="screen" page="component://party/widget/partymgr/CommunicationEventScreens.xml#FindCommunicationByOrder"/>
+    <view-map name="FindCommunicationByReturn" type="screen" page="component://party/widget/partymgr/CommunicationEventScreens.xml#FindCommunicationByReturn"/>
     <view-map name="MyCommunicationEvents" type="screen" page="component://party/widget/partymgr/CommunicationEventScreens.xml#PartyCommunicationEvents"/>
     <view-map name="FindCommunicationEvents" type="screen" page="component://party/widget/partymgr/CommunicationEventScreens.xml#FindCommunicationEvents"/>
     <view-map name="EditCommunicationEvent" type="screen" page="component://party/widget/partymgr/CommunicationEventScreens.xml#EditCommunicationEvent"/>
@@ -1428,6 +1449,7 @@ under the License.
     <view-map name="AddAccountRelatedContact" type="screen" page="component://party/widget/partymgr/PartyScreens.xml#CreateAccountRelatedContact"/>
 
     <view-map name="UpdateCommOrders" type="screen" page="component://party/widget/partymgr/CommunicationEventScreens.xml#UpdateCommOrders"/>
+    <view-map name="UpdateCommReturns" type="screen" page="component://party/widget/partymgr/CommunicationEventScreens.xml#UpdateCommReturns"/>
     <view-map name="UpdateCommProducts" type="screen" page="component://party/widget/partymgr/CommunicationEventScreens.xml#UpdateCommProducts"/>
 
     <view-map name="ViewProductStoreRoles" type="screen" page="component://party/widget/partymgr/PartyScreens.xml#ViewProductStoreRoles"/>

Modified: ofbiz/ofbiz-framework/trunk/applications/party/widget/partymgr/CommunicationEventForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/widget/partymgr/CommunicationEventForms.xml?rev=1821486&r1=1821485&r2=1821486&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/party/widget/partymgr/CommunicationEventForms.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/party/widget/partymgr/CommunicationEventForms.xml Thu Jan 18 11:34:01 2018
@@ -1047,4 +1047,83 @@ under the License.
         <field name="productId" title="${uiLabelMap.PartyProductId}"><lookup target-form-name="LookupProduct"/></field>
         <field name="submitButton" title="${uiLabelMap.PartyProductAdd}" widget-style="smallSubmit"><submit button-type="button"/></field>
     </form>
+    
+    <form name="FindCommunicationByReturn" type="single" target="FindCommunicationByReturn" paginate="true" focus-field-name="submitButton"
+        header-row-style="header-row" default-table-style="basic-table">
+        <field name="noConditionFind"><hidden value="Y"/><!-- if this isn't there then with all fields empty no query will be done --></field>
+        <field name="returnId" position="1"><text-find/></field>
+        <field name="communicationEventId" position="1"><text-find/></field>
+        <field name="partyIdFrom" position="1" title="${uiLabelMap.CommonPartyId} ${uiLabelMap.CommonFrom}"><lookup target-form-name="LookupPartyName"/></field>
+        <field name="partyIdTo" position="2" title="${uiLabelMap.CommonPartyId} ${uiLabelMap.CommonTo}"><lookup target-form-name="LookupPartyName"/></field>
+        <field name="partyId" position="1" title="${uiLabelMap.CommonPartyId} ${uiLabelMap.PartyAnyRole}"><lookup target-form-name="LookupPartyName"/></field>
+        <field name="communicationEventTypeId" position="2">
+            <drop-down allow-empty="true">
+                <entity-options entity-name="CommunicationEventType" key-field-name="communicationEventTypeId"/>
+            </drop-down>
+        </field>
+        <field name="statusId" position="2">
+            <drop-down allow-empty="true">
+                <entity-options entity-name="StatusItem">
+                    <entity-constraint name="statusTypeId" operator="equals" value="COM_EVENT_STATUS"/>
+                </entity-options>
+            </drop-down>
+        </field>
+        <field name="submitButton" title="${uiLabelMap.CommonFind}"><submit button-type="button"/></field>
+    </form>
+
+    <form name="ListCommunicationByReturn" type="list" list-name="listIt" extends="ListCommEvents" header-row-style="header-row-2">
+        <actions>
+            <service service-name="performFind" result-map="result" result-map-list="listIt">
+                <field-map field-name="inputFields" from-field="parameters"/>
+                <field-map field-name="entityName" from-field="entityName"/>
+                <field-map field-name="orderBy" value="-entryDate"/>
+                <field-map field-name="viewIndex" from-field="viewIndex"/>
+                <field-map field-name="viewSize" from-field="viewSize"/>
+            </service>
+        </actions>
+        <field name="returnId" title="${uiLabelMap.FormFieldTitle_returnId}">
+            <hyperlink description="${returnId}" target="/ordermgr/control/returnMain?returnId=${returnId}" target-type="inter-app"/>
+        </field>
+        <field name="communicationEventId">
+            <hyperlink description="${communicationEventId}" target="ViewCommunicationEvent">
+                <parameter param-name="communicationEventId"/>
+            </hyperlink>
+        </field>
+        <field name="subject">
+            <hyperlink description="${subject}" target="ViewCommunicationEvent">
+                <parameter param-name="communicationEventId"/>
+                <parameter param-name="partyId"/>
+                <parameter param-name="roleTypeId"/>
+            </hyperlink>
+        </field>
+    </form>
+    
+    <form name="AddCommReturn" type="single" target="createCommunicationEventReturn" header-row-style="header-row" default-table-style="basic-table">
+        <field name="communicationEventId"><hidden/></field>
+        <field name="returnId"><text/></field>
+        <field name="submitButton" title="${uiLabelMap.PartyReturnAdd}" widget-style="smallSubmit"><submit button-type="button"/></field>
+    </form>
+    
+    <form name="ListCommReturns" list-name="returnsList" type="list" target="deleteCommunicationEventReturn" paginate-target="UpdateCommReturns" odd-row-style="alternate-row" default-table-style="basic-table hover-bar" view-size="20">
+        <actions>
+            <entity-and entity-name="CommunicationEventReturn" list="returnsList">
+                <field-map field-name="communicationEventId"/>
+            </entity-and>
+        </actions>
+        <row-actions>
+            <entity-one entity-name="ReturnHeader" value-field="returnHeader" auto-field-map="true"/>
+            <set field="returnHeaderTypeId" from-field="returnHeader.returnHeaderTypeId"/>
+        </row-actions>
+        <field name="returnId" title="${uiLabelMap.FormFieldTitle_returnId}" widget-style="buttontext">
+            <hyperlink description="${returnId}" target="/ordermgr/control/returnMain?returnId=${returnId}" target-type="inter-app"/>
+        </field>
+        <field name="communicationEventId"><hidden/></field>
+        <field name="returnHeaderTypeId" title="${uiLabelMap.OrderReturnHeaderType}">
+            <display-entity entity-name="ReturnHeaderType" key-field-name="returnHeaderTypeId"/>
+        </field>
+        <field name="createdBy" title="${uiLabelMap.CommonCreatedBy}">
+            <display description="${returnHeader.createdBy}"/>
+        </field>
+        <field name="deleteButton" title="${uiLabelMap.CommonDelete}" widget-style="smallSubmit"><submit/></field>
+    </form>
 </forms>

Modified: ofbiz/ofbiz-framework/trunk/applications/party/widget/partymgr/CommunicationEventScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/widget/partymgr/CommunicationEventScreens.xml?rev=1821486&r1=1821485&r2=1821486&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/party/widget/partymgr/CommunicationEventScreens.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/party/widget/partymgr/CommunicationEventScreens.xml Thu Jan 18 11:34:01 2018
@@ -339,6 +339,39 @@ under the License.
             </widgets>
         </section>
     </screen>
+    
+    <screen name="FindCommunicationByReturn">
+        <section>
+            <actions>
+                <set field="tabButtonItem" value="FindCommunicationByReturn"/>
+                <set field="entityName" value="CommunicationEventAndReturn"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonCommunicationEventDecorator" location="${parameters.communicationEventDecoratorLocation}">
+                    <decorator-section name="body">
+                        <section>
+                            <condition>
+                                <if-service-permission service-name="partyCommunicationEventPermissionCheck" main-action="VIEW"/>
+                            </condition>
+                            <widgets>
+                                <decorator-screen name="FindScreenDecorator" location="component://common/widget/CommonScreens.xml">
+                                    <decorator-section name="search-options">
+                                        <include-form name="FindCommunicationByReturn" location="component://party/widget/partymgr/CommunicationEventForms.xml"/>
+                                    </decorator-section>
+                                    <decorator-section name="search-results">
+                                        <include-form name="ListCommunicationByReturn" location="component://party/widget/partymgr/CommunicationEventForms.xml"/>
+                                    </decorator-section>
+                                </decorator-screen>
+                            </widgets>
+                            <fail-widgets>
+                                <label style="h3">${uiLabelMap.PartyMgrViewPermissionError}</label>
+                            </fail-widgets>
+                        </section>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
 
     <screen name="FindCommunicationEvents">
         <section>
@@ -1178,4 +1211,29 @@ under the License.
             </widgets>
         </section>
     </screen>
+    <screen name="UpdateCommReturns">
+        <section>
+            <actions>
+                <set field="titleProperty" value="PartyViewCommReturns"/>
+                <set field="tabButtonItem" value="UpdateCommReturns"/>
+                <set field="communicationEventId" from-field="parameters.communicationEventId"/>
+                <set field="partyId" from-field="parameters.partyId"/>
+                <set field="partyIdFrom" from-field="parameters.partyIdFrom" default-value="${userLogin.partyId}"/>
+                <set field="partyIdTo" from-field="parameters.partyIdTo" default-value="${userLogin.partyId}"/>
+                <entity-one entity-name="CommunicationEvent" value-field="communicationEvent"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonCommunicationEventDecorator" location="${parameters.communicationEventDecoratorLocation}">
+                    <decorator-section name="body">
+                        <screenlet title="${uiLabelMap.PartyCommEventReturns}">
+                            <include-form name="ListCommReturns" location="component://party/widget/partymgr/CommunicationEventForms.xml"/>
+                        </screenlet>
+                        <screenlet title="${uiLabelMap.PartyAddCommEventReturn}">
+                            <include-form name="AddCommReturn" location="component://party/widget/partymgr/CommunicationEventForms.xml"/>
+                        </screenlet>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+           </section>
+    </screen>
 </screens>

Modified: ofbiz/ofbiz-framework/trunk/applications/party/widget/partymgr/PartyMenus.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/widget/partymgr/PartyMenus.xml?rev=1821486&r1=1821485&r2=1821486&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/party/widget/partymgr/PartyMenus.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/party/widget/partymgr/PartyMenus.xml Thu Jan 18 11:34:01 2018
@@ -614,6 +614,9 @@
         <menu-item name="FindCommunicationByOrder" title="${uiLabelMap.PartyFindCommunicationsByOrder}">
             <link target="FindCommunicationByOrder"/>
         </menu-item>
+        <menu-item name="FindCommunicationByReturn" title="${uiLabelMap.PartyFindCommunicationsByReturn}">
+            <link target="FindCommunicationByReturn"/>
+        </menu-item>
         <menu-item name="UpdateCommOrders" title="${uiLabelMap.OrderOrders}">
             <condition><not><if-empty field="communicationEvent"/></not></condition>
             <link target="UpdateCommOrders">
@@ -626,6 +629,12 @@
                 <parameter param-name="communicationEventId" from-field="parameters.communicationEventId"/>
             </link>
         </menu-item>
+        <menu-item name="UpdateCommReturns" title="${uiLabelMap.Return}">
+            <condition><not><if-empty field="communicationEvent"/></not></condition>
+            <link target="UpdateCommReturns">
+                <parameter param-name="communicationEventId" from-field="parameters.communicationEventId"/>
+            </link>
+        </menu-item>
     </menu>
     <menu name="CommFindTabBar" extends="CommonTabBarMenu" extends-resource="component://common/widget/CommonMenus.xml"
         default-menu-item-name="find">

Modified: ofbiz/ofbiz-framework/trunk/framework/common/servicedef/services_email.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/servicedef/services_email.xml?rev=1821486&r1=1821485&r2=1821486&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/servicedef/services_email.xml (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/servicedef/services_email.xml Thu Jan 18 11:34:01 2018
@@ -48,6 +48,7 @@ under the License.
         <attribute name="messageId" type="String" mode="INOUT" optional="true"/>
         <attribute name="emailType" type="String" mode="INOUT" optional="true"/>
         <attribute name="orderId" type="String" mode="INOUT" optional="true"/>
+        <attribute name="returnId" type="String" mode="INOUT" optional="true"/>
         <attribute name="custRequestId" type="String" mode="INOUT" optional="true"/>
         <attribute name="messageWrapper" type="org.apache.ofbiz.service.mail.MimeMessageWrapper" mode="OUT" optional="true"/><!-- mail can be disabled in general.properties so no output -->
         <!--  used for parsing and ECAs -->

Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java?rev=1821486&r1=1821485&r2=1821486&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java Thu Jan 18 11:34:01 2018
@@ -101,6 +101,7 @@ public class EmailServices {
         Delegator delegator = ctx.getDelegator();
         String communicationEventId = (String) context.get("communicationEventId");
         String orderId = (String) context.get("orderId");
+        String returnId = (String) context.get("returnId");
         Locale locale = (Locale) context.get("locale");
         if (communicationEventId != null) {
             Debug.logInfo("SendMail Running, for communicationEventId : " + communicationEventId, module);
@@ -121,6 +122,9 @@ public class EmailServices {
         if (UtilValidate.isNotEmpty(orderId)) {
             results.put("orderId", orderId);
         }
+        if (UtilValidate.isNotEmpty(returnId)) {
+            results.put("returnId", returnId);
+        }
         if (UtilValidate.isNotEmpty(body)) {
             body = FlexibleStringExpander.expandString(body, context);
             results.put("body", body);
@@ -476,6 +480,7 @@ public class EmailServices {
             partyId = (String) bodyParameters.get("partyId");
         }
         String orderId = (String) bodyParameters.get("orderId");
+        String returnId = (String) serviceContext.get("returnId");
         String custRequestId = (String) bodyParameters.get("custRequestId");
         
         bodyParameters.put("communicationEventId", serviceContext.get("communicationEventId"));
@@ -602,6 +607,9 @@ public class EmailServices {
         if (UtilValidate.isNotEmpty(orderId)) {
             serviceContext.put("orderId", orderId);
         }            
+        if (UtilValidate.isNotEmpty(returnId)) {
+            serviceContext.put("returnId", returnId);
+        }
         if (UtilValidate.isNotEmpty(custRequestId)) {
             serviceContext.put("custRequestId", custRequestId);
         }            
@@ -642,6 +650,9 @@ public class EmailServices {
         if (UtilValidate.isNotEmpty(orderId)) {
             result.put("orderId", orderId);
         }            
+        if (UtilValidate.isNotEmpty(returnId)) {
+            result.put("returnId", returnId);
+        }
         if (UtilValidate.isNotEmpty(custRequestId)) {
             result.put("custRequestId", custRequestId);
         }