svn commit: r705850 - in /ofbiz/trunk/specialpurpose/projectmgr: script/org/ofbiz/project/ProjectServices.xml webapp/projectmgr/WEB-INF/actions/EditWeekTimesheet.groovy

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

svn commit: r705850 - in /ofbiz/trunk/specialpurpose/projectmgr: script/org/ofbiz/project/ProjectServices.xml webapp/projectmgr/WEB-INF/actions/EditWeekTimesheet.groovy

hansbak-2
Author: hansbak
Date: Sat Oct 18 01:09:46 2008
New Revision: 705850

URL: http://svn.apache.org/viewvc?rev=705850&view=rev
Log:
correction on timesheet dropdown

Modified:
    ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml
    ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/EditWeekTimesheet.groovy

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=705850&r1=705849&r2=705850&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml Sat Oct 18 01:09:46 2008
@@ -706,6 +706,7 @@
             <condition-list combine="and">
                 <condition-expr field-name="projectId" operator="equals" env-name="parameters.projectId" ignore-if-empty="true"/>
                 <condition-expr field-name="partyId" operator="equals" env-name="parameters.partyId" ignore-if-empty="true"/>
+                <condition-expr field-name="partyId" operator="not-equals" env-name="null"/>
             </condition-list>
             <order-by field-name="projectId"/>
             <order-by field-name="partyId"/>

Modified: ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/EditWeekTimesheet.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/EditWeekTimesheet.groovy?rev=705850&r1=705849&r2=705850&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/EditWeekTimesheet.groovy (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/EditWeekTimesheet.groovy Sat Oct 18 01:09:46 2008
@@ -207,42 +207,41 @@
 dataAdd = [];
 
 if (!"mytasks".equals(headerItem)) {
- //assigned task to party
-    tasks.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId));
-    tasks.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "PTS_COMPLETED"));
-    tasks.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "PTS_CANCELLED"));
-    tasks.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "PTS_ON_HOLD"));
-    taskCond = EntityCondition.makeCondition(tasks, EntityOperator.AND);
-    projectPhaseTaskChecks = delegator.findList("ProjectPartyAndPhaseAndTask", taskCond, null, orderByList, null, false);
-    projectPhaseTaskChecks.each { projectPhaseTask ->
-     taskPaertys = [];
-        taskPaertys.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId));
-        taskPaertys.add(EntityCondition.makeCondition("workEffortId", EntityOperator.EQUALS, projectPhaseTask.workEffortId));
-        taskPaertys.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PAS_COMPLETED"));
-        taskPaertyCond = EntityCondition.makeCondition (taskPaertys, EntityOperator.AND);
-        projectPhaseTaskPartys = delegator.findList ("ProjectAndPhaseAndTaskParty", taskPaertyCond, null, orderByList, null, false);
-        projectPhaseTaskPartys.each { check ->
-         ass = [];
-            ass.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId));
-            ass.add(EntityCondition.makeCondition("workEffortId", EntityOperator.NOT_EQUAL, check.workEffortId));
-            ass.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PAS_ASSIGNED"));
-            assCond = EntityCondition.makeCondition (ass, EntityOperator.AND);
-            workEffortAssignments = delegator.findList("WorkEffortPartyAssignment", assCond, null, null, null, false);
-            if (workEffortAssignments) {
-                found = false;
-                timeEntries.each { timeEntry ->
-                if (timeEntry.workEffortId.equals(check.workEffortId)) {
-                    found = true;
-                }
-                }
-                if (!found) {
-                    projectPhaseTasks.add(check);
-                }
-            }
-        }
-    }
-}
-else{//Don't assign tasks
+ nowDate = UtilDateTime.nowTimestamp();
+ taskCond = EntityCondition.makeCondition ([EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId),
+                                           EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, "PROJECT"),
+                                           EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, nowDate),
+                                           EntityCondition.makeCondition ([EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowDate),
+                                                                           EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null)
+                                                                          ], EntityOperator.OR),
+                                          ], EntityOperator.AND);
+    
+ projectList = delegator.findList("WorkEffortAndPartyAssign", taskCond, (HashSet) ["workEffortId"], ["workEffortId"], null, false);
+ projects = [];
+ projectList.each { project ->
+    projects.add(project.workEffortId);
+ }
+ if (projects) {
+    taskPartyCond =
+        EntityCondition.makeCondition (
+                [EntityCondition.makeCondition("projectId", EntityOperator.IN, projects),
+                 EntityCondition.makeCondition("currentStatusId", EntityOperator.EQUALS, "PTS_CREATED"),
+                 EntityCondition.makeCondition(
+                             [EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, null),
+                              EntityCondition.makeCondition(
+                              [EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId),
+                                       EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, nowDate),
+                                       EntityCondition.makeCondition ([EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowDate),
+                                                                       EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null)
+                                                                      ], EntityOperator.OR),
+                                      ],EntityOperator.AND),
+                             ],EntityOperator.OR),
+                ],EntityOperator.AND);
+    orderByList = ["projectId", "phaseId", "workEffortId"];
+    HashSet fields = ["workEffortId", "projectName", "phaseName", "workEffortName"];
+    projectPhaseTasks = delegator.findList ("ProjectAndPhaseAndTaskParty", taskPartyCond, fields, orderByList, null, false);
+ }
+} else {//Don't assign tasks
  tasksAss = [];
     tasksAss.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "PTS_COMPLETED"));
     tasksAss.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "PTS_CANCELED"));