You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ha...@apache.org on 2009/05/14 07:50:16 UTC

svn commit: r774647 - in /ofbiz/branches/release09.04: ./ applications/party/script/org/ofbiz/party/communication/ applications/party/script/org/ofbiz/party/party/ applications/party/servicedef/ applications/party/webapp/partymgr/communication/ applica...

Author: hansbak
Date: Thu May 14 05:50:16 2009
New Revision: 774647

URL: http://svn.apache.org/viewvc?rev=774647&view=rev
Log:
Applied fix from trunk for revision: 774632 
 forward and reply fixes on commevent

Modified:
    ofbiz/branches/release09.04/   (props changed)
    ofbiz/branches/release09.04/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml
    ofbiz/branches/release09.04/applications/party/script/org/ofbiz/party/party/PartyServices.xml
    ofbiz/branches/release09.04/applications/party/servicedef/services.xml
    ofbiz/branches/release09.04/applications/party/webapp/partymgr/communication/CommForms.xml
    ofbiz/branches/release09.04/applications/party/widget/partymgr/PartyMenus.xml

Propchange: ofbiz/branches/release09.04/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu May 14 05:50:16 2009
@@ -1 +1 @@
-/ofbiz/trunk:765933,766011,766015,766293,766307,766316,766325,766462,766522,766800,767060,767072,767093,767098-767099,767102,767123,767125,767127,767279,767287,767671,767688,767694,767822,767845,768358,768490,768550,768675,768686,768705,768811,768815,768960,769030,769500,770272,770997,771073,772401,772464-772465,773076,773557,773628,773659,773697,774014
+/ofbiz/trunk:765933,766011,766015,766293,766307,766316,766325,766462,766522,766800,767060,767072,767093,767098-767099,767102,767123,767125,767127,767279,767287,767671,767688,767694,767822,767845,768358,768490,768550,768675,768686,768705,768811,768815,768960,769030,769500,770272,770997,771073,772401,772464-772465,773076,773557,773628,773659,773697,774014,774632

Modified: ofbiz/branches/release09.04/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release09.04/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml?rev=774647&r1=774646&r2=774647&view=diff
==============================================================================
--- ofbiz/branches/release09.04/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml (original)
+++ ofbiz/branches/release09.04/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml Thu May 14 05:50:16 2009
@@ -33,8 +33,20 @@
     </simple-method>
 
     <simple-method method-name="createCommunicationEvent" short-description="Create a CommunicationEvent with or w/o permission check">
-        <!-- create basic info for communication event -->
-        <make-value value-field="newEntity" entity-name="CommunicationEvent"/>
+        <!-- check for forward -->
+        <if-not-empty field="parameters.origCommEventId">
+            <entity-one entity-name="CommunicationEvent" value-field="newEntity">
+                <field-map field-name="communicationEventId" from-field="parameters.origCommEventId"/>
+            </entity-one>
+            <clear-field field="newEntity.communicationEventId"/>
+            <clear-field field="newEntity.partyIdFrom"/>
+            <clear-field field="newEntity.partyIdTo"/>
+            <set field="newEntity.subject" value="Forw: ${newEntity.subject}"/>
+            <else><!-- if not create empty one -->
+                <make-value value-field="newEntity" entity-name="CommunicationEvent"/>
+            </else>
+        </if-not-empty>
+        
         <set-nonpk-fields map="parameters" value-field="newEntity"/>
         
         <if-empty field="parameters.communicationEventId">
@@ -44,8 +56,8 @@
             </else>
         </if-empty>
         <field-to-result field="newEntity.communicationEventId" result-name="communicationEventId"/>
-        
-        <!-- check for reply or forward -->
+
+        <!-- check for reply -->
         <if-not-empty field="parameters.parentCommEventId">
             <entity-one entity-name="CommunicationEvent" value-field="parentCommEvent">
                 <field-map field-name="communicationEventId" from-field="parameters.parentCommEventId"/>
@@ -55,32 +67,34 @@
             </entity-one>
             
             <if-compare-field field="parentCommEvent.partyIdFrom" operator="equals" to-field="parameters.partyIdTo">
-                <!-- concider this as a reply -->
                 <set field="newEntity.partyIdTo" from-field="parentCommEvent.partyIdFrom"/>
             </if-compare-field>
+            
+            <set field="newEntity.subject" value="RE: ${parentCommEvent.subject}"/>
 
             <set field="newEntity.content" value="${groovy:
                 def localContent = parentCommEvent.content;
-                if (!localContent || localContent.indexOf(&quot;\n&quot;,0) == -1) return(&quot;&quot;);
+                if (!localContent) return(&quot;&quot;);
 
                 resultLine = &quot;\n\n\n&quot; 
                     + (partyNameView.firstName!=null?partyNameView.firstName:&quot;&quot;) 
                     + &quot; &quot; 
                     + (partyNameView.middleName!=null?partyNameView.middleName+&quot; &quot;:&quot;&quot;) 
                     + &quot; &quot; 
-                    + (partyNameView.lastName!=null?partyNameView.lastName:&quot; &quot;) 
+                    + (partyNameView.lastName!=null?partyNameView.lastName:&quot;&quot;) 
+                    + (partyNameView.groupName!=null?partyNameView.groupName:&quot;&quot;) 
                     + &quot; wrote:&quot;;
-                resultLine += &quot;\n\n\n\n\n -------------------------------------------------------------------- &quot;;
-                resultLine += &quot;\n&gt; &quot; + localContent.substring(0, localContent.indexOf(&quot;\n&quot;,0));
+                resultLine += &quot;\n -------------------------------------------------------------------- &quot;;
+                resultLine += &quot;\n&gt; &quot; + localContent.substring(0, localContent.indexOf(&quot;\n&quot;,0) == -1 ? localContent.length() : localContent.indexOf(&quot;\n&quot;,0));
                 startChar = localContent.indexOf(&quot;\n&quot;,0);
                 while(startChar != -1 &amp;&amp; (startChar = localContent.indexOf(&quot;\n&quot;,startChar) + 1) != 0)
                     resultLine += &quot;\n&gt; &quot; + localContent.substring(startChar, localContent.indexOf(&quot;\n&quot;,startChar)==-1 ? localContent.length() : localContent.indexOf(&quot;\n&quot;,startChar));
                 return(resultLine);
                 }"/>
 
-            <!-- set rolestatus from original email to completed if logged-on userId can be found -->
+            <!-- set rolestatus from original email to completed -->
             <entity-and list="roles" entity-name="CommunicationEventRole">
-                <field-map field-name="communicationEventId" from-field="parentCommEvent.parentCommEventId"/>
+                <field-map field-name="communicationEventId" from-field="parentCommEvent.communicationEventId"/>
                 <field-map field-name="partyId" from-field="parentCommEvent.partyIdTo"/>
             </entity-and>
             <if-not-empty field="roles">
@@ -111,6 +125,16 @@
             </if-not-empty>
         </if-empty>
 
+        <!-- if partyId provided but no contactMechIdTo get emailAddress -->
+        <if-not-empty field="parameters.partyIdTo">
+            <if-empty field="parameters.contactMechIdTo">
+                <set field="getEmail.partyId" from-field="parameters.partyIdTo"/>
+                <call-service service-name="getPartyEmail" in-map-name="getEmail">
+                    <result-to-field result-name="contacMechId" field="newEntity.ContactMechIdTo"/>
+                </call-service>
+            </if-empty>
+        </if-not-empty>
+
         <now-timestamp field="newEntity.entryDate"/>
         <create-value value-field="newEntity"/>
 

Modified: ofbiz/branches/release09.04/applications/party/script/org/ofbiz/party/party/PartyServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release09.04/applications/party/script/org/ofbiz/party/party/PartyServices.xml?rev=774647&r1=774646&r2=774647&view=diff
==============================================================================
--- ofbiz/branches/release09.04/applications/party/script/org/ofbiz/party/party/PartyServices.xml (original)
+++ ofbiz/branches/release09.04/applications/party/script/org/ofbiz/party/party/PartyServices.xml Thu May 14 05:50:16 2009
@@ -658,17 +658,30 @@
     </simple-method>
 
     <simple-method method-name="getPartyEmail" short-description="Get the email of the party">
-        <set field="findMap.partyId" from-field="parameters.partyId"/>
-        <set field="findMap.contactMechTypeId" value="EMAIL_ADDRESS"/>
-        <find-by-and entity-name="PartyAndContactMech" map="findMap" list="emailAddressesAll"/>
-        <if-empty field="emailAddressesAll">
-            <set field="findMap.contactMechTypeId" value="ELECTRONIC_ADDRESS"/>
-            <find-by-and entity-name="PartyAndContactMech" map="findMap" list="emailAddressesAll"/>
+        <!-- first try to find primary email Address when not found get other email -->
+        <entity-and entity-name="PartyContactMechPurpose" list="emailAddresses" filter-by-date="true">
+            <field-map field-name="partyId" from-field="parameters.partyId"/>
+            <field-map field-name="contactMechPurposeTypeId" from-field="PRIMARY_EMAIL"/>
+        </entity-and>
+        <!-- any other email -->
+        <if-empty field="emailAddresses">
+            <entity-and entity-name="PartyAndContactMech" list="emailAddresses" filter-by-date="true">
+                <field-map field-name="partyId" from-field="parameters.partyId"/>
+                <field-map field-name="contactMechTypeId" value="EMAIL_ADDRESS"/>
+            </entity-and>
+        </if-empty> 
+        <!-- any other electronic address -->
+        <if-empty field="emailAddresses">
+            <entity-and entity-name="PartyAndContactMech" list="emailAddresses" filter-by-date="true">
+                <field-map field-name="partyId" from-field="parameters.partyId"/>
+                <field-map field-name="contactMechTypeId" value="ELECTRONIC_ADDRESS"/>
+            </entity-and>
         </if-empty>
-        <now-date-to-env field="fromDate"/>
-        <filter-list-by-date list="emailAddressesAll" from-field-name="fromDate" to-list="emailAddresses"/>
-        <first-from-list entry="emailAddress" list="emailAddresses"/>
-        <field-to-result field="emailAddress.infoString" result-name="emailAddress"/>
+        <if-not-empty field="emailAddresses">
+            <first-from-list entry="emailAddress" list="emailAddresses"/>
+            <field-to-result field="emailAddress.infoString" result-name="emailAddress"/>
+            <field-to-result field="emailAddress.contactMechId" result-name="contactMechId"/>
+        </if-not-empty>
     </simple-method>
 
     <simple-method method-name="getPartyTelephone" short-description="Get the telephone number of the party">

Modified: ofbiz/branches/release09.04/applications/party/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release09.04/applications/party/servicedef/services.xml?rev=774647&r1=774646&r2=774647&view=diff
==============================================================================
--- ofbiz/branches/release09.04/applications/party/servicedef/services.xml (original)
+++ ofbiz/branches/release09.04/applications/party/servicedef/services.xml Thu May 14 05:50:16 2009
@@ -905,6 +905,7 @@
         <description>Get the main party Email address</description>
         <attribute name="partyId" type="String" mode="IN" optional="false"/>
         <attribute name="emailAddress" type="String" mode="OUT" optional="true"/>
+        <attribute name="contactMechId" type="String" mode="OUT" optional="true"/>
     </service>
 
     <service name="getPartyTelephone" engine="simple"

Modified: ofbiz/branches/release09.04/applications/party/webapp/partymgr/communication/CommForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release09.04/applications/party/webapp/partymgr/communication/CommForms.xml?rev=774647&r1=774646&r2=774647&view=diff
==============================================================================
--- ofbiz/branches/release09.04/applications/party/webapp/partymgr/communication/CommForms.xml (original)
+++ ofbiz/branches/release09.04/applications/party/webapp/partymgr/communication/CommForms.xml Thu May 14 05:50:16 2009
@@ -172,6 +172,7 @@
     </form>
     <form name="EditInternalNote" type="single" target="createCommunicationEvent" default-map-name="communicationEvent">
         <actions>
+            <set field="nowDate" value="${bsh:org.ofbiz.base.util.UtilDateTime.nowDateString(&quot;yyyy-MM-dd HH:mm:ss.S&quot;)}" type="String"/>
             <script location="component://party/webapp/partymgr/WEB-INF/actions/communication/recentVisitor.groovy"/>
         </actions>
         <alt-target use-when="communicationEvent!=null" target="updateCommunicationEvent"/>
@@ -179,19 +180,20 @@
         <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="datetimeStarted"><hidden/></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}"/>
             </drop-down>
         </field>
-        <field name="subject"><text size="60" default-value="${parameters.subject}"/></field>
+        <field name="subject"><text size="60"/></field>
         <field name="contentMimeTypeId"><hidden value="text/plain"/></field>
-        <field name="content" title="${uiLabelMap.CommonContent}"><textarea cols="60" rows="10" default-value="${parameters.content}"/></field>
+        <field name="content" title="${uiLabelMap.CommonContent}" encode-output="false"><textarea cols="72" rows="15" default-value="${parameters.content}"/></field>
         <field name="send" title=" " position="1" use-when="communicationEvent!=null">
             <hyperlink also-hidden="true"
                 target-type="plain" description="${uiLabelMap.CommonSend}"
-                target="javascript:(document.EditInternalNote.statusId.value='COM_COMPLETE'),(document.EditInternalNote.submit())"/>
+                target="javascript:(document.EditInternalNote.statusId.value='COM_COMPLETE'),(document.EditInternalNote.datetimeStarted.value='${nowDate}'),(document.EditInternalNote.submit())"/>
         </field>
         <field name="save" title=" " position="2" use-when="communicationEvent!=null">
             <hyperlink also-hidden="true" target-type="plain" description="${uiLabelMap.CommonSave}" target="javascript:(document.EditInternalNote.submit())"/>

Modified: ofbiz/branches/release09.04/applications/party/widget/partymgr/PartyMenus.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release09.04/applications/party/widget/partymgr/PartyMenus.xml?rev=774647&r1=774646&r2=774647&view=diff
==============================================================================
--- ofbiz/branches/release09.04/applications/party/widget/partymgr/PartyMenus.xml (original)
+++ ofbiz/branches/release09.04/applications/party/widget/partymgr/PartyMenus.xml Thu May 14 05:50:16 2009
@@ -392,14 +392,14 @@
             </condition>
             <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="parentCommEventId" from-field="communicationEvent.communicationEventId"/>
+                <parameter param-name="partyIdFrom" from-field="parameters.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}(${partyId})">
+        <menu-item name="forward" title="${uiLabelMap.PartyForward}">
             <condition>
                 <and>
                     <not><if-empty field="communicationEvent"/></not>
@@ -410,8 +410,8 @@
             </condition>
             <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="origCommEventId" from-field="parameters.communicationEventId"/>
+                <parameter param-name="partyIdFrom" from-field="parameters.partyId"/>
                 <parameter param-name="my" value="My"/>
                 <parameter param-name="statusId" value="COM_PENDING"/>
             </link>