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/10/21 10:02:54 UTC

svn commit: r827914 - in /ofbiz/trunk: applications/party/src/org/ofbiz/party/communication/ applications/party/src/org/ofbiz/party/contact/ applications/workeffort/ applications/workeffort/entitydef/ applications/workeffort/script/org/ofbiz/workeffort...

Author: hansbak
Date: Wed Oct 21 08:02:53 2009
New Revision: 827914

URL: http://svn.apache.org/viewvc?rev=827914&view=rev
Log:
added the mailinglist function to a project. Initially to show the svn updates to the project. Also added from/to date to the WorkeffortContactmechId, including upgrade service. Also extended the storeEmail service to receive emails for a workeffort

Added:
    ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/UpgradeServices.xml   (with props)
    ofbiz/trunk/applications/workeffort/servicedef/services_upgrade.xml   (with props)
Modified:
    ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java
    ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java
    ofbiz/trunk/applications/workeffort/entitydef/entitymodel.xml
    ofbiz/trunk/applications/workeffort/entitydef/entitymodel_old.xml
    ofbiz/trunk/applications/workeffort/ofbiz-component.xml
    ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml
    ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.xml
    ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml
    ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml
    ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml
    ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml
    ofbiz/trunk/specialpurpose/projectmgr/widget/ProjectScreens.xml
    ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml

Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java?rev=827914&r1=827913&r2=827914&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java (original)
+++ ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java Wed Oct 21 08:02:53 2009
@@ -864,6 +864,16 @@
             createCommEventRoles(userLogin, delegator, dispatcher, communicationEventId, toParties, "ADDRESSEE");
             createCommEventRoles(userLogin, delegator, dispatcher, communicationEventId, ccParties, "CC");
             createCommEventRoles(userLogin, delegator, dispatcher, communicationEventId, bccParties, "BCC");
+            
+            // get the related work effort info
+            List<Map<String, Object>> toWorkEffortInfos = buildListOfWorkEffortInfoFromEmailAddresses(addressesTo, userLogin, dispatcher);
+            List<Map<String, Object>> ccWorkEffortInfos = buildListOfWorkEffortInfoFromEmailAddresses(addressesCC, userLogin, dispatcher);
+            List<Map<String, Object>> bccWorkEffortInfos = buildListOfWorkEffortInfoFromEmailAddresses(addressesBCC, userLogin, dispatcher);
+            
+            // For all WorkEffort addresses create a CommunicationEventWorkEffs
+            createCommunicationEventWorkEffs(userLogin, dispatcher, toWorkEffortInfos, communicationEventId);
+            createCommunicationEventWorkEffs(userLogin, dispatcher, ccWorkEffortInfos, communicationEventId);
+            createCommunicationEventWorkEffs(userLogin, dispatcher, bccWorkEffortInfos, communicationEventId);
 
             Map<String, Object> results = ServiceUtil.returnSuccess();
             results.put("communicationEventId", communicationEventId);
@@ -993,6 +1003,22 @@
             Debug.logError(e, module);
         }
     }
+    
+    private static void createCommunicationEventWorkEffs(GenericValue userLogin, LocalDispatcher dispatcher, List<Map<String, Object>> workEffortInfos, String communicationEventId) {
+        // create relationship between communication event and work efforts
+        try {
+            Iterator<Map<String, Object>> it = workEffortInfos.iterator();
+            while (it.hasNext()) {
+                Map<String, Object> result = it.next();
+                String workEffortId = (String) result.get("workEffortId");
+                dispatcher.runSync("createCommunicationEventWorkEff", UtilMisc.toMap("workEffortId", workEffortId, "communicationEventId", communicationEventId, "userLogin", userLogin));
+            }
+        } catch (GenericServiceException e) {
+            Debug.logError(e, module);
+        } catch (Exception e) {
+            Debug.logError(e, module);
+        }
+    }
 
     /*
      * Helper method to retrieve the party information from the first email address of the Address[] specified.
@@ -1048,6 +1074,42 @@
         }
         return tempResults;
     }
+    
+    /*
+     * Gets WorkEffort info from e-mail address and returns a List of the results for the array of addresses
+     */
+    private static List<Map<String, Object>> buildListOfWorkEffortInfoFromEmailAddresses(Address [] addresses, GenericValue userLogin, LocalDispatcher dispatcher) throws GenericServiceException {
+        InternetAddress emailAddress = null;
+        Map<String, Object> result = null;
+        List<Map<String, Object>> tempResults = FastList.newInstance();
+        String caseInsensitiveEmail = org.ofbiz.base.util.UtilProperties.getPropertyValue("general.properties", "mail.address.caseInsensitive", "N");
+
+        if (addresses != null) {
+            for (Address addr: addresses) {
+                if (addr instanceof InternetAddress) {
+                    emailAddress = (InternetAddress)addr;
+
+                    if (!UtilValidate.isEmpty(emailAddress)) {
+                        Map<String, String> inputFields = FastMap.newInstance();
+                        inputFields.put("infoString", emailAddress.getAddress());
+                        inputFields.put("infoString_ic", caseInsensitiveEmail);
+                        result = dispatcher.runSync("performFind", UtilMisc.<String, Object>toMap("entityName", "WorkEffortContactMechView"
+                                ,"inputFields", inputFields, "userLogin", userLogin));
+                        EntityListIterator listIt = (EntityListIterator) result.get("listIt");
+                        
+                        try {
+                        	List<GenericValue> list = listIt.getCompleteList();
+                            List<GenericValue> filteredList = EntityUtil.filterByDate(list);
+                            tempResults.addAll(filteredList);
+                        } catch (GenericEntityException e) {
+                            Debug.logError(e, module);
+                        }
+                    }
+                }
+            }
+        }
+        return tempResults;
+    }
 
     /*
      * Service to process incoming email and look for a bounce message. If the email is indeed a bounce message

Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java?rev=827914&r1=827913&r2=827914&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java (original)
+++ ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java Wed Oct 21 08:02:53 2009
@@ -255,7 +255,8 @@
         List<GenericValue> allWorkEffortContactMechs = null;
 
         try {
-            allWorkEffortContactMechs = delegator.findByAnd("WorkEffortContactMech", UtilMisc.toMap("workEffortId", workEffortId));
+            List<GenericValue> workEffortContactMechs = delegator.findByAnd("WorkEffortContactMech", UtilMisc.toMap("workEffortId", workEffortId));
+            allWorkEffortContactMechs = EntityUtil.filterByDate(workEffortContactMechs);
         } catch (GenericEntityException e) {
             Debug.logWarning(e, module);
         }

Modified: ofbiz/trunk/applications/workeffort/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/entitydef/entitymodel.xml?rev=827914&r1=827913&r2=827914&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/workeffort/entitydef/entitymodel.xml Wed Oct 21 08:02:53 2009
@@ -403,14 +403,17 @@
         <key-map field-name="invoiceItemSeqId"/>
       </relation>
     </entity>
-    <entity entity-name="WorkEffortContactMech"
+    <entity entity-name="WorkEffortContactMech" table-name="WORK_EFFORT_CONTACT_MECH_NEW"
             package-name="org.ofbiz.workeffort.workeffort"
             title="WorkEffort Contact Mechanism Entity">
       <field name="workEffortId" type="id-ne"></field>
       <field name="contactMechId" type="id-ne"></field>
+      <field name="fromDate" type="date-time"></field>
+      <field name="thruDate" type="date-time"></field>
       <field name="comments" type="comment"></field>
       <prim-key field="workEffortId"/>
       <prim-key field="contactMechId"/>
+      <prim-key field="fromDate"/>
       <relation type="one" fk-name="WKEFF_CMECH_WKEFF" rel-entity-name="WorkEffort">
         <key-map field-name="workEffortId"/>
       </relation>

Modified: ofbiz/trunk/applications/workeffort/entitydef/entitymodel_old.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/entitydef/entitymodel_old.xml?rev=827914&r1=827913&r2=827914&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/entitydef/entitymodel_old.xml (original)
+++ ofbiz/trunk/applications/workeffort/entitydef/entitymodel_old.xml Wed Oct 21 08:02:53 2009
@@ -49,5 +49,23 @@
       <key-map field-name="partyId"/>
     </relation>
   </entity>
+  <entity entity-name="OldWorkEffortContactMech" table-name="WORK_EFFORT_CONTACT_MECH"
+          package-name="org.ofbiz.workeffort.workeffort"
+          title="Old WorkEffort Contact Mechanism Entity, now depreciated and replaced by the WorkEffortContactMech entity">
+    <field name="workEffortId" type="id-ne"></field>
+    <field name="contactMechId" type="id-ne"></field>
+    <field name="comments" type="comment"></field>
+    <prim-key field="workEffortId"/>
+    <prim-key field="contactMechId"/>
+    <relation type="one" fk-name="OLWKEF_CMECH_WKEFF" rel-entity-name="WorkEffort">
+      <key-map field-name="workEffortId"/>
+    </relation>
+    <relation type="one" fk-name="OLWKEF_CMECH_CMECH" rel-entity-name="ContactMech">
+      <key-map field-name="contactMechId"/>
+    </relation>
+    <relation type="one-nofk" rel-entity-name="TelecomNumber">
+      <key-map field-name="contactMechId"/>
+    </relation>
+  </entity>
 
 </entitymodel>

Modified: ofbiz/trunk/applications/workeffort/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/ofbiz-component.xml?rev=827914&r1=827913&r2=827914&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/ofbiz-component.xml (original)
+++ ofbiz/trunk/applications/workeffort/ofbiz-component.xml Wed Oct 21 08:02:53 2009
@@ -34,6 +34,7 @@
     <entity-resource type="data" reader-name="seed" loader="main" location="data/WorkEffortSecurityData.xml"/>
     <service-resource type="model" loader="main" location="servicedef/services.xml"/>
     <service-resource type="model" loader="main" location="servicedef/services_timesheet.xml"/>
+    <service-resource type="model" loader="main" location="servicedef/services_upgrade.xml"/>
     <service-resource type="eca" loader="main" location="servicedef/secas.xml"/>
     <service-resource type="group" loader="main" location="servicedef/service_groups.xml"/>
 

Added: ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/UpgradeServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/UpgradeServices.xml?rev=827914&view=auto
==============================================================================
--- ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/UpgradeServices.xml (added)
+++ ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/UpgradeServices.xml Wed Oct 21 08:02:53 2009
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+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.
+-->
+
+<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="migrateWorkEffortContactMech" short-description="Migrate data from OldWorkEffortContactMech to WorkEffortContactMech">
+        <entity-condition entity-name="OldWorkEffortContactMech" list="oldWorkEffortContactMechs"/>
+        <now-timestamp field="fromDate"/>
+        <iterate list="oldWorkEffortContactMechs" entry="oldWorkEffortContactMech">
+            <make-value entity-name="WorkEffortContactMech" value-field="workEffortContactMech"/>
+            <set field="workEffortContactMech.workEffortId" from-field="oldWorkEffortContactMech.workEffortId"/>
+            <set field="workEffortContactMech.contactMechId" from-field="oldWorkEffortContactMech.contactMechId"/>
+            <set field="workEffortContactMech.fromDate" from-field="fromDate"/>
+            <create-value value-field="workEffortContactMech"/>
+        </iterate>
+    </simple-method>
+</simple-methods>
\ No newline at end of file

Propchange: ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/UpgradeServices.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/UpgradeServices.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/UpgradeServices.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml?rev=827914&r1=827913&r2=827914&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml (original)
+++ ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml Wed Oct 21 08:02:53 2009
@@ -343,6 +343,7 @@
         <set-nonpk-fields map="parameters" value-field="newValue"/>
         <field-to-result field="newValue.contactMechId" result-name="contactMechId"/>
         <field-to-request field="newValue.contactMechId" request-name="contactMechId"/>
+        <now-timestamp field="newValue.fromDate"/>
         <create-value value-field="newValue"/>
     </simple-method>
 
@@ -375,8 +376,10 @@
 
         <if-compare-field to-field="newWorkEffortContactMech.contactMechId" field="parameters.contactMechId" operator="not-equals">
             <set-nonpk-fields value-field="newWorkEffortContactMech" map="parameters" set-if-null="false"/>
+            <now-timestamp field="newWorkEffortContactMech.fromDate"/>
+            <now-timestamp field="workEffortContactMech.thruDate"/>
             <create-value value-field="newWorkEffortContactMech"/>
-            <remove-value value-field="workEffortContactMech"/>
+            <store-value value-field="workEffortContactMech"/>
         </if-compare-field>
 
         <field-to-result field="newWorkEffortContactMech.contactMechId" result-name="contactMechId"/>

Added: ofbiz/trunk/applications/workeffort/servicedef/services_upgrade.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/servicedef/services_upgrade.xml?rev=827914&view=auto
==============================================================================
--- ofbiz/trunk/applications/workeffort/servicedef/services_upgrade.xml (added)
+++ ofbiz/trunk/applications/workeffort/servicedef/services_upgrade.xml Wed Oct 21 08:02:53 2009
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+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.
+-->
+
+<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
+    <description>Order Services</description>
+    <vendor>OFBiz</vendor>
+    
+    <service name="migrateWorkEffortContactMech" engine="simple"
+            location="component://workeffort/script/org/ofbiz/workeffort/workeffort/UpgradeServices.xml" invoke="migrateWorkEffortContactMech">
+        <description>
+            Migrate data from OldWorkEffortContactMech to WorkEffortContactMech.
+            Since revision 827903 (2009-10-21) the entity OldWorkEffortContactMech has been deprecated.
+            This service can be used to upgrade existing data from the OldWorkEffortContactMech entity to the new
+            WorkEffortContactMech entity.
+        </description>
+    </service>
+</services>
\ No newline at end of file

Propchange: ofbiz/trunk/applications/workeffort/servicedef/services_upgrade.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/workeffort/servicedef/services_upgrade.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/applications/workeffort/servicedef/services_upgrade.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.xml?rev=827914&r1=827913&r2=827914&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.xml Wed Oct 21 08:02:53 2009
@@ -129,6 +129,10 @@
         <value xml:lang="it">Template</value>
         <value xml:lang="zh">模板Id</value>
     </property>
+    <property key="FormFieldTitle_mailingListEmail">
+        <value xml:lang="en">Mailing List E-mail</value>
+        <value xml:lang="th">E-mail สำหรับ Mailing List</value>
+    </property>
     <property key="PageTitleAddATimesheet">
         <value xml:lang="en">Add a new weekly Timesheet</value>
         <value xml:lang="fr">Ajouter une nouvelle feuille d'activité hebdomadaire</value>
@@ -334,6 +338,10 @@
         <value xml:lang="th">ค้นหาขั้นตอนการทำงาน</value>
         <value xml:lang="zh">查找项目阶段</value>
     </property>
+    <property key="PageTitleFindMailingList">
+        <value xml:lang="en">Find Mailing List</value>
+        <value xml:lang="th">ค้นหาจดหมาย</value>
+    </property>
     <property key="PageTitleFindProject">
         <value xml:lang="en">Find Project</value>
         <value xml:lang="fr">Recherche de projet(s)</value>
@@ -528,6 +536,10 @@
         <value xml:lang="th">ไม่กำหนดงาน</value>
         <value xml:lang="zh">未分配任务</value>
     </property>
+    <property key="PageTitleViewMailingList">
+        <value xml:lang="en">View Mailing List</value>
+        <value xml:lang="th">แสดงจดหมาย</value>
+    </property>
     <property key="ProjectMgrCustomerRequestList">
         <value xml:lang="en">Project Customer Request list</value>
     </property>
@@ -797,6 +809,10 @@
         <value xml:lang="it">Lista Ordini</value>
         <value xml:lang="zh">订单列表</value>
     </property>
+    <property key="ProjectMgrListMailingList">
+        <value xml:lang="en">List Mailing List</value>
+        <value xml:lang="th">รายการจดหมาย</value>
+    </property>
     <property key="ProjectMgrMon">
         <value xml:lang="en">Mon</value>
         <value xml:lang="fr">lun</value>
@@ -942,6 +958,10 @@
         <value xml:lang="th">รายการของขั้นตอนการทำงานและงาน</value>
         <value xml:lang="zh">项目阶段和任务列表</value>
     </property>
+    <property key="ProjectMgrMailingList">
+        <value xml:lang="en">Mailing List</value>
+        <value xml:lang="th">จดหมาย</value>
+    </property>
     <property key="ProjectMgrPhases">
         <value xml:lang="en">Phases</value>
         <value xml:lang="fr">Phases</value>

Modified: ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml?rev=827914&r1=827913&r2=827914&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml Wed Oct 21 08:02:53 2009
@@ -41,6 +41,24 @@
             <set field="updProjectRole.roleTypeId" value="CLIENT_BILLING"/>
             <call-simple-method method-name="updProjectRole"/>
         </if-not-empty>
+        <if-not-empty field="parameters.emailAddress">
+            <if-validate-method field="parameters.emailAddress" method="isEmail">
+                <else><add-error><fail-property resource="PartyUiLabels" property="PartyEmailAddressNotFormattedCorrectly"/></add-error></else>
+            </if-validate-method>
+            <check-errors/>
+            
+            <!-- create new work effort's e-mail address -->
+            <set field="emailAddressIn.emailAddress" from-field="parameters.emailAddress"/>
+            <set field="emailAddressIn.contactMechTypeId" value="EMAIL_ADDRESS"/>
+            <call-service service-name="createEmailAddress" in-map-name="emailAddressIn">
+                <result-to-field result-name="contactMechId"/>
+            </call-service>
+            <set field="workEffortContactMechIn.workEffortId" from-field="parameters.workEffortId"/>
+            <set field="workEffortContactMechIn.contactMechId" from-field="contactMechId"/>
+            <set field="workEffortContactMechIn.contactMechTypeId" value="EMAIL_ADDRESS"/>
+            <set field="workEffortContactMechIn.infoString" from-field="parameters.emailAddress"/>
+            <call-service service-name="createWorkEffortContactMech" in-map-name="workEffortContactMechIn"/>
+        </if-not-empty>
     </simple-method>
 
     <simple-method method-name="updateProject" short-description="Update a project">
@@ -56,6 +74,51 @@
             <set field="updProjectRole.roleTypeId" value="CLIENT_BILLING"/>
             <call-simple-method method-name="updProjectRole"/>
         </if-not-empty>
+        <if-not-empty field="parameters.emailAddress">
+            <if-validate-method field="parameters.emailAddress" method="isEmail">
+                <else><add-error><fail-property resource="PartyUiLabels" property="PartyEmailAddressNotFormattedCorrectly"/></add-error></else>
+            </if-validate-method>
+            <check-errors/>
+            
+            <!-- find exist e-mail address. if have not exist then create new-->
+            <entity-condition list="existEmailAddresses" entity-name="WorkEffortContactMechView">
+                <condition-list combine="and">
+                    <condition-expr field-name="workEffortId" from-field="parameters.workEffortId"/>
+                    <condition-expr field-name="contactMechTypeId" value="EMAIL_ADDRESS"/>
+                    <condition-expr field-name="infoString" from-field="parameters.emailAddress" ignore-case="true"/>
+                </condition-list>
+            </entity-condition>
+            <filter-list-by-date list="existEmailAddresses"/>
+            <if-empty field="existEmailAddresses">
+                <!-- expire old work effort's e-mail address -->
+                <entity-and list="oldEmailAddresses" entity-name="WorkEffortContactMechView">
+                    <field-map field-name="workEffortId" from-field="parameters.workEffortId"/>
+                    <field-map field-name="contactMechTypeId" value="EMAIL_ADDRESS"/>
+                </entity-and>
+                <filter-list-by-date list="oldEmailAddresses"/>
+                <iterate entry="oldEmailAddress" list="oldEmailAddresses">
+                    <entity-and list="oldWorkEffortContactMechs" entity-name="WorkEffortContactMech">
+                        <field-map field-name="workEffortId" from-field="oldEmailAddress.workEffortId"/>
+                        <field-map field-name="contactMechId" from-field="oldEmailAddress.contactMechId"/>
+                    </entity-and>
+                    <first-from-list entry="oldWorkEffortContactMech" list="oldWorkEffortContactMechs"/>
+                    <now-timestamp field="oldWorkEffortContactMech.thruDate"/>
+                    <store-value value-field="oldWorkEffortContactMech"/>
+                </iterate>
+                
+                <!-- create new work effort's e-mail address -->
+                <set field="emailAddressIn.emailAddress" from-field="parameters.emailAddress"/>
+                <set field="emailAddressIn.contactMechTypeId" value="EMAIL_ADDRESS"/>
+                <call-service service-name="createEmailAddress" in-map-name="emailAddressIn">
+                    <result-to-field result-name="contactMechId"/>
+                </call-service>
+                <set field="workEffortContactMechIn.workEffortId" from-field="parameters.workEffortId"/>
+                <set field="workEffortContactMechIn.contactMechId" from-field="contactMechId"/>
+                <set field="workEffortContactMechIn.contactMechTypeId" value="EMAIL_ADDRESS"/>
+                <set field="workEffortContactMechIn.infoString" from-field="parameters.emailAddress"/>
+                <call-service service-name="createWorkEffortContactMech" in-map-name="workEffortContactMechIn"/>
+            </if-empty>
+        </if-not-empty>
     </simple-method>
 
     <simple-method method-name="updProjectRole"
@@ -626,6 +689,17 @@
                 </if-not-empty>
             </iterate>
         </if-not-empty>
+        
+        <!-- get e-mail address -->
+        <entity-and list="emailAddresses" entity-name="WorkEffortContactMechView">
+            <field-map field-name="workEffortId" from-field="highInfo.projectId"/>
+            <field-map field-name="contactMechTypeId" value="EMAIL_ADDRESS"/>
+        </entity-and>
+        <filter-list-by-date list="emailAddresses"/>
+        <if-not-empty field="emailAddresses">
+            <first-from-list entry="emailAddress" list="emailAddresses"/>
+            <set field="highInfo.emailAddress" from-field="emailAddress.infoString"/>
+        </if-not-empty>
 
         <!-- translate squenceId back into statusId -->
         <entity-and entity-name="StatusItem" list="statusses">

Modified: ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml?rev=827914&r1=827913&r2=827914&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml Wed Oct 21 08:02:53 2009
@@ -105,6 +105,7 @@
         <attribute name="communicationEventId" type="String" mode="IN" optional="true"/>
         <attribute name="organizationPartyId" type="String" mode="IN" optional="true"/>
         <attribute name="clientBillingPartyId" type="String" mode="IN" optional="true"/>
+        <attribute name="emailAddress" type="String" mode="IN" optional="true"/>
         <override name="workEffortTypeId" optional="false"/>
         <override name="workEffortName" optional="false"/>
         <override name="currentStatusId" optional="false"/>
@@ -118,6 +119,7 @@
         <auto-attributes mode="IN" include="pk" optional="false"/>
         <attribute name="organizationPartyId" type="String" mode="IN" optional="true"/>
         <attribute name="clientBillingPartyId" type="String" mode="IN" optional="true"/>
+        <attribute name="emailAddress" type="String" mode="IN" optional="true"/>
     </service>
 
     <service name="createProjectTask" engine="simple" default-entity-name="WorkEffort"

Modified: ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml?rev=827914&r1=827913&r2=827914&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml Wed Oct 21 08:02:53 2009
@@ -306,6 +306,14 @@
         <response name="success" type="view" value="FindPhase"/>
         <response name="error" type="view" value="FindPhase"/>
     </request-map>
+    <request-map uri="FindMailingList">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="FindMailingList"/>
+    </request-map>
+    <request-map uri="ViewMailingList">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="ViewMailingList"/>
+    </request-map>
     <request-map uri="EditTaskSkills">
         <security https="true" auth="true"/>
         <response name="success" type="view" value="EditTaskSkills"/>
@@ -716,6 +724,8 @@
     <view-map name="EditTaskPartyAssigns" type="screen" page="component://projectmgr/widget/TaskScreens.xml#EditTaskPartyAssigns"/>
     <view-map name="ListWorkEffortPartyAssigns" type="screen" page="component://projectmgr/widget/ProjectScreens.xml#EditProjectParties"/>
     <view-map name="FindPhase" type="screen" page="component://projectmgr/widget/ProjectScreens.xml#FindPhase"/>
+    <view-map name="FindMailingList" type="screen" page="component://projectmgr/widget/ProjectScreens.xml#FindMailingList"/>
+    <view-map name="ViewMailingList" type="screen" page="component://projectmgr/widget/ProjectScreens.xml#ViewMailingList"/>
     <view-map name="EditTaskSkills" type="screen" page="component://projectmgr/widget/TaskScreens.xml#EditTaskSkills"/>
     <view-map name="projectView" type="screen" page="component://projectmgr/widget/ProjectScreens.xml#ProjectView"/>
     <view-map name="EditPartySkills" type="screen" page="component://projectmgr/widget/ProjectScreens.xml#EditPartySkills"/>

Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml?rev=827914&r1=827913&r2=827914&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml Wed Oct 21 08:02:53 2009
@@ -100,6 +100,14 @@
                 <parameter param-name="projectId"/>
             </link>
         </menu-item>
+        <menu-item name="mailing" title="${uiLabelMap.ProjectMgrMailingList}">
+            <condition>
+                <if-compare field="hasViewPermission" operator="equals" value="true"/>
+            </condition>
+            <link target="FindMailingList">
+                <parameter param-name="projectId"/>
+            </link>
+        </menu-item>
         <menu-item name="phases" title="${uiLabelMap.ProjectMgrPhases}">
             <condition>
                 <and>

Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/ProjectScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/ProjectScreens.xml?rev=827914&r1=827913&r2=827914&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/widget/ProjectScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/widget/ProjectScreens.xml Wed Oct 21 08:02:53 2009
@@ -1109,5 +1109,66 @@
             </widgets>
         </section>
     </screen>
+    
+    <screen name="FindMailingList">
+        <section>
+            <actions>
+                <set field="titleProperty" value="PageTitleFindMailingList"/>
+                <set field="tabButtonItem" value="mailing"/>
+                <set field="labelTitleProperty" value="ProjectMgrListMailingList"/>
+                <set field="parameters.workEffortId" from-field="parameters.projectId"/>
+                <set field="initially-collapsed" value="true" global="true"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonProjectDecorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <section>
+                            <condition>
+                                <or>
+                                    <if-has-permission permission="PROJECTMGR_ADMIN"/>
+                                    <if-has-permission permission="PROJECTMGR_VIEW"/>
+                                </or>
+                            </condition>
+                            <widgets>
+                                <screenlet id="searchOptions" name="findScreenlet" collapsible="true" title="${uiLabelMap.CommonSearchOptions}" initially-collapsed="true">
+                                    <include-form location="component://projectmgr/widget/forms/ProjectForms.xml" name="FindMailingList"/>
+                                </screenlet>
+                                <screenlet padded="false" title="${uiLabelMap.CommonSearchResults}">
+                                    <include-form location="component://projectmgr/widget/forms/ProjectForms.xml" name="ListMailingLists"/>
+                                </screenlet>
+                            </widgets>
+                        </section>                                
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+    <screen name="ViewMailingList">
+        <section>
+            <actions>
+                <set field="titleProperty" value="PageTitleViewMailingList"/>
+                <set field="tabButtonItem" value="mailing"/>
+                <entity-one entity-name="CommunicationEvent" value-field="communicationEvent"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonProjectDecorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <label  style="h1" text="${uiLabelMap[titleProperty]}"/>
+                        <section>
+                            <condition>
+                                <or>
+                                    <if-has-permission permission="PROJECTMGR_ADMIN"/>
+                                    <if-has-permission permission="PROJECTMGR_VIEW"/>
+                                </or>
+                            </condition>
+                            <widgets>
+                                <include-screen location="component://party/widget/partymgr/CommunicationEventScreens.xml" name="commOverview"/>
+                            </widgets>
+                        </section>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
 
 </screens>

Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml?rev=827914&r1=827913&r2=827914&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml Wed Oct 21 08:02:53 2009
@@ -84,6 +84,7 @@
         <field use-when="projectId!=null" name="estimatedCompletionDate" title="${uiLabelMap.FormFieldTitle_estimatedCompletionDate}"><display type="date"/></field>
         <field use-when="projectId!=null" name="actualStartDate" title="${uiLabelMap.FormFieldTitle_actualStartDate}"><display type="date"/></field>
         <field use-when="projectId!=null" name="actualCompletionDate" title="${uiLabelMap.FormFieldTitle_actualCompletionDate}"><display type="date"/></field>
+        <field name="emailAddress" title="${uiLabelMap.FormFieldTitle_mailingListEmail}"><text/></field>
         <field name="save" title="${uiLabelMap.CommonSave}"><submit/></field>
     </form>
     <form name="AddSubProject" type="single" target="AddSubProject"
@@ -243,6 +244,7 @@
         <field name="plannedHours"><display/></field>
         <field name="originalActualHours"><display/></field>
         <field name="actualHours"><display/></field>
+        <field name="emailAddress" title="${uiLabelMap.FormFieldTitle_mailingListEmail}"><display/></field>
     </form>
     <form name="ListChildEfforts"  target="updateProjectAndAssoc" title="" list-name="projects" type="list" separate-columns="true" paginate-target="FindProject"
         odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
@@ -927,4 +929,45 @@
         <field name="task"><display description="${workEffortName}"/></field>
     </form>
 
+    <form name="FindMailingList" type="single" target="FindMailingList" extends="findCommEvents" extends-resource="component://party/widget/partymgr/CommunicationEventForms.xml">
+        <field name="projectId"><hidden/></field>
+        <field name="entryDate"><date-find/></field>
+        <field name="partyIdTo"><hidden/></field>
+        <field name="communicationEventTypeId"><hidden/></field>
+        <field name="partyId"><hidden/></field>
+        <field name="parentCommEventId"><hidden/></field>
+        <field name="statusId"><hidden/></field>
+        <sort-order>
+            <sort-field name="communicationEventId"/>
+            <sort-field name="partyIdFrom"/>
+            <sort-field name="subject"/>
+            <sort-field name="entryDate"/>
+            <sort-field name="noConditionFind"/>
+            <sort-field name="submitButton"/>
+        </sort-order>
+    </form>
+    <form name="ListMailingLists" type="list" list-name="listIt" title="Mailing List" paginate-target="FindMailingList"
+            extends="ListCommEvents" extends-resource="component://party/widget/partymgr/CommunicationEventForms.xml">
+        <actions>
+            <set field="parameters.sortField" from-field="parameters.sortField" default-value="-entryDate"/>
+            <service service-name="performFind" result-map="result" result-map-list="listIt">
+                <field-map field-name="inputFields" from-field="parameters"/>
+                <field-map field-name="entityName" value="WorkEffortCommunicationEventView"/>
+                <field-map field-name="orderBy" from-field="parameters.sortField"/>
+                <field-map field-name="viewIndex" from-field="viewIndex"/>
+                <field-map field-name="viewSize" from-field="viewSize"/>
+            </service>
+        </actions>
+        <field name="subject">
+            <hyperlink description="${subject}[${communicationEventId}]" target="ViewMailingList">
+                <parameter param-name="projectId" from-field="parameters.projectId"/>
+                <parameter param-name="communicationEventId"/>
+            </hyperlink>
+        </field>
+        <field name="entryDate"><display type="date-time"/></field>
+        <field name="communicationEventTypeId"><hidden/></field>
+        <field name="partyIdTo"><hidden/></field>
+        <field name="statusId"><hidden/></field>
+        <field name="datetimeStarted"><hidden/></field>
+    </form>
 </forms>
\ No newline at end of file