Author: jleroux
Date: Thu Sep 26 15:11:52 2019
New Revision: 1867581

URL: http://svn.apache.org/viewvc?rev=1867581&view=rev
Log:
Improved: Add a discussion feature in  order detail view for following 
communication about the order (mail, phone etc.)
(OFBIZ-11210)

This is in order detail view for following communication about the order 
(mail, phone etc.) to keep an eye about all com' event linked to the order.

Thanks: Carl Demus

Added:
    ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/communications/
    
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/communications/CommunicationServices.groovy
   (with props)
    
ofbiz/ofbiz-framework/trunk/applications/party/groovyScripts/communication/GetPartyEmailAttachment.groovy
   (with props)
    
ofbiz/ofbiz-framework/trunk/applications/party/template/party/DisplayCommunicationContent.ftl
   (with props)
Modified:
    ofbiz/ofbiz-framework/trunk/applications/order/servicedef/services.xml
    
ofbiz/ofbiz-framework/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml
    
ofbiz/ofbiz-framework/trunk/applications/order/widget/ordermgr/OrderForms.xml
    
ofbiz/ofbiz-framework/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml
    ofbiz/ofbiz-framework/trunk/applications/party/config/PartyUiLabels.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/framework/common/config/CommonUiLabels.xml

Added: 
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/communications/CommunicationServices.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/communications/CommunicationServices.groovy?rev=1867581&view=auto
==============================================================================
--- 
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/communications/CommunicationServices.groovy
 (added)
+++ 
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/communications/CommunicationServices.groovy
 Thu Sep 26 15:11:52 2019
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ 
*******************************************************************************/
+
+import org.apache.ofbiz.base.util.UtilDateTime
+import org.apache.ofbiz.service.ServiceUtil
+
+/**
+ * Create a new order conversation
+ */
+def createOrderConversation() {
+    Map<String, Object> createCommunicationEventMap = 
dispatcher.getDispatchContext()
+            .makeValidContext('createCommunicationEvent', 'IN', parameters)
+    createCommunicationEventMap.entryDate = UtilDateTime.nowTimestamp()
+    createCommunicationEventMap.statusId = "COM_ENTERED"
+    def result = dispatcher.runSync('createCommunicationEvent', 
createCommunicationEventMap)
+    if (ServiceUtil.isError(result)) return result
+
+    if (parameters.communicationEventPrpTypId) {
+        Map<String, Object> createCommunicationEventPurposeMap = 
dispatcher.getDispatchContext()
+                .makeValidContext('createCommunicationEventPurpose', 'IN', 
parameters)
+        createCommunicationEventPurposeMap.communicationEventId = 
result.communicationEventId
+        return dispatcher.runSync('createCommunicationEventPurpose', 
createCommunicationEventPurposeMap);
+    }
+}
\ No newline at end of file

Propchange: 
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/communications/CommunicationServices.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/communications/CommunicationServices.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: 
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/communications/CommunicationServices.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/ofbiz-framework/trunk/applications/order/servicedef/services.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/servicedef/services.xml?rev=1867581&r1=1867580&r2=1867581&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/servicedef/services.xml 
(original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/servicedef/services.xml Thu 
Sep 26 15:11:52 2019
@@ -668,6 +668,12 @@ under the License.
         </required-permissions>
         <auto-attributes entity-name="CommunicationEventOrder" include="pk" 
mode="IN"/>
     </service>
+    <service name="createOrderConversation" engine="groovy" 
invoke="createOrderConversation" auth="true"
+             
location="component://order/groovyScripts/communications/CommunicationServices.groovy">
+        <description>Create a order conversation</description>
+        <implements service="createCommunicationEvent"/>
+        <implements service="createCommunicationEventPurpose"/>
+    </service>
 
     <!-- Order Shipping and Contacts -->
     <service name="createOrderItemShipGroup" 
default-entity-name="OrderItemShipGroup" engine="entity-auto" invoke="create" 
auth="true">

Modified: 
ofbiz/ofbiz-framework/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml?rev=1867581&r1=1867580&r2=1867581&view=diff
==============================================================================
--- 
ofbiz/ofbiz-framework/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml
 (original)
+++ 
ofbiz/ofbiz-framework/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml
 Thu Sep 26 15:11:52 2019
@@ -1981,6 +1981,20 @@ under the License.
         </response>
     </request-map>
 
+    <request-map uri="createOrderConversation">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="createOrderConversation"/>
+        <response name="success" type="request-redirect" value="orderview">
+            <redirect-parameter name="orderId"/>
+        </response>
+        <response name="error" type="request-redirect" value="orderview">
+            <redirect-parameter name="orderId"/>
+        </response>
+    </request-map>
+    <request-map uri="CreateNewOrderMessage">
+        <security auth="true" https="true"/>
+        <response name="success" type="view" value="CreateNewOrderMessage"/>
+    </request-map>
     <!-- end of request mappings -->
 
     <!-- View Mappings -->
@@ -1999,6 +2013,8 @@ under the License.
     <view-map name="receivepayment" type="screen" 
page="component://order/widget/ordermgr/OrderViewScreens.xml#OrderReceivePayment"/>
     <view-map name="viewimage" type="screen" 
page="component://order/widget/ordermgr/OrderViewScreens.xml#ViewImage"/>
     <view-map name="ListOrderTerms" type="screen" 
page="component://order/widget/ordermgr/OrderViewScreens.xml#ListOrderTerms"/>
+    <view-map name="CreateNewOrderMessage" type="screen" 
page="component://order/widget/ordermgr/OrderViewScreens.xml#CreateNewOrderMessage"/>
+
 
     <view-map name="survey" type="screen" 
page="component://order/widget/ordermgr/OrderEntryCartScreens.xml#survey"/>
     <view-map name="showcart" type="screen" 
page="component://order/widget/ordermgr/OrderEntryCartScreens.xml#ShowCart"/>
@@ -2158,5 +2174,8 @@ under the License.
 
     <view-map name="splitship" type="screen" 
page="component://order/widget/ordermgr/OrderEntryOrderScreens.xml#splitship"/>
     <view-map name="AddOrderAttachments" type="screen" 
page="component://order/widget/ordermgr/OrderViewScreens.xml#AddOrderAttachments"/>
+
+
+
     <!-- end of view mappings -->
 </site-conf>

Modified: 
ofbiz/ofbiz-framework/trunk/applications/order/widget/ordermgr/OrderForms.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/widget/ordermgr/OrderForms.xml?rev=1867581&r1=1867580&r2=1867581&view=diff
==============================================================================
--- 
ofbiz/ofbiz-framework/trunk/applications/order/widget/ordermgr/OrderForms.xml 
(original)
+++ 
ofbiz/ofbiz-framework/trunk/applications/order/widget/ordermgr/OrderForms.xml 
Thu Sep 26 15:11:52 2019
@@ -268,5 +268,20 @@ under the License.
         </field>
         <field name="submitButton" title="${uiLabelMap.CommonSubmit}" 
widget-style="smallSubmit"><submit button-type="button"/></field>
     </form>
+    <form name="createNewOrderMessage" type="single" 
target="createOrderConversation"
+          extends="createNewMessage" 
extends-resource="component://party/widget/partymgr/CommunicationEventForms.xml"
+          id="createNewOrderMessage${parentCommEventId}">
+        <field name="roleTypeIdFrom"><hidden value="AGENT"/></field>
+        <field name="roleTypeIdTo"><hidden value="CUSTOMER"/></field>
+        <field name="orderId"><hidden/></field>
+    </form>
 
+    <form name="createNewOrderConversation" type="single" target="">
+        <field name="createNewResponse" title=" " widget-area-style="h1">
+            <hyperlink target="CreateNewOrderMessage" 
link-type="layered-modal" description="${uiLabelMap.PartyNewConversation}" >
+                <parameter param-name="orderId"/>
+                <parameter param-name="communicationEventPrpTypId"/>
+            </hyperlink>
+        </field>
+    </form>
 </forms>

Modified: 
ofbiz/ofbiz-framework/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml?rev=1867581&r1=1867580&r2=1867581&view=diff
==============================================================================
--- 
ofbiz/ofbiz-framework/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml
 (original)
+++ 
ofbiz/ofbiz-framework/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml
 Thu Sep 26 15:11:52 2019
@@ -72,6 +72,7 @@ under the License.
                         <platform-specific>
                             <html><html-template 
location="component://order/template/order/Transitions.ftl"/></html>
                         </platform-specific>
+                        <include-screen name="OrderConversations"/>
                     </decorator-section>
                 </decorator-screen>
             </widgets>
@@ -608,6 +609,61 @@ under the License.
         </section>
     </screen>
 
+    <screen name="OrderConversations">
+        <section>
+            <actions>
+                <entity-one entity-name="OrderHeader" value-field="order"/>
+                <get-related-one relation-name="CreatedByUserLogin" 
value-field="order" to-value-field="createdUserLogin"/>
+                <entity-condition entity-name="CommunicationEventAndOrder" 
list="commEvents">
+                    <condition-list>
+                        <condition-expr field-name="orderId" 
from-field="order.orderId"/>
+                        <condition-expr field-name="parentCommEventId" 
from-field="nullField"/>
+                        <condition-expr field-name="communicationEventTypeId" 
from-field="parameters.communicationEventTypeId" ignore-if-empty="true"/>
+                    </condition-list>
+                    <order-by field-name="-entryDate"/>
+                </entity-condition>
+                <get-related-one relation-name="CreatedByUserLogin" 
value-field="order" to-value-field="createdByUserLogin" />
+                <set field="partyIdTo" 
from-field="createdByUserLogin.partyId"/><!-- store partyId to answer -->
+            </actions>
+            <widgets>
+                <screenlet title="${uiLabelMap.PartyAllCommunicationEvents}" 
name="orderCommunicationEvent" collapsible="true">
+                    <include-form 
location="component://order/widget/ordermgr/OrderForms.xml" 
name="createNewOrderConversation"/>
+                    <horizontal-separator/>
+                    <iterate-section entry="commEvent" list="commEvents">
+                        <section>
+                            <actions>
+                                <set field="communicationEventId" 
from-field="commEvent.communicationEventId"/>
+                                <set field="partyIdTo" 
from-field="commEvent.partyIdFrom"/><!-- store partyId to answer -->
+                            </actions>
+                            <widgets>
+                                <include-screen name="ConversationThread" 
location="component://party/widget/partymgr/CommunicationEventScreens.xml"/>
+                            </widgets>
+                        </section>
+                    </iterate-section>
+                </screenlet>
+            </widgets>
+        </section>
+    </screen>
+    <screen name="CreateNewOrderMessage">
+    <section>
+        <actions>
+            <entity-one entity-name="OrderHeader" value-field="order"/>
+            <get-related-one relation-name="CreatedByUserLogin" 
value-field="order" to-value-field="createdByUserLogin" />
+            <set field="partyIdTo" from-field="createdByUserLogin.partyId"/>
+            <set field="answer" 
from-field="parameters.parentCommEventId!=null" type="Boolean"/>
+        </actions>
+        <widgets>
+            <decorator-screen name="CommonPopUpDecorator" 
location="${parameters.mainDecoratorLocation}">
+                <decorator-section name="body">
+                    <screenlet 
title="${groovy:answer?uiLabelMap.PartyNewConversationAnswer:uiLabelMap.PartyNewConversation}"
 collapsible="true" initially-collapsed="true"
+                               id="createNewOrderConversation">
+                        <include-form name="createNewOrderMessage" 
location="component://order/widget/ordermgr/OrderForms.xml"/>
+                    </screenlet>
+                </decorator-section>
+            </decorator-screen>
+        </widgets>
+    </section>
+    </screen>
     <screen name="AddOrderAttachments">
         <section>
             <actions>

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=1867581&r1=1867580&r2=1867581&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/party/config/PartyUiLabels.xml 
(original)
+++ ofbiz/ofbiz-framework/trunk/applications/party/config/PartyUiLabels.xml Thu 
Sep 26 15:11:52 2019
@@ -5418,6 +5418,7 @@
         <value xml:lang="zh">内容标识</value>
         <value xml:lang="zh-TW">內容識別</value>
     </property>
+
     <property key="PartyCookie">
         <value xml:lang="ar">كوكي مستعرض الويب</value>
         <value xml:lang="de">Cookie</value>
@@ -9105,6 +9106,18 @@
         <value xml:lang="zh">注意:这个新的联系方式用于</value>
         <value xml:lang="zh-TW">注意: 這個新的聯絡方式用於</value>
     </property>
+    <property key="PartyNewConversation">
+        <value xml:lang="en">New Conversation</value>
+        <value xml:lang="fr">Nouvelle Conversation</value>
+        <value xml:lang="de">Neue Konversation</value>
+        <value xml:lang="it">Nuova conversazione</value>
+        <value xml:lang="es">Nueva conversación</value>
+    </property>
+    <property key="PartyNewConversationAnswer">
+        <value xml:lang="en">New Answer</value>
+        <value xml:lang="fr">Nouvelle Réponse</value>
+        <value xml:lang="de">Neue Antwort</value>
+    </property>
     <property key="PartyNewEmail">
         <value xml:lang="ar">رسالة بريد الكتروني 
جديدة</value>
         <value xml:lang="de">Neue E-Mail</value>

Added: 
ofbiz/ofbiz-framework/trunk/applications/party/groovyScripts/communication/GetPartyEmailAttachment.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/groovyScripts/communication/GetPartyEmailAttachment.groovy?rev=1867581&view=auto
==============================================================================
--- 
ofbiz/ofbiz-framework/trunk/applications/party/groovyScripts/communication/GetPartyEmailAttachment.groovy
 (added)
+++ 
ofbiz/ofbiz-framework/trunk/applications/party/groovyScripts/communication/GetPartyEmailAttachment.groovy
 Thu Sep 26 15:11:52 2019
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.ofbiz.entity.GenericValue
+
+communicationEventId = context.communicationEventId
+
+if (communicationEventId) {
+    //Find related CommEventContentDataResource
+    List<GenericValue> attachedContents = 
delegator.findByAnd("CommEventContentDataResource",
+            [communicationEventId : communicationEventId], null, true)
+    List<String> attachedContentNames = []
+        attachedContents.each { GenericValue attachedContent ->
+        attachedContentNames << attachedContent.contentName as String
+    }
+
+    if (attachedContentNames) {
+        context.attachedContentName = String.join(",", attachedContentNames)
+    }
+}

Propchange: 
ofbiz/ofbiz-framework/trunk/applications/party/groovyScripts/communication/GetPartyEmailAttachment.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
ofbiz/ofbiz-framework/trunk/applications/party/groovyScripts/communication/GetPartyEmailAttachment.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: 
ofbiz/ofbiz-framework/trunk/applications/party/groovyScripts/communication/GetPartyEmailAttachment.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
ofbiz/ofbiz-framework/trunk/applications/party/template/party/DisplayCommunicationContent.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/template/party/DisplayCommunicationContent.ftl?rev=1867581&view=auto
==============================================================================
--- 
ofbiz/ofbiz-framework/trunk/applications/party/template/party/DisplayCommunicationContent.ftl
 (added)
+++ 
ofbiz/ofbiz-framework/trunk/applications/party/template/party/DisplayCommunicationContent.ftl
 Thu Sep 26 15:11:52 2019
@@ -0,0 +1,4 @@
+<#-- Display content in a specific div to avoid display conflicts -->
+<div style="margin-left: 14%;width:50% !important;">
+    ${StringUtil.wrapString(childCommEvent.content!)}
+</div>
\ No newline at end of file

Propchange: 
ofbiz/ofbiz-framework/trunk/applications/party/template/party/DisplayCommunicationContent.ftl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
ofbiz/ofbiz-framework/trunk/applications/party/template/party/DisplayCommunicationContent.ftl
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: 
ofbiz/ofbiz-framework/trunk/applications/party/template/party/DisplayCommunicationContent.ftl
------------------------------------------------------------------------------
    svn:mime-type = text/plain

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=1867581&r1=1867580&r2=1867581&view=diff
==============================================================================
--- 
ofbiz/ofbiz-framework/trunk/applications/party/widget/partymgr/CommunicationEventForms.xml
 (original)
+++ 
ofbiz/ofbiz-framework/trunk/applications/party/widget/partymgr/CommunicationEventForms.xml
 Thu Sep 26 15:11:52 2019
@@ -259,7 +259,7 @@ under the License.
             </hyperlink>
         </field>
         <field name="note" title="${uiLabelMap.CommonNote}"><display/></field>
-        
+
         <sort-order>
             <field-group collapsible="false" initially-collapsed="false">
                 <sort-field name="communicationEventId"/>
@@ -318,7 +318,7 @@ under the License.
         <field map-name="subjectMap" name="eventNote" 
title="${uiLabelMap.CommonNote}"><display/></field>
         <field name="contentMimeTypeId" 
use-when="&quot;my&quot;==void"><display/></field>
         <field name="content" title="${uiLabelMap.CommonContent}" 
encode-output="false"><textarea cols="60" rows="10" read-only="true"/></field>
-        
+
         <sort-order>
             <field-group collapsible="false" initially-collapsed="false">
                 <sort-field name="communicationEventId"/>
@@ -485,7 +485,7 @@ under the License.
             </hyperlink>
         </field>
     </form>
-    
+
     <form name="ListPartyCommEvents" type="list" 
target="RemoveCommunicationEventRole" list-name="listIt"
         odd-row-style="alternate-row" header-row-style="header-row-2" 
default-table-style="basic-table hover-bar" 
sort-field-parameter-name="partyCommEventSortField">
         <actions>
@@ -859,7 +859,7 @@ under the License.
         <field name="imageData" map-name="empty"><file/></field>
         <field name="submitButton" 
title="${uiLabelMap.CommonUpload}"><submit/></field>
     </form>
-    
+
     <form name="UploadContent" type="upload" target="uploadAttachFiletoEmail">
         <field name="dataCategoryId"><hidden value="PERSONAL"/></field>
         <field name="contentTypeId"><hidden value="DOCUMENT"/></field>
@@ -1047,7 +1047,7 @@ 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>
@@ -1097,13 +1097,13 @@ under the License.
             </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"><lookup 
target-form-name="LookupReturnHeader"/></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">
@@ -1126,4 +1126,58 @@ under the License.
         </field>
         <field name="deleteButton" title="${uiLabelMap.CommonDelete}" 
widget-style="smallSubmit"><submit/></field>
     </form>
+
+    <form name="DisplayConversationThread" type="single" 
default-map-name="commEvent">
+        <field name="subject"><display/></field>
+        <field name="entryDate" title="${uiLabelMap.CommonDate}" 
position="2"><display type="date"/></field>
+        <field name="partyIdFrom" 
title="${uiLabelMap.CommonFrom}"><display-entity entity-name="PartyNameView" 
key-field-name="partyId" description="[${partyId}] ${firstName} ${lastName} 
${groupName}"/></field>
+        <field name="partyIdTo" title="${uiLabelMap.CommonTo}" 
position="2"><display-entity entity-name="PartyNameView" 
key-field-name="partyId" description="[${partyId}] ${firstName} ${lastName} 
${groupName} ${userLoginIdTo}"/></field>
+        <field name="fromString" 
title="${uiLabelMap.CommonMailFrom}"><display/></field>
+        <field name="toString" title="${uiLabelMap.CommonMailTo}" 
position="2"><display/></field>
+        <field name="createNewConversationAnswer" title=" " 
widget-area-style="h2" position="5">
+            <hyperlink target="CreateNewOrderMessage" 
link-type="layered-modal" 
description="${uiLabelMap.PartyNewConversationAnswer}" >
+                <parameter param-name="orderId"/>
+                <parameter param-name="parentCommEventId"/>
+                <parameter param-name="communicationEventPrpTypId"/>
+            </hyperlink>
+        </field>
+    </form>
+    <form name="DisplayConversationMessage" type="single" 
default-map-name="childCommEvent" default-widget-style="">
+        <actions>
+            <script 
location="component://party/groovyScripts/communication/GetPartyEmailAttachment.groovy"/>
+            <set field="hasAttachedContent" value="${groovy: 
context.attachedContentName != null}" default-value="false" type="Boolean"/>
+        </actions>
+        <field name="entryDate" title="${uiLabelMap.CommonDate}"><display 
type="date"/></field>
+        <field name="attachedContentName" title="${groovy: hasAttachedContent 
? uiLabelMap.CommonEmailAttachedDocuments:''}" use-when="hasAttachedContent" 
map-name="context"><display/></field>
+    </form>
+
+    <form name="createNewMessage" type="single" 
target="createConversationMessage" title="">
+        <actions>
+            <set field="answer" 
from-field="parameters.parentCommEventId!=null" type="Boolean"/>
+            <entity-condition entity-name="CommunicationEventPurpose" 
list="purposes">
+                <condition-expr field-name="communicationEventId" 
from-field="parameters.parentCommEventId"/>
+            </entity-condition>
+            <entity-one entity-name="CommunicationEvent" 
value-field="parentCommEvent">
+                <field-map field-name="communicationEventId" 
from-field="parameters.parentCommEventId"/>
+            </entity-one>
+        </actions>
+        <field name="communicationEventTypeId"><hidden 
value="WEB_SITE_COMMUNICATI"/></field>
+        <field name="statusId"><hidden value="COM_ENTERED"/></field>
+        <field name="communicationEventPrpTypId"  use-when="!answer">
+            <drop-down current-description="">
+                <entity-options key-field-name="communicationEventPrpTypId" 
entity-name="CommunicationEventPrpTyp">
+                    <entity-order-by field-name="description"/>
+                </entity-options>
+            </drop-down>
+        </field>
+        <field name="communicationEventPrpTypId" use-when="answer"><hidden 
value="${purposes[0].communicationEventPrpTypId}"/></field>
+        <field name="partyIdFrom"><hidden 
value="${userLogin.partyId}"/></field>
+        <field name="partyIdTo" title="${uiLabelMap.PartyPartyTo}"><lookup 
target-form-name="LookupPartyName"/></field>
+        <field name="parentCommEventId"><hidden/></field>
+        <field name="subject" use-when="!answer"><text/></field>
+        <field name="subject" use-when="answer"><hidden/></field>
+        <field name="content" title="${uiLabelMap.CommonMessage}"><textarea 
default-value="" rows="25"/></field>
+        <field name="submit" title="${uiLabelMap.CommonSend}"><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=1867581&r1=1867580&r2=1867581&view=diff
==============================================================================
--- 
ofbiz/ofbiz-framework/trunk/applications/party/widget/partymgr/CommunicationEventScreens.xml
 (original)
+++ 
ofbiz/ofbiz-framework/trunk/applications/party/widget/partymgr/CommunicationEventScreens.xml
 Thu Sep 26 15:11:52 2019
@@ -1236,4 +1236,46 @@ under the License.
             </widgets>
            </section>
     </screen>
+    <screen name="ConversationThread">
+        <section>
+            <actions>
+                <entity-one entity-name="CommunicationEvent" 
value-field="commEvent"/>
+                <entity-one entity-name="CommunicationEventType" 
value-field="commEventType">
+                    <field-map field-name="communicationEventTypeId" 
from-field="commEvent.communicationEventTypeId"/>
+                </entity-one>
+                <set field="parentCommEventId" 
from-field="commEvent.communicationEventId"/>
+                <entity-condition entity-name="CommunicationEvent" 
list="childrenCommEvents">
+                    <condition-expr field-name="parentCommEventId" 
from-field="parentCommEventId"/>
+                    <order-by field-name="entryDate"/>
+                </entity-condition>
+                <set field="childrenCommEvents[+0]" from-field="commEvent"/>
+                <entity-condition entity-name="UserLogin" list="userlogins">
+                    <condition-expr field-name="partyId" 
from-field="commEvent.partyIdTo"/>
+                </entity-condition>
+                <set field="userLogin" from-field="userlogins[0]"/>
+                <set field="userLoginIdTo" value="${groovy: if (userLogin) 
return userLogin.userLoginId else return ''}"/>
+            </actions>
+            <widgets>
+                <screenlet name="conversationThread" 
id="${commEvent.communicationEventId}" 
+                    title="${groovy:commEventType.get('description', locale)} 
${date:localizedDateStr(commEvent.entryDate, timeZone, locale)} 
(${groovy:childrenCommEvents.size()}), ${commEvent.subject}" 
+                    initially-collapsed="true">
+                    <include-form name="DisplayConversationThread" 
location="component://party/widget/partymgr/CommunicationEventForms.xml"/>
+                    <iterate-section entry="childCommEvent" 
list="childrenCommEvents" paginate="false">
+                        <section>
+                            <actions>
+                                <set field="classFrom" value="${groovy: 
commEvent.partyIdFrom == childCommEvent.partyIdFrom? 
'commEventFrom':'commEventTo'}"/>
+                            </actions>
+                            <widgets>
+                                <include-form 
name="DisplayConversationMessage" 
location="component://party/widget/partymgr/CommunicationEventForms.xml"/>
+                                <platform-specific>
+                                    <html><html-template 
location="component://party/template/party/DisplayCommunicationContent.ftl"/></html>
+                                </platform-specific>
+                                <horizontal-separator/>
+                            </widgets>
+                        </section>
+                    </iterate-section>
+                </screenlet>
+            </widgets>
+        </section>
+    </screen>
 </screens>

Modified: ofbiz/ofbiz-framework/trunk/framework/common/config/CommonUiLabels.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/config/CommonUiLabels.xml?rev=1867581&r1=1867580&r2=1867581&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/config/CommonUiLabels.xml 
(original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/config/CommonUiLabels.xml Thu 
Sep 26 15:11:52 2019
@@ -6464,6 +6464,14 @@
         <value xml:lang="zh">低</value>
         <value xml:lang="zh-TW">低</value>
     </property>
+    <property key="CommonMailTo">
+        <value xml:lang="en">Mail To</value>
+        <value xml:lang="fr">Courriel pour</value>
+    </property>
+    <property key="CommonMailFrom">
+        <value xml:lang="en">Mail From</value>
+        <value xml:lang="fr">Courriel venant de</value>
+    </property>
     <property key="CommonMain">
         <value xml:lang="ar">الرئيسية</value>
         <value xml:lang="cs">Úvodní stránka</value>


Reply via email to