svn commit: r613518 - in /ofbiz/trunk/specialpurpose/projectmgr: script/org/ofbiz/project/ servicedef/ webapp/projectmgr/WEB-INF/ webapp/projectmgr/WEB-INF/actions/ widget/ widget/forms/

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

svn commit: r613518 - in /ofbiz/trunk/specialpurpose/projectmgr: script/org/ofbiz/project/ servicedef/ webapp/projectmgr/WEB-INF/ webapp/projectmgr/WEB-INF/actions/ widget/ widget/forms/

hansbak-2
Author: hansbak
Date: Sun Jan 20 00:23:39 2008
New Revision: 613518

URL: http://svn.apache.org/viewvc?rev=613518&view=rev
Log:
project manager security fault fixing

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/services.xml
    ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/EditWeekTimesheet.bsh
    ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml
    ofbiz/trunk/specialpurpose/projectmgr/widget/CommonScreens.xml
    ofbiz/trunk/specialpurpose/projectmgr/widget/TaskScreens.xml
    ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml
    ofbiz/trunk/specialpurpose/projectmgr/widget/forms/RequestForms.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=613518&r1=613517&r2=613518&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectPermissionServices.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectPermissionServices.xml Sun Jan 20 00:23:39 2008
@@ -33,14 +33,14 @@
                 <if-compare field-name="parameters.resourceDescription" value="TimeEntry" operator="contains">
                     <set field="sec_object" value="TIMEENTRY"/>
                     <else>
-                        <if-compare field-name="parameters.resourceDescription" value="Project" operator="contains">
-                            <set field="sec_object" value="PROJECT"/>
+                        <if-compare field-name="parameters.resourceDescription" value="Task" operator="contains">
+                            <set field="sec_object" value="TASK"/><!-- task before project because of name 'getProjectTask' -->
                             <else>
                                 <if-compare field-name="parameters.resourceDescription" value="Phase" operator="contains">
                                     <set field="sec_object" value="PHASE"/>
                                     <else>
-                                        <if-compare field-name="parameters.resourceDescription" value="Task" operator="contains">
-                                            <set field="sec_object" value="TASK"/>
+                                        <if-compare field-name="parameters.resourceDescription" value="Project" operator="contains">
+                                            <set field="sec_object" value="PROJECT"/>
                                         </if-compare>
                                     </else>
                                 </if-compare>
@@ -51,116 +51,117 @@
             </else>
         </if-compare>      
         
-        <log level="info" message="======ProjectMGR Security=====  action: ${parameters.mainAction} object: ${sec_object} resourceDescription: ${parameters.resourceDescription}"/>
-
         <!-- PROJECT -->
         <if-compare field-name="sec_object" value="PROJECT" operator="equals">
-            <if-not-empty field-name="parameters.projectId">
-                <set field="projectId" from-field="parameters.projectId"/>
-                <set field="partyId" from-field="parameters.userLogin.partyId"/>
-                <call-simple-method method-name="checkProjectMembership"/>
-                <if>
-                    <condition>
-                        <or>
-                            <and>
-                                <if-has-permission permission="PROJECTMGR_ADMIN"/>
-                                <not><if-has-permission permission="PROJECTMGR_ROLE_ADMIN"/></not>
-                            </and>
-                            <and>
-                                <if-has-permission permission="PROJECTMGR_ROLE_ADMIN"/>
-                                <if-compare field-name="isMember" value="true" operator="equals"/>
-                            </and>
-                            <and>
-                                <if-has-permission permission="PROJECTMGR_VIEW"/>
-                                <not><if-has-permission permission="PROJECTMGR_ROLE_VIEW"/></not>
-                                <if-compare field-name="parameters.mainAction" value="VIEW" operator="equals"/>
-                            </and>
-                            <and>
-                                <if-has-permission permission="PROJECTMGR_ROLE_VIEW"/>
-                                <if-compare field-name="isMember" value="true" operator="equals"/>
-                                <if-compare field-name="parameters.mainAction" value="VIEW" operator="equals"/>
-                            </and>
-                        </or>
-                    </condition>
-                    <then>
-                        <field-to-result field-name="hasPermission"/>
-                        <return/>
-                    </then>
-                    <else>
-                        <property-to-field resource="ProjectMgrUiLabels" property="ProjectMgrNoAccessToProject" field-name="failMessage"/>
-                        <field-to-result field-name="failMessage"/>
-                        <field-to-result field-name="hasNoPermission" result-name="hasPermission"/>
-                        <return/>
-                    </else>
-                </if>
+            <log level="info" message="======ProjectMGR Security=====  action: ${parameters.mainAction} object: ${sec_object} Id: ${parameters.projectId} resourceDescription: ${parameters.resourceDescription}"/>
+            <set field="projectId" from-field="parameters.projectId"/>
+            <set field="partyId" from-field="parameters.userLogin.partyId"/>
+            <call-simple-method method-name="checkProjectMembership"/>
+            <if>
+                <condition>
+                    <or>
+                        <and>
+                            <!-- view a project with a null id is a null operation, so ok... -->
+                            <if-empty field-name="parameters.projectIdId"/>
+                            <if-compare field-name="parameters.mainAction" value="VIEW" operator="equals"/>
+                        </and>
+                        <and>
+                            <if-has-permission permission="PROJECTMGR_ADMIN"/>
+                            <not><if-has-permission permission="PROJECTMGR_ROLE_ADMIN"/></not>
+                        </and>
+                        <and>
+                            <if-has-permission permission="PROJECTMGR_ROLE_ADMIN"/>
+                            <if-compare field-name="isMember" value="true" operator="equals"/>
+                        </and>
+                        <and>
+                            <if-has-permission permission="PROJECTMGR_VIEW"/>
+                            <not><if-has-permission permission="PROJECTMGR_ROLE_VIEW"/></not>
+                            <if-compare field-name="parameters.mainAction" value="VIEW" operator="equals"/>
+                        </and>
+                        <and>
+                            <if-has-permission permission="PROJECTMGR_ROLE_VIEW"/>
+                            <if-compare field-name="isMember" value="true" operator="equals"/>
+                            <if-compare field-name="parameters.mainAction" value="VIEW" operator="equals"/>
+                        </and>
+                    </or>
+                </condition>
+                <then>
+                    <field-to-result field-name="hasPermission"/>
+                    <return/>
+                </then>
                 <else>
-                    <field-to-result field-name="hasPermission"/><!-- projectId empty -->
+                    <property-to-field resource="ProjectMgrUiLabels" property="ProjectMgrNoAccessToProject" field-name="failMessage"/>
+                    <field-to-result field-name="failMessage"/>
+                    <field-to-result field-name="hasNoPermission" result-name="hasPermission"/>
                     <return/>
                 </else>
-            </if-not-empty>
+            </if>
         </if-compare>        
         
         <!-- TASK -->
         <if-compare field-name="sec_object" value="TASK" operator="equals">
-            <set field="taskId" from-field="parameters.taskId" default-value="parameters.workEffortId"/>
-            <log level="info" message="=====Task: ${parameters.taskId}"></log>
-            <if-not-empty field-name="parameters.taskId">
-                <set field="taskId" from-field="parameters.workEffortId"/>
-                <set field="partyId" from-field="parameters.userLogin.partyId"/>
-                <call-simple-method method-name="checkProjectMembership"/>
-                <if>
-                    <condition>
-                        <or>
-                            <and>
-                                <if-has-permission permission="PROJECTMGR_ADMIN"/>
-                                <not><if-has-permission permission="PROJECTMGR_ROLE_ADMIN"/></not>
-                            </and>
-                            <and>
-                                <if-has-permission permission="PROJECTMGR_ROLE_ADMIN"/>
-                                <if-compare field-name="isMember" value="true" operator="equals"/>
-                            </and>
-                            <and>
-                                <if-has-permission permission="PROJECTMGR_VIEW"/>
-                                <not><if-has-permission permission="PROJECTMGR_ROLE_VIEW"/></not>
-                                <if-compare field-name="parameters.mainAction" value="VIEW" operator="equals"/>
-                            </and>
-                            <and>
-                                <if-has-permission permission="PROJECTMGR_ROLE_VIEW"/>
-                                <if-compare field-name="isMember" value="true" operator="equals"/>
-                                <if-compare field-name="parameters.mainAction" value="VIEW" operator="equals"/>
-                            </and>
-                            <and>
-                                <if-has-permission permission="PROJECTMGR_ROLE_TASK_CREATE"/>
-                                <if-compare field-name="isMember" value="true" operator="equals"/>
-                                <or>
-                                    <if-compare field-name="parameters.mainAction" value="CREATE" operator="equals"/>
-                                    <if-compare field-name="parameters.mainAction" value="UPDATE" operator="equals"/>
-                                </or>
-                            </and>
-                        </or>
-                    </condition>
-                    <then>
-                        <field-to-result field-name="hasPermission"/>
-                        <return/>
-                    </then>
-                    <else>
-                        <property-to-field resource="ProjectMgrUiLabels" property="ProjectMgrNoAccessToTask" field-name="failMessage"/>
-                        <field-to-result field-name="hasNoPermission" result-name="hasPermission"/>
-                        <field-to-result field-name="failMessage"/>
-                        <field-to-result field-name="hasNoPermission" result-name="hasPermission"/>
-                        <return/>
-                    </else>
-                </if>
+            <set field="taskId" from-field="parameters.taskId" default-value="${parameters.workEffortId}"/>
+            <if-empty field-name="taskId">
+                <set field="phaseId" from-field="parameters.workEffortParentId"/>
+            </if-empty>
+            <set field="partyId" from-field="parameters.userLogin.partyId"/>
+            <log level="info" message="======ProjectMGR Security=====  action: ${parameters.mainAction} object: ${sec_object} Id: ${parameters.taskId} PhaseId:  ${parameters.workEffortParentId} resourceDescription: ${parameters.resourceDescription}"/>
+            <call-simple-method method-name="checkProjectMembership"/>
+            <if>
+                <condition>
+                    <or>
+                        <and>
+                            <!-- view a task with a null id is a null operation, so ok... -->
+                            <if-empty field-name="parameters.taskId"/>
+                            <if-empty field-name="parameters.workEffortId"/>
+                            <if-compare field-name="parameters.mainAction" value="VIEW" operator="equals"/>
+                        </and>
+                        <and>
+                            <if-has-permission permission="PROJECTMGR_ADMIN"/>
+                            <not><if-has-permission permission="PROJECTMGR_ROLE_ADMIN"/></not>
+                        </and>
+                        <and>
+                            <if-has-permission permission="PROJECTMGR_ROLE_ADMIN"/>
+                            <if-compare field-name="isMember" value="true" operator="equals"/>
+                        </and>
+                        <and>
+                            <if-has-permission permission="PROJECTMGR_VIEW"/>
+                            <not><if-has-permission permission="PROJECTMGR_ROLE_VIEW"/></not>
+                            <if-compare field-name="parameters.mainAction" value="VIEW" operator="equals"/>
+                        </and>
+                        <and>
+                            <if-has-permission permission="PROJECTMGR_ROLE_VIEW"/>
+                            <if-compare field-name="isMember" value="true" operator="equals"/>
+                            <if-compare field-name="parameters.mainAction" value="VIEW" operator="equals"/>
+                        </and>
+                        <and>
+                            <if-has-permission permission="PROJECTMGR_ROLE_TASK_CREATE"/>
+                            <if-compare field-name="isMember" value="true" operator="equals"/>
+                            <or>
+                                <if-compare field-name="parameters.mainAction" value="CREATE" operator="equals"/>
+                                <if-compare field-name="parameters.mainAction" value="UPDATE" operator="equals"/>
+                            </or>
+                        </and>
+                    </or>
+                </condition>
+                <then>
+                    <field-to-result field-name="hasPermission"/>
+                    <return/>
+                </then>
                 <else>
-                    <field-to-result field-name="hasPermission"/><!-- projectId empty -->
+                    <property-to-field resource="ProjectMgrUiLabels" property="ProjectMgrNoAccessToTask" field-name="failMessage"/>
+                    <field-to-result field-name="hasNoPermission" result-name="hasPermission"/>
+                    <field-to-result field-name="failMessage"/>
+                    <field-to-result field-name="hasNoPermission" result-name="hasPermission"/>
                     <return/>
                 </else>
-            </if-not-empty>
+            </if>
         </if-compare>        
         
         
         <!-- TIMESHEET -->
         <if-compare field-name="sec_object" value="TIMESHEET" operator="equals">
+            <log level="info" message="======ProjectMGR Security=====  action: ${parameters.mainAction} object: ${sec_object} Id: ${parameters.timesheetId} resourceDescription: ${parameters.resourceDescription}"/>
             <if>
                 <condition>
                     <or>
@@ -206,86 +207,92 @@
         
         <!-- TIMEENTRY -->
         <if-compare field-name="sec_object" value="TIMEENTRY" operator="equals">
-            <if-not-empty field-name="parameters.timesheetId">
-                <entity-one entity-name="TimeSheet" value-name="timesheet"/>
-                <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"/>
-                <if>
-                    <condition>
-                        <or>
-                            <if-has-permission permission="PROJECTMGR_ADMIN"/>
-                            <and>
-                                <if-has-permission permission="PROJECTMGR_VIEW"/>
-                                <if-compare field-name="mainAction" value="VIEW" operator="equals"/>
-                            </and>
-                            <and>
-                                <if-has-permission permission="PROJECTMGR_TIMESHEET_CREATE"/>
-                                <not><if-has-permission permission="PROJECTMGR_ROLE_TIMESHEET_CREATE"/></not>
-                                <if-compare field-name="mainAction" value="CREATE" operator="equals"/>
-                            </and>
-                            <and>
-                                <if-has-permission permission="PROJECTMGR_TIMESHEET_UPDATE"/>
-                                <not><if-has-permission permission="PROJECTMGR_ROLE_TIMESHEET_UPDATE"/></not>
-                                <if-compare field-name="mainAction" value="UPDATE" operator="equals"/>
-                            </and>
-                            <and>
-                                <if-has-permission permission="PROJECTMGR_ROLE_TIMESHEET_CREATE"/>
-                                <if-compare field-name="mainAction" value="CREATE" operator="equals"/>
-                                <if-compare-field field-name="timesheet.partyId" to-field-name="parameters.userLogin.userLoginId" operator="equals"/>
-                                <if-compare field-name="isMember" value="true" operator="equals"/>
-                            </and>
-                            <and>
-                                <if-has-permission permission="PROJECTMGR_ROLE_TIMESHEET_UPDATE"/>
-                                <if-compare field-name="mainAction" value="UPDATE" operator="equals"/>
-                                <if-compare-field field-name="timesheet.partyId" to-field-name="parameters.userLogin.userLoginId" operator="equals"/>
-                                <if-compare field-name="isMember" value="true" operator="equals"/>
-                            </and>
-                        </or>
-                    </condition>
-                    <then>
-                        <field-to-result field-name="hasPermission"/>
-                        <return/>
-                    </then>
-                    <else>
-                        <property-to-field resource="ProjectMgrUiLabels" property="ProjectMgrNoAccessToTimesheet" field-name="failMessage"/>
-                        <field-to-result field-name="hasNoPermission" result-name="hasPermission"/>
-                        <field-to-result field-name="failMessage"/>
-                        <return/>
-                    </else>
-                </if>
+            <log level="info" message="======ProjectMGR Security=====  action: ${parameters.mainAction} object: ${sec_object} value: ${parameters.timeEntryId} workEffortId: ${parameters.workEffortId} timesheetId: ${parameters.timesheetId} resourceDescription: ${parameters.resourceDescription}"/>
+            <entity-one entity-name="Timesheet" value-name="timesheet"/>
+            <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"/>
+            <if>
+                <condition>
+                    <or>
+                        <if-empty field-name="parameters.workEffortId"/><!-- no use without a workeffortId -->
+                        <if-compare field-name="parameters.workEfortId" value="Totals" operator="equals"/>
+                        <if-empty field-name="parameters.timesheetId"/>
+                        <if-has-permission permission="PROJECTMGR_ADMIN"/>
+                        <and>
+                            <if-has-permission permission="PROJECTMGR_VIEW"/>
+                            <if-compare field-name="mainAction" value="VIEW" operator="equals"/>
+                        </and>
+                        <and>
+                            <if-has-permission permission="PROJECTMGR_TIMESHEET_CREATE"/>
+                            <not><if-has-permission permission="PROJECTMGR_ROLE_TIMESHEET_CREATE"/></not>
+                            <if-compare field-name="mainAction" value="CREATE" operator="equals"/>
+                        </and>
+                        <and>
+                            <if-has-permission permission="PROJECTMGR_TIMESHEET_UPDATE"/>
+                            <not><if-has-permission permission="PROJECTMGR_ROLE_TIMESHEET_UPDATE"/></not>
+                            <if-compare field-name="mainAction" value="UPDATE" operator="equals"/>
+                        </and>
+                        <and>
+                            <if-has-permission permission="PROJECTMGR_ROLE_TIMESHEET_CREATE"/>
+                            <if-compare field-name="mainAction" value="CREATE" operator="equals"/>
+                            <if-compare-field field-name="timesheet.partyId" to-field-name="parameters.userLogin.userLoginId" operator="equals"/>
+                            <if-compare field-name="isMember" value="true" operator="equals"/>
+                        </and>
+                        <and>
+                            <if-has-permission permission="PROJECTMGR_ROLE_TIMESHEET_UPDATE"/>
+                            <if-compare field-name="mainAction" value="UPDATE" operator="equals"/>
+                            <if-compare-field field-name="timesheet.partyId" to-field-name="parameters.userLogin.userLoginId" operator="equals"/>
+                            <if-compare field-name="isMember" value="true" operator="equals"/>
+                        </and>
+                    </or>
+                </condition>
+                <then>
+                    <field-to-result field-name="hasPermission"/>
+                    <return/>
+                </then>
                 <else>
-                    <field-to-result field-name="hasPermission"/><!-- no timesheetId nu update/read -->
+                    <property-to-field resource="ProjectMgrUiLabels" property="ProjectMgrNoAccessToTimesheet" field-name="failMessage"/>
+                    <field-to-result field-name="hasNoPermission" result-name="hasPermission"/>
+                    <field-to-result field-name="failMessage"/>
                     <return/>
                 </else>
-            </if-not-empty>
+            </if>
         </if-compare>
-        
+
+        <!-- should never arrive here..... -->
+        <log level="error" message="======ProjectMGR Security UNCHECKED ACTION=====  action: ${parameters.mainAction} object: ${sec_object} value: ${parameters.projectId}${parameters.workEffortId}${parameters.taskId}${parameters.timesheetId}${parameters.timeEntryId} resourceDescription: ${parameters.resourceDescription}"/>
         <property-to-field resource="CommonUiLabels" property="CommonPermissionThisOperation" field-name="resourceDescription"/>
         <field-to-result field-name="failMessage"/>
         <field-to-result field-name="hasNoPermission" result-name="hasPermission"/>
     </simple-method>
     
-    <simple-method method-name="checkProjectMembership" short-description="check if a party is member of a project, input either 'taskId' or 'projectId', returns 'isMember' ">
-        <if-empty field-name="projectId">
-            <set field="getProject.taskId" from-field="taskId"/>
-            <call-service service-name="getProjectIdAndName" in-map-name="getProject">
-                <result-to-field result-name="projectId" field-name="projectId"/>
-            </call-service>
-        </if-empty>
-        <log level="always" message="=======try to find project: ${projectId} for party: ${partyId}"></log>
-        <entity-and entity-name="WorkEffortPartyAssignment" list-name="projectAssigns" filter-by-date="true">
-            <field-map field-name="workEffortId" env-name="projectId"/>
-            <field-map field-name="partyId" env-name="partyId"/>
-        </entity-and>
-        <filter-list-by-date list-name="projectAssigns" to-list-name="projectAssignsDated"/>
-        <if-empty field-name="projectAssignsDated">
-            <log level="always" message="====is not member!!!===="></log>
-            <set field="isMember" value="false" type="Boolean"/>
-            <else>
-                <set field="isMember" value="true" type="Boolean"/>
-            </else>
-        </if-empty>
+    <simple-method method-name="checkProjectMembership" short-description="check if a party is member of a project, input either 'taskId', 'phaseId' or 'projectId', returns 'isMember' ">
+        <if-not-empty field-name="taskId">
+            <entity-one entity-name="WorkEffort" value-name="task">
+                <field-map field-name="workEffortId" env-name="taskId"/>
+            </entity-one>
+            <set field="phaseId" from-field="task.workEffortParentId"/>
+        </if-not-empty>
+        <if-not-empty field-name="phaseId">
+            <entity-one entity-name="WorkEffort" value-name="phase">
+                <field-map field-name="workEffortId" env-name="phaseId"/>
+            </entity-one>
+            <set field="projectId" from-field="phase.workEffortParentId"/>
+        </if-not-empty>
+        <if-not-empty field-name="projectId">
+            <entity-and entity-name="WorkEffortPartyAssignment" list-name="projectAssigns" filter-by-date="true">
+                <field-map field-name="workEffortId" env-name="projectId"/>
+                <field-map field-name="partyId" env-name="partyId"/>
+            </entity-and>
+            <filter-list-by-date list-name="projectAssigns" to-list-name="projectAssignsDated"/>
+            <if-empty field-name="projectAssignsDated">
+                <set field="isMember" value="false" type="Boolean"/>
+                <else>
+                    <set field="isMember" value="true" type="Boolean"/>
+                </else>
+            </if-empty>
+        </if-not-empty>
     </simple-method>
 </simple-methods>

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=613518&r1=613517&r2=613518&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml Sun Jan 20 00:23:39 2008
@@ -35,7 +35,7 @@
         <call-simple-method method-name="createWorkEffort" xml-resource="component://workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml"/>
         <if-not-empty field-name="parameters.partyId">
             <set field="parameters.workEffortId" from-field="newEntity.workEffortId"/>
-            <call-simple-method method-name="addTaskAssignment"/>
+            <call-simple-method method-name="assignPartyToWorkEffort" xml-resource="component://workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml"/>
         </if-not-empty>
     </simple-method>
     
@@ -43,6 +43,7 @@
         short-description="Update task to resource assignment, if required create a new one by re-assigment">
         <field-to-result map-name="parameters" field-name="workEffortId"/>
         <if>
+            <!-- check if a change in partyId Or roletypeId: need to delete and create new -->
             <condition>
                 <or>
                     <and>
@@ -74,35 +75,33 @@
                 <create-value value-name="newAssign"/>
             </then>
             <else>
-                <!-- status changed or assignment ended -->
-                <entity-one entity-name="WorkEffortPartyAssignment" value-name="assignment">
-                    <field-map field-name="workEffortId" env-name="parameters.workEffortId"/>
-                    <field-map field-name="partyId" env-name="parameters.partyId"/>
-                    <field-map field-name="roleTypeId" env-name="parameters.roleTypeId"/>
-                    <field-map field-name="fromDate" env-name="parameters.fromDate"/>
-                </entity-one>
-                <if-compare field-name="parameters.statusId" value="PAS_ENDED" operator="equals">
-                    <!-- special case to indicate end of assignment -->
-                    <now-date-to-env env-name="assignment.thruDate"/>
-                    <clear-field field-name="parameters.statusId"/>
-                </if-compare>
-                <set-nonpk-fields value-name="assignment" map-name="parameters"/>
-                <store-value value-name="assignment"/>
-                <if-compare field-name="assignment.statusId" value="PAS_COMPLETED" operator="equals">
-                    <call-simple-method method-name="updateTaskStatus"/>
-                </if-compare>
+                <if-not-empty field-name="parameters.fromDate">
+                    <!-- status changed or assignment ended -->
+                    <entity-one entity-name="WorkEffortPartyAssignment" value-name="assignment">
+                        <field-map field-name="workEffortId" env-name="parameters.workEffortId"/>
+                        <field-map field-name="partyId" env-name="parameters.partyId"/>
+                        <field-map field-name="roleTypeId" env-name="parameters.roleTypeId"/>
+                        <field-map field-name="fromDate" env-name="parameters.fromDate"/>
+                    </entity-one>
+                    <if-compare field-name="parameters.statusId" value="PAS_ENDED" operator="equals">
+                        <!-- special case to indicate end of assignment -->
+                        <now-date-to-env env-name="assignment.thruDate"/>
+                        <clear-field field-name="parameters.statusId"/>
+                    </if-compare>
+                    <set-nonpk-fields value-name="assignment" map-name="parameters"/>
+                    <store-value value-name="assignment"/>
+                    <if-compare field-name="assignment.statusId" value="PAS_COMPLETED" operator="equals">
+                        <call-simple-method method-name="updateTaskStatus"/>
+                    </if-compare>
+                    <else>
+                        <!-- new assignment -->
+                        <call-simple-method method-name="assignPartyToWorkEffort" xml-resource="component://workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml"/>
+                    </else>
+                </if-not-empty>
             </else>
         </if>
     </simple-method>
     
-    <simple-method method-name="addTaskAssignment" short-description="assign a party to a task however make sure he is member of the related project">
-        <make-value value-name="newAssign" entity-name="WorkEffortPartyAssignment"/>
-        <set-pk-fields value-name="newAssign" map-name="parameters"/>
-        <now-timestamp-to-env env-name="newAssign.fromDate"/>
-        <set field="newAssign.statusId" value="PAS_ASSIGNED"/>
-        <create-value value-name="newAssign"/>
-    </simple-method>
-        
     <simple-method method-name="updateTaskStatus"
         short-description="Check partyassignments on a task, if all completes set task status to completed and set actual completiondate to now">
         <entity-and entity-name="WorkEffortPartyAssignment" list-name="assignments" filter-by-date="true">
@@ -185,7 +184,6 @@
     </simple-method>        
     
     <simple-method method-name="updateTimeEntryByWorkeffort" short-description="Update workeffort by workeffort and timesheetId ">
-        <entity-one entity-name="Timesheet" value-name="timesheet"/>
         <field-to-result field-name="parameters.timesheetId" result-name="timesheetId"/>
         <if-empty field-name="parameters.workEffortId">
             <return/>
@@ -193,6 +191,7 @@
         <if-compare field-name="parameters.workEffortId" operator="equals" value="Totals">
             <return/>
         </if-compare>
+        <entity-one entity-name="Timesheet" value-name="timesheet"/>
         
         <!-- check if party assigned to task, when not add with roletype of project, if assigned check status -->
         <entity-and entity-name="WorkEffortPartyAssignment" list-name="assigns" filter-by-date="true">
@@ -201,7 +200,7 @@
         </entity-and>
         <if-empty field-name="assigns">
             <set field="getpr.taskId" from-field="parameters.workEffortId"/>
-            <call-service service-name="getProjectIdAndName" in-map-name="getpr">
+            <call-service service-name="getProjectIdAndNameFromTask" in-map-name="getpr">
                 <result-to-field result-name="projectId"/>
             </call-service>
             <entity-and entity-name="WorkEffortPartyAssignment" list-name="projectAssigns" filter-by-date="true">
@@ -213,6 +212,7 @@
             <set field="parameters.roleTypeId" from-field="projectAssign.roleTypeId"/>
             <set field="parameters.statusId" value="PAS_ASSIGNED"/>
             <call-simple-method method-name="assignPartyToWorkEffort" xml-resource="component://workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml"/>
+            <set field="parameters.fromDate" from-field="newEntity.fromDate"/><!-- need to be able to update status later -->
         </if-empty>
         <check-errors/>
         
@@ -281,7 +281,7 @@
         </if-compare>
     </simple-method>          
 
-    <simple-method method-name="getProjectIdAndName" short-description="Get the projectId when a phase or task is provided." login-required="true">
+    <simple-method method-name="getProjectIdAndNameFromTask" short-description="Get the projectId when a phase or task is provided." login-required="true">
         <if-empty field-name="parameters.taskId">
             <if-empty field-name="parameters.phaseId">
                 <return/>

Modified: ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml?rev=613518&r1=613517&r2=613518&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml Sun Jan 20 00:23:39 2008
@@ -53,7 +53,7 @@
         location="org/ofbiz/project/ProjectServices.xml" invoke="updateTimeEntryByWorkeffort">
         <description>Update workeffort by workeffortId and timesheetId </description>
         <permission-service service-name="projectMgrPermission" main-action="UPDATE"/>
-        <attribute name="timesheetId" type="String" mode="INOUT" optional="true"/>
+        <attribute name="timesheetId" type="String" mode="INOUT" optional="false"/>
         <attribute name="workEffortId" type="String" mode="INOUT" optional="true"/><!-- when empty will be ignored -->
         <attribute name="fromDate" type="Timestamp" mode="INOUT" optional="true"/>
         <attribute name="rateTypeId" type="String" mode="IN" optional="true"/>
@@ -102,6 +102,7 @@
         <attribute name="partyId" type="String" mode="IN" optional="false"/>
         <attribute name="roleTypeId" type="String" mode="IN" optional="false"/>
         <attribute name="statusId" type="String" mode="IN" optional="false"/>
+        <attribute name="fromDate" type="Timestamp" mode="OUT" optional="true"/>
         <attribute name="quickAssignPartyId" type="String" mode="IN" optional="true"/>
         <attribute name="requirementId" type="String" mode="IN" optional="true"/>
         <attribute name="communicationEventId" type="String" mode="IN" optional="true"/>
@@ -131,8 +132,8 @@
         <attribute name="projectId" type="String" mode="INOUT" optional="true"/>
     </service>
     
-    <service name="getProjectIdAndName" engine="simple"
-        location="org/ofbiz/project/ProjectServices.xml" invoke="getProjectIdAndName">
+    <service name="getProjectIdAndNameFromTask" engine="simple"
+        location="org/ofbiz/project/ProjectServices.xml" invoke="getProjectIdAndNameFromTask">
         <description>Get the projectId and Name when a phase or task is provided.</description>
         <permission-service service-name="projectMgrPermission" main-action="VIEW"/>
         <attribute name="taskId" type="String" mode="IN" optional="true"/>
@@ -197,17 +198,8 @@
         <attribute name="partyId" type="String" mode="IN"/>
         <attribute name="newRoleTypeId" type="String" mode="IN" optional="true"/>
         <attribute name="roleTypeId" type="String" mode="IN"/>
-        <attribute name="statusId" type="String" mode="IN" optional="true"/>
-        <attribute name="fromDate" type="Timestamp" mode="IN" optional="true"/>
+        <attribute name="statusId" type="String" mode="IN"/>
+        <attribute name="fromDate" type="Timestamp" mode="INOUT" optional="true"/>
     </service>
 
-    <service name="addTaskAssignment" default-entity-name="WorkEffortPartyAssignment" engine="simple"
-        location="org/ofbiz/project/ProjectServices.xml" invoke="addTaskAssignment">
-        <description>Add a WorkEffortPartyAssignment</description>
-        <permission-service service-name="projectMgrPermission" main-action="UPDATE" />
-        <attribute name="workEffortId" type="String" mode="IN"/>
-        <attribute name="partyId" type="String" mode="IN"/>
-        <attribute name="roleTypeId" type="String" mode="IN"/>
-    </service>
-    
 </services>

Modified: ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/EditWeekTimesheet.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/EditWeekTimesheet.bsh?rev=613518&r1=613517&r2=613518&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/EditWeekTimesheet.bsh (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/EditWeekTimesheet.bsh Sun Jan 20 00:23:39 2008
@@ -80,7 +80,7 @@
 context.put("weekNumber", UtilDateTime.weekNumber(timesheet.getTimestamp("fromDate")));
 
 entries = new LinkedList();
-entry = FastMap.newInstance();
+entry = UtilMisc.toMap("timesheetId", timesheet.get("timesheetId"));
 taskTotal = 0.00;
 day0Total = 0.00; day1Total=0.00;day2Total=0.00; day3Total=0.00;day4Total=0.00;day5Total=0.00;day6Total=0.00;
 pHours = 0.00;
@@ -118,7 +118,7 @@
  // get project/phase information
         entry.put("workEffortId", entryWorkEffort.getString("workEffortId"));    
         entry.put("workEffortName", entryWorkEffort.getString("workEffortName"));
-        result = dispatcher.runSync("getProjectIdAndName", UtilMisc.toMap("userLogin", parameters.get("userLogin"),"taskId",entryWorkEffort.getString("workEffortId")));
+        result = dispatcher.runSync("getProjectIdAndNameFromTask", UtilMisc.toMap("userLogin", parameters.get("userLogin"),"taskId",entryWorkEffort.getString("workEffortId")));
             entry.put("phaseId",result.get("phaseId"));    
             entry.put("phaseName",result.get("phaseName"));  
             entry.put("projectId",result.get("projectId"));  
@@ -126,11 +126,10 @@
             
         }
      entry.put("total", taskTotal);
-        entry.put("timesheetId", timesheet.get("timesheetId"));
         entries.add(entry);
         // start new entry
         taskTotal = 0.00;
- entry = FastMap.newInstance();
+ entry = UtilMisc.toMap("timesheetId", timesheet.get("timesheetId"));
 }
 
 timeEntries = timesheet.getRelated("TimeEntry", UtilMisc.toList("workEffortId", "rateTypeId", "fromDate"));
@@ -171,7 +170,7 @@
     
 // add empty lines if timesheet not completed    
 if (!timesheet.getString("statusId").equals("TIMESHEET_COMPLETED")) {
- for (c=0; c < 3; c++) { // add 5 empty lines
+ for (c=0; c < 3; c++) { // add empty lines
     entries.add(UtilMisc.toMap("timesheetId", timesheet.get("timesheetId")));
  }
 }

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=613518&r1=613517&r2=613518&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml Sun Jan 20 00:23:39 2008
@@ -152,18 +152,6 @@
         <event type="service" invoke="updateWorkEffort"/>
         <response name="success" type="view" value="taskView"/>
     </request-map>
-    <request-map uri="createTaskPartyAssign">
-        <security https="true" auth="true"/>
-        <event type="service" invoke="assignPartyToWorkEffort"/>
-        <response name="success" type="view" value="EditTaskPartyAssigns"/>
-        <response name="error" type="view" value="EditTaskPartyAssigns"/>
-    </request-map>
-    <request-map uri="assignPartyToWorkEffort">
-        <security https="true" auth="true"/>
-        <event type="service" invoke="assignPartyToWorkEffort"/>
-        <response name="success" type="view" value="MyTasks"/>
-        <response name="error" type="view" value="MyTasks"/>
-    </request-map>
     <request-map uri="updateTaskAssigment">
         <security https="true" auth="true"/>
         <event type="service" invoke="updateTaskAssigment"/>
@@ -172,16 +160,16 @@
     </request-map>
     <request-map uri="addTaskAssignment">
         <security https="true" auth="true"/>
-        <event type="service" invoke="addTaskAssignment"/>
+        <event type="service" invoke="updateTaskAssigment"/>
         <response name="success" type="view" value="MyTasks"/>
         <response name="error" type="view" value="MyTasks"/>
     </request-map>
-    <request-map uri="updateTaskPartyAssign">
-        <security https="true" auth="true"/>
+    <request-map uri="updateTaskPartyAssign">
+        <security https="true" auth="true"/>
         <event type="service" invoke="updateTaskAssigment"/>
-        <response name="success" type="view" value="EditTaskPartyAssigns"/>
-        <response name="error" type="view" value="EditTaskPartyAssigns"/>
-    </request-map>
+        <response name="success" type="view" value="EditTaskPartyAssigns"/>
+        <response name="error" type="view" value="EditTaskPartyAssigns"/>
+    </request-map>
     <request-map uri="createTask">
         <security https="true" auth="true"/>
         <event type="service" invoke="createProjectTask"/>

Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/CommonScreens.xml?rev=613518&r1=613517&r2=613518&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/widget/CommonScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/widget/CommonScreens.xml Sun Jan 20 00:23:39 2008
@@ -122,7 +122,7 @@
         <section>
             <actions>
                 <entity-one entity-name="WorkEffort" value-name="workEffort"/>
-                <service service-name="getProjectIdAndName" result-map-name="result">
+                <service service-name="getProjectIdAndNameFromTask" result-map-name="result">
                     <field-map field-name="taskId" env-name="parameters.workEffortId"/>
                 </service>
                 <set field="projectId" from-field="result.projectId"/>

Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/TaskScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/TaskScreens.xml?rev=613518&r1=613517&r2=613518&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/widget/TaskScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/widget/TaskScreens.xml Sun Jan 20 00:23:39 2008
@@ -27,7 +27,7 @@
                 <set field="titleProperty" value="PageTitleDependencies"/>                
                 <set field="tabButtonItem" value="dependencies"/>
                 <set field="workEffortId" from-field="parameters.workEffortId"/>
-                <service service-name="getProjectIdAndName" result-map-name="result">
+                <service service-name="getProjectIdAndNameFromTask" result-map-name="result">
                     <field-map field-name="taskId" env-name="parameters.workEffortId"/>
                 </service>
                 <set field="projectId" from-field="result.projectId"/>
@@ -380,7 +380,7 @@
                 <set field="workEffortId" from-field="parameters.workEffortId"/>
                 <entity-one entity-name="WorkEffortPartyAssignment" value-name="workEffortPartyAssignment"/>
                 <set field="nowDate" value="${bsh:org.ofbiz.base.util.UtilDateTime.nowDateString(&quot;yyyy-MM-dd HH:mm:ss.S&quot;)}" type="String"/>
-                <service service-name="getProjectIdAndName" result-map-name="result">
+                <service service-name="getProjectIdAndNameFromTask" result-map-name="result">
                     <field-map field-name="taskId" env-name="parameters.workEffortId"/>
                 </service>
                 <set field="projectId" from-field="result.projectId"/>

Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml?rev=613518&r1=613517&r2=613518&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml Sun Jan 20 00:23:39 2008
@@ -419,7 +419,7 @@
     </form>
     <form name="listResourcesTasks" type="list" list-name="tasks" paginate-target="listResourcesTask" target="updateResourcesTaskAssigment">
         <row-actions>
-            <service service-name="getProjectIdAndName" result-map-name="resultProject">
+            <service service-name="getProjectIdAndNameFromTask" result-map-name="resultProject">
                 <field-map field-name="taskId" env-name="workEffortId"/>
             </service>
             <service service-name="getProjectTask" result-map-name="result">

Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/forms/RequestForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/forms/RequestForms.xml?rev=613518&r1=613517&r2=613518&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/widget/forms/RequestForms.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/widget/forms/RequestForms.xml Sun Jan 20 00:23:39 2008
@@ -106,7 +106,7 @@
             <entity-one entity-name="WorkEffort" value-name="workEffort">
                 <field-map field-name="workEffortId" env-name="workEffortId"/>
             </entity-one>
-            <service service-name="getProjectIdAndName" result-map-name="result">
+            <service service-name="getProjectIdAndNameFromTask" result-map-name="result">
                 <field-map field-name="taskId" env-name="workEffortId"/>
             </service>
             <set field="projectId" from-field="result.projectId"/>

Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/forms/TaskForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/forms/TaskForms.xml?rev=613518&r1=613517&r2=613518&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/widget/forms/TaskForms.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/widget/forms/TaskForms.xml Sun Jan 20 00:23:39 2008
@@ -220,7 +220,7 @@
                 <field-map field-name="taskId" env-name="workEffortId"/>
                 <field-map field-name="hoursPartyId" env-name="userLogin.partyId"/>
             </service>
-            <service service-name="getProjectIdAndName" result-map-name="resultProject">
+            <service service-name="getProjectIdAndNameFromTask" result-map-name="resultProject">
                 <field-map field-name="taskId" env-name="workEffortId"/>
             </service>
         </row-actions>
@@ -242,14 +242,6 @@
         <field entry-name="result.taskInfo.plannedHours" name="plannedHours" title="${uiLabelMap.ProjectMgrPlannedHours}"><display/></field>
         <field entry-name="result.taskInfo.actualHours" name="actualHours" title="${uiLabelMap.ProjectMgrActualHours}"><display/></field>
         <field name="statusId" title="${uiLabelMap.CommonStatus}"><display-entity entity-name="StatusItem"/></field>
-        <field name="roleTypeId" parameter-name="newRoleTypeId" title="${uiLabelMap.PartyRole}">
-            <drop-down>
-                <entity-options entity-name="RoleType" description="${description}">
-                    <entity-constraint name="parentTypeId" value="PROJECT_TEAM"/>
-                    <entity-order-by field-name="description"/>
-                </entity-options>        
-            </drop-down>
-        </field>
         <field name="partyId" parameter-name="newPartyId">
             <drop-down>
                 <entity-options entity-name="PartyDetailAndWorkEffortAssign" description="${firstName} ${middleName} ${lastName}">
@@ -258,16 +250,23 @@
                 </entity-options>    
             </drop-down>
         </field>
+        <field name="roleTypeId" parameter-name="newRoleTypeId" title="${uiLabelMap.PartyRole}">
+            <drop-down>
+                <entity-options entity-name="RoleType" description="${description}">
+                    <entity-constraint name="parentTypeId" value="PROJECT_TEAM"/>
+                    <entity-order-by field-name="description"/>
+                </entity-options>        
+            </drop-down>
+        </field>
         <field name="workEffortId"><hidden/></field>
-        <field name="oldPartyId" parameter-name="partyId"><hidden value="${partyId}"/></field>
-        <field name="oldRoleTypeId" parameter-name="roleTypeId"><hidden value="${roleTypeId}"/></field>
         <field name="fromDate"><hidden/></field>
         <field name="updateButton"><submit/></field>
         <field name="remove" title="${uiLabelMap.CommonRemove}"><hyperlink target="updateTaskAssigment?workEffortId=${workEffortId}&amp;partyId=${partyId}&amp;roleTypeId=${roleTypeId}&amp;fromDate=${fromDate}&amp;statusId=PAS_ENDED" description="${uiLabelMap.CommonRemove}"/></field>
         <field name="toComplete" title="${uiLabelMap.CommonStatustoComplete}"><hyperlink target="updateTaskAssigment?workEffortId=${workEffortId}&amp;partyId=${partyId}&amp;roleTypeId=${roleTypeId}&amp;fromDate=${fromDate}&amp;statusId=PAS_COMPLETED" description="${uiLabelMap.CommonStatustoComplete}"/></field>
     </form>
     <form name="assignTaskToMe" type="single" target="addTaskAssignment">
-        <field name="partyId"><hidden value="${userLogin.partyId}"/></field>
+        <field name="partyId"><hidden value="${userLogin.partyId}"/></field>
+        <field name="statusId"><hidden value="PAS_ASSIGNED"/></field>
         <field name="workEffortId" title="${uiLabelMap.ProjectMgrTaskName}">
             <drop-down>
                 <entity-options entity-name="ProjectPartyAndPhaseAndTask" description="${workEffortName} (${phaseName}-${projectName})">