svn commit: r706007 - in /ofbiz/trunk/specialpurpose/projectmgr: script/org/ofbiz/project/ProjectPermissionServices.xml script/org/ofbiz/project/ProjectServices.xml servicedef/secas.xml servicedef/services.xml widget/forms/TaskForms.xml

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

svn commit: r706007 - in /ofbiz/trunk/specialpurpose/projectmgr: script/org/ofbiz/project/ProjectPermissionServices.xml script/org/ofbiz/project/ProjectServices.xml servicedef/secas.xml servicedef/services.xml widget/forms/TaskForms.xml

hansbak-2
Author: hansbak
Date: Sun Oct 19 06:17:42 2008
New Revision: 706007

URL: http://svn.apache.org/viewvc?rev=706007&view=rev
Log:
add testing/validation parties if a task is set to complete and there parties as defined in the project

Modified:
    ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectPermissionServices.xml
    ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml
    ofbiz/trunk/specialpurpose/projectmgr/servicedef/secas.xml
    ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml
    ofbiz/trunk/specialpurpose/projectmgr/widget/forms/TaskForms.xml

Modified: ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectPermissionServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectPermissionServices.xml?rev=706007&r1=706006&r2=706007&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectPermissionServices.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectPermissionServices.xml Sun Oct 19 06:17:42 2008
@@ -143,12 +143,21 @@
 
         <!-- TASK -->
         <if-compare field="sec_object" value="TASK" operator="equals">
-            <set field="taskId" from-field="parameters.taskId" default-value="${parameters.workEffortId}"/>
-            <if-empty field="taskId">
+            <if-not-empty field="parameters.workEffortParentId">
                 <set field="phaseId" from-field="parameters.workEffortParentId"/>
-            </if-empty>
+                <else>
+                    <if-not-empty field="parameters.taskId">
+                        <set field="taskId" from-field="parameters.taskId"/>
+                        <else>
+                            <if-not-empty field="parameters.workEffortId">
+                                <set field="taskId" from-field="parameters.workEfortId"/>
+                            </if-not-empty>                    
+                        </else>
+                    </if-not-empty>                    
+                </else>
+            </if-not-empty>
             <set field="partyId" from-field="parameters.userLogin.partyId"/>
-            <call-simple-method method-name="checkProjectMembership"/>
+            <!--call-simple-method method-name="checkProjectMembership"/-->
             <!-- log level="info" message="======ProjectMGR Security=====  action: ${parameters.mainAction} object: ${sec_object} Id: ${parameters.taskId} PhaseId:  ${parameters.workEffortParentId} resourceDescription: ${parameters.resourceDescription} isMember: ${isMember}"/-->
             <entity-and list-name="custRequests" entity-name="WorkEffortCustRequestView">
                 <field-map field-name="workEffortId" env-name="taskId"/>
@@ -278,7 +287,7 @@
             <set field="timesheetId" from-field="timesheet.timesheetId"/>
             <set field="taskId" from-field="parameters.workEffortId"/>
             <set field="partyId" from-field="timesheet.partyId"/>
-            <call-simple-method method-name="checkProjectMembership"/>
+            <!-- call-simple-method method-name="checkProjectMembership"/-->
             <!-- log level="info" message="======ProjectMGR Security=====  action: ${mainAction} object: ${sec_object} timesheetId: ${timesheetId} from partyId: ${partyId} workEffortId: ${parameters.workEffortId} resourceDescription: ${parameters.resourceDescription}"/-->
             <if>
                 <condition>
@@ -336,6 +345,7 @@
     </simple-method>
     
     <simple-method method-name="checkProjectMembership" short-description="check if a party is member of a project, input either 'taskId', 'phaseId' or 'projectId', returns 'isMember' ">
+        <!--log level="always" message="==========object = ${sec_object}, check project membershhip with the following data.. taskId: ${taskId} phaseId: ${phaseId} projectId: ${projectId} party: ${partyId}"></log-->
         <if-not-empty field="taskId">
             <entity-one entity-name="WorkEffort" value-name="task">
                 <field-map field-name="workEffortId" env-name="taskId"/>

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=706007&r1=706006&r2=706007&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml Sun Oct 19 06:17:42 2008
@@ -189,7 +189,6 @@
                 <now-date-to-env env-name="generalStartDate"/>
             </else>
         </if-not-empty>
-        <log level="always" message="========== generalStartDate: ${generalStartDate}"></log>
         <while>
             <condition>
                 <if-empty field="generalStartDate"/>
@@ -385,15 +384,16 @@
             </if-not-empty>
         </loop>
         
-        <!-- update the assignment status -->
+        <!-- update the assignment status if required -->
         <if-compare field="parameters.checkComplete" value="Y" operator="equals">
             <first-from-list entry-name="alreadyAssign" list-name="assigns"/>
             <if-compare field="alreadyAssign.statusId" value="PAS_COMPLETED" operator="not-equals">
-                <set field="parameters.partyId" from-field="timesheet.partyId"/>
-                <set field="parameters.statusId" value="PAS_COMPLETED"/>
-                <set field="parameters.roleTypeId" from-field="alreadyAssign.roleTypeId"/>
-                <set field="parameters.fromDate" from-field="alreadyAssign.fromDate"/>
-                <call-simple-method method-name="updateTaskAssigment"/>
+                <set field="upStat.partyId" from-field="timesheet.partyId"/>
+                <set field="upStat.statusId" value="PAS_COMPLETED"/>
+                <set field="upStat.roleTypeId" from-field="alreadyAssign.roleTypeId"/>
+                <set field="upStat.workEffortId" from-field="parameters.workEffortId"/>
+                <set field="upStat.fromDate" from-field="alreadyAssign.fromDate"/>
+                <call-service service-name="updateTaskAssigment" in-map-name="upStat"/>
             </if-compare>
         </if-compare>
     </simple-method>          
@@ -1198,4 +1198,55 @@
             </if-empty>
         </iterate>
     </simple-method>    
+
+    <simple-method method-name="addValidationPartiesToTask" short-description="SECA to add either project-testing or -approval parties to a task when a task is set to complete">
+        <!-- check if this is the last party which completed his task -->
+        <log level="always" message="============= check workEffort: ${parameters.workEffortId}"/>
+        <entity-condition entity-name="WorkEffortPartyAssignment" list-name="openTasks" filter-by-date="true">
+            <condition-list combine="and">
+                <condition-expr field-name="workEffortId" operator="equals" env-name="parameters.workEffortId"/>
+                <condition-expr field-name="statusId" operator="not-equals" value="PAS_COMPLETED"/>
+                <condition-expr field-name="partyId" operator="not-equals" env-name="parameters.partyId"/>
+            </condition-list>
+        </entity-condition>  
+        <if-empty field="openTasks">
+            <set field="getProject.taskId" from-field="parameters.workEffortId"/>
+            <call-service service-name="getProjectIdAndNameFromTask" in-map-name="getProject">
+            <result-to-field result-name="projectId"/>
+        </call-service>
+        <!-- see who is reponsible for testing/validation in this project -->
+        <entity-condition entity-name="WorkEffortPartyAssignment" list-name="assigns" filter-by-date="true">
+            <condition-list combine="and">
+                <condition-expr field-name="workEffortId" operator="equals" env-name="projectId"/>
+                <condition-expr field-name="partyId" operator="not-equals" env-name="parameters.partyId"/><!-- should not test/val own work -->
+                <condition-list combine="or">
+                    <condition-expr field-name="roleTypeId" operator="equals" value="PROVIDER_VALIDATOR"/>
+                    <condition-expr field-name="roleTypeId" operator="equals" value="PROVIDER_TESTER"/>
+                </condition-list>
+            </condition-list>
+        </entity-condition>
+        <if-not-empty field="assigns">
+            <set field="addAssign.workEffortId" from-field="parameters.workEffortId"/>
+            <set field="addAssign.statusId" value="PAS_ASSIGNED"/>
+            <iterate entry-name="assign" list-name="assigns">
+                <make-value value-name="newAssign" entity-name="WorkEffortPartyAssignment"/>
+                <set field="newAssign.workEffortId" from-field="parameters.workEffortId"/>
+                <set field="newAssign.partyId" from-field="assign.partyId"/>
+                <set field="newAssign.roleTypeId" from-field="assign.roleTypeId"/>
+                <set field="newAssign.assignedByUserLoginId" value="system"/>
+                <now-date-to-env env-name="newAssign.fromDate"/>
+                <set field="newAssign.statusId" value="PAS_ASSIGNED"/>
+                <create-value value-name="newAssign"/>
+            </iterate>            
+            <else>
+                <log level="info" message="No validation parties defined in this project: no validation parties added...."></log>
+            </else>
+        </if-not-empty>
+            <else>
+                <log level="info" message="Not the last party who completes his task: validation parties not added...."></log>
+                <log level="info" message="=====parties not completed: openTasks: ${openTasks}"></log>
+            </else>
+        </if-empty>
+    </simple-method>
+
 </simple-methods>

Modified: ofbiz/trunk/specialpurpose/projectmgr/servicedef/secas.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/servicedef/secas.xml?rev=706007&r1=706006&r2=706007&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/servicedef/secas.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/servicedef/secas.xml Sun Oct 19 06:17:42 2008
@@ -21,10 +21,12 @@
 <service-eca xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/service-eca.xsd">
         
-        <!-- update task status, actual completion date when all assignments complete -->
-        <!--eca service="updateTaskAssigment" event="commit">
-                <condition field-name="statusId" operator="equals" value="PAS_COMPLETED"/>
-                <action service="updateTaskStatus" mode="sync"/>
-        </eca-->    
-        
+        <!-- check if testing or validation of completed tasks in this project is required, if so, assign the responsible party to the task -->
+    <eca service="updateTaskAssigment" event="invoke">
+        <condition field-name="statusId" operator="equals" value="PAS_COMPLETED"/>
+        <condition field-name="roleTypeId" operator="not-equals" value="PROVIDER_TESTER"/>
+        <condition field-name="roleTypeId" operator="not-equals" value="PROVIDER_VALIDATOR"/>
+        <action service="addValidationPartiesToTask" mode="sync"/>
+    </eca>
+    
 </service-eca>

Modified: ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml?rev=706007&r1=706006&r2=706007&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml Sun Oct 19 06:17:42 2008
@@ -246,5 +246,13 @@
         <attribute name="invoiceId" type="String" mode="INOUT" optional="true"/>
         <attribute name="reCreate" type="String" mode="IN" optional="true"/>
     </service>
-
+    <service name="addValidationPartiesToTask" engine="simple" auth="true"
+        location="org/ofbiz/project/ProjectServices.xml" invoke="addValidationPartiesToTask">
+        <description>SECA to add either project-testing or -approval parties to a task when a task is set to complete</description>
+        <attribute name="workEffortId" type="String" mode="IN" optional="true"/>
+        <attribute name="partyId" type="String" mode="IN" optional="true"/>
+        <attribute name="roleTypeId" type="String" mode="IN" optional="true"/>
+        <attribute name="statusId" type="String" mode="IN" optional="true"/>
+    </service>
+    
 </services>

Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/forms/TaskForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/forms/TaskForms.xml?rev=706007&r1=706006&r2=706007&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/widget/forms/TaskForms.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/widget/forms/TaskForms.xml Sun Oct 19 06:17:42 2008
@@ -530,7 +530,7 @@
         <field name="fromDate" title="${uiLabelMap.CommonFromDate}"><display type="date"/></field>
         <field name="thruDate" title="${uiLabelMap.CommonThruDate}"><display type="date"/></field>
         <field name="deleteButton" widget-style="smallSubmit"><submit button-type="button"/></field>
-        <field name="complete"><hyperlink description="set to Complete" target="updateTaskPartyAssign?workEffortId=${workEffortId}&amp;partyId=${partyId}&amp;roleTypeId=${roleTypeId}&amp;fromDate=${fromDate}&amp;statusId=CAL_COMPLETED&amp;thruDate=${nowDate}"/></field>
+        <field name="complete"><hyperlink description="set to Complete" target="updateTaskPartyAssign?workEffortId=${workEffortId}&amp;partyId=${partyId}&amp;roleTypeId=${roleTypeId}&amp;fromDate=${fromDate}&amp;statusId=PAS_COMPLETED&amp;thruDate=${nowDate}"/></field>
     </form>
     <form name="ListTaskParties" type="list" list-name="taskParties"
         odd-row-style="alternate-row" default-table-style="basic-table hover-bar">