svn commit: r1224703 - in /ofbiz/trunk/specialpurpose/projectmgr: entitydef/entitymodel.xml script/org/ofbiz/project/ProjectServices.xml

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

svn commit: r1224703 - in /ofbiz/trunk/specialpurpose/projectmgr: entitydef/entitymodel.xml script/org/ofbiz/project/ProjectServices.xml

erwan
Author: erwan
Date: Mon Dec 26 10:16:42 2011
New Revision: 1224703

URL: http://svn.apache.org/viewvc?rev=1224703&view=rev
Log:
OFBIZ-4625 - Project, Phase, Task actualsHours, plannedHours is wrong in some cases after last modification done on ProjectServices.xml - a patch from Olivier Heintz

Modified:
    ofbiz/trunk/specialpurpose/projectmgr/entitydef/entitymodel.xml
    ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml

Modified: ofbiz/trunk/specialpurpose/projectmgr/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/entitydef/entitymodel.xml?rev=1224703&r1=1224702&r2=1224703&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/entitydef/entitymodel.xml Mon Dec 26 10:16:42 2011
@@ -283,14 +283,13 @@ under the License.
     </view-link>
   </view-entity>
 
-  <view-entity entity-name="ProjectPhaseTaskSummaryView"
+  <view-entity entity-name="ProjectPhaseTaskSklSumView"
     package-name="org.ofbiz.specialpurpose.project">
     <description>Retrieve actual, estimated start and end dates, priority, planned hours</description>
 
     <member-entity entity-alias="WEP" entity-name="WorkEffort"/><!--project -->
     <member-entity entity-alias="WEPH" entity-name="WorkEffort"/><!-- phase -->
     <member-entity entity-alias="WET" entity-name="WorkEffort"/><!-- task -->
-    <member-entity entity-alias="TE" entity-name="TimeEntry"/><!-- to get actualStartDate from declared times-->
     <member-entity entity-alias="SKL" entity-name="WorkEffortSkillStandard"/> <!-- for planned hours -->
 
     <alias entity-alias="WEP" field="workEffortId" name="projectId" group-by="true"/>
@@ -300,28 +299,50 @@ under the License.
     <!-- get minimum for start dates -->
     <alias entity-alias="WET" name="estimatedStartDate" function="min"/>
     <alias entity-alias="WET" name="actualStartDate" function="min"/>
-    <alias entity-alias="TE" field="fromDate" name="actualEntryStartDate" function="min"/>
 
     <!-- and maximum for completion dates -->
     <alias entity-alias="WET" name="estimatedCompletionDate" function="max"/>
     <alias entity-alias="WET" name="actualCompletionDate" function="max"/>
-    <alias entity-alias="TE" field="fromDate" name="actualEntryCompletionDate" function="max"/>
 
     <!-- get the sum of planned and actual hours -->
     <alias entity-alias="SKL" field="estimatedDuration" name="plannedHours" function="sum"/>
     <!-- get the minimum priority -->
     <alias entity-alias="WET" field="priority" name="priority" function="min"/>
 
-    <view-link entity-alias="WEP" rel-entity-alias="WEPH" rel-optional="true">
+    <view-link entity-alias="WEP" rel-entity-alias="WEPH">
       <key-map field-name="workEffortId" rel-field-name="workEffortParentId"/>
     </view-link>
-    <view-link entity-alias="WEPH" rel-entity-alias="WET" rel-optional="true">
+    <view-link entity-alias="WEPH" rel-entity-alias="WET">
       <key-map field-name="workEffortId" rel-field-name="workEffortParentId"/>
     </view-link>
     <view-link entity-alias="WET" rel-entity-alias="SKL" rel-optional="true">
       <key-map field-name="workEffortId" />
     </view-link>
-    <view-link entity-alias="WET" rel-entity-alias="TE" rel-optional="true">
+  </view-entity>
+
+  <view-entity entity-name="ProjectPhaseTaskActualEntrySumView"
+    package-name="org.ofbiz.specialpurpose.project">
+    <description>Retrieve actual, start and end dates from TimeEntries associated</description>
+
+    <member-entity entity-alias="WEP" entity-name="WorkEffort"/><!--project -->
+    <member-entity entity-alias="WEPH" entity-name="WorkEffort"/><!-- phase -->
+    <member-entity entity-alias="WET" entity-name="WorkEffort"/><!-- task -->
+    <member-entity entity-alias="TE" entity-name="TimeEntry"/><!-- to get actualStartDate from declared times-->
+
+    <alias entity-alias="WEP" field="workEffortId" name="projectId" group-by="true"/>
+    <alias entity-alias="WEPH" field="workEffortId" name="phaseId" group-by="true"/>
+    <alias entity-alias="WET" field="workEffortId" name="taskId" group-by="true"/>
+
+    <alias entity-alias="TE" field="fromDate" name="actualEntryStartDate" function="min"/>
+    <alias entity-alias="TE" field="thruDate" name="actualEntryCompletionDate" function="max"/>
+
+    <view-link entity-alias="WEP" rel-entity-alias="WEPH">
+      <key-map field-name="workEffortId" rel-field-name="workEffortParentId"/>
+    </view-link>
+    <view-link entity-alias="WEPH" rel-entity-alias="WET">
+      <key-map field-name="workEffortId" rel-field-name="workEffortParentId"/>
+    </view-link>
+    <view-link entity-alias="WET" rel-entity-alias="TE">
       <key-map field-name="workEffortId" />
     </view-link>
   </view-entity>
@@ -346,13 +367,13 @@ under the License.
     <alias entity-alias="PR" name="partyId" group-by="true"/>
     <alias entity-alias="PR" name="percentageUsed" function="max"/>
 
-    <view-link entity-alias="WEP" rel-entity-alias="WEPH" rel-optional="true">
+    <view-link entity-alias="WEP" rel-entity-alias="WEPH">
       <key-map field-name="workEffortId" rel-field-name="workEffortParentId"/>
     </view-link>
-    <view-link entity-alias="WEPH" rel-entity-alias="WET" rel-optional="true">
+    <view-link entity-alias="WEPH" rel-entity-alias="WET">
       <key-map field-name="workEffortId" rel-field-name="workEffortParentId"/>
     </view-link>
-    <view-link entity-alias="WET" rel-entity-alias="TE" rel-optional="true">
+    <view-link entity-alias="WET" rel-entity-alias="TE">
       <key-map field-name="workEffortId" />
     </view-link>
     <view-link entity-alias="TE" rel-entity-alias="TS" rel-optional="true">
@@ -360,9 +381,9 @@ under the License.
     </view-link>
     <view-link entity-alias="TE" rel-entity-alias="PR" rel-optional="true">
       <key-map field-name="rateTypeId"/>
+      <key-map field-name="partyId"/>
       <entity-condition>
         <condition-list>
-            <condition-expr entity-alias="TS" field-name="partyId" rel-entity-alias="PR" rel-field-name="partyId"/>
             <condition-expr entity-alias="PR" field-name="fromDate" operator="less-equals" rel-entity-alias="TE" rel-field-name="fromDate"/>
             <condition-list combine="or">
                 <condition-expr entity-alias="PR" field-name="thruDate" operator="equals" value=""/>
@@ -406,7 +427,7 @@ under the License.
     <alias entity-alias="PPAH" name="projectId" group-by="true"/>
     <alias entity-alias="PPAH" name="phaseId" group-by="true"/>
     <alias entity-alias="PPAH" name="taskId" group-by="true"/>
-        <alias entity-alias="PPAH" name="invoiceId" group-by="true"/>
+    <alias entity-alias="PPAH" name="invoiceId" group-by="true"/>
     <alias entity-alias="PPAH" name="totalOriginalHours" field="hours" function="sum"/>
 
     <entity-condition>

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=1224703&r1=1224702&r2=1224703&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml Mon Dec 26 10:16:42 2011
@@ -843,7 +843,6 @@
                 <clear-field field="highInfo.sequenceId"/>
                 <set field="highInfo.currentStatusId" from-field="lowInfo.currentStatusId"/>
                 <call-simple-method method-name="createDates"/>
-                <call-simple-method method-name="getHours" xml-resource="component://workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml"/>
                 <set field="highInfo.workEffortId" from-field="lowInfo.workEffortId"/>
                 <set field="highInfo.workEffortName" from-field="lowInfo.workEffortName"/>
                 <set field="highInfo.sequenceNum" from-field="lowInfo.sequenceNum"/>
@@ -1072,7 +1071,7 @@
     </simple-method>
 
     <simple-method method-name="combineDatesAndPlannedHoursInfo" short-description="combine lower level start end dates and planned hours for a project, phase or task">
-        <entity-condition  entity-name="ProjectPhaseTaskSummaryView" list="summaryInfos">
+        <entity-condition  entity-name="ProjectPhaseTaskSklSumView" list="summaryInfos">
             <condition-list>
                 <condition-expr field-name="projectId" from-field="highInfo.projectId" ignore-if-empty="true"/>
                 <condition-expr field-name="phaseId" from-field="highInfo.phaseId" ignore-if-empty="true"/>
@@ -1080,15 +1079,14 @@
             </condition-list>
             <select-field field-name="projectId"/>
             <select-field field-name="estimatedStartDate"/>
-            <select-field field-name="actualEntryStartDate"/>
             <select-field field-name="actualStartDate"/>
             <select-field field-name="estimatedCompletionDate"/>
             <select-field field-name="actualCompletionDate"/>
-            <select-field field-name="actualEntryCompletionDate"/>
             <select-field field-name="plannedHours"/>
             <select-field field-name="priority"/>
         </entity-condition>
 
+        <!-- Now used TimeEntries to update (or not) actual start and end Date -->
         <first-from-list entry="summaryInfo" list="summaryInfos"/>
         <set field="highInfo.estimatedStartDate" from-field="summaryInfo.estimatedStartDate"/>
         <set field="highInfo.estimatedCompletionDate" from-field="summaryInfo.estimatedCompletionDate"/>
@@ -1096,36 +1094,49 @@
         <set field="highInfo.actualCompletionDate" from-field="summaryInfo.actualCompletionDate"/>
         <set field="highInfo.priority" from-field="summaryInfo.priority"/>
         <set field="highInfo.plannedHours" from-field="summaryInfo.plannedHours"/>
-        <!-- update actual start date by the min date form sub tasks associated entries
+        <!-- update actual start date by the min date form sub tasks associated TimeEntries
         (if before actualStartDate field) -->
-        <if-not-empty field="summaryInfo.actualEntryStartDate">
+        <entity-condition  entity-name="ProjectPhaseTaskActualEntrySumView" list="summaryEntriesInfos">
+            <condition-list>
+                <condition-expr field-name="projectId" from-field="highInfo.projectId" ignore-if-empty="true"/>
+                <condition-expr field-name="phaseId" from-field="highInfo.phaseId" ignore-if-empty="true"/>
+                <condition-expr field-name="taskId" from-field="highInfo.taskId" ignore-if-empty="true"/>
+            </condition-list>
+            <select-field field-name="actualEntryStartDate"/>
+            <select-field field-name="actualEntryCompletionDate"/>
+        </entity-condition>
+        <first-from-list entry="timeEntriesInfo" list="summaryEntriesInfos"/>
+        <if-not-empty field="timeEntriesInfo">
+          <if-not-empty field="timeEntriesInfo.actualEntryStartDate">
             <if>
                 <condition>
                     <or>
                         <if-empty field="highInfo.actualStartDate"/>
-                        <if-compare-field field="highInfo.actualStartDate" operator="greater" type="Timestamp" to-field="summaryInfo.actualEntryStartDate"/>
+                        <if-compare-field field="highInfo.actualStartDate" operator="greater" type="Timestamp" to-field="timeEntriesInfo.actualEntryStartDate"/>
                     </or>
                 </condition>
                 <then>
-                    <set field="highInfo.actualStartDate" from-field="summaryInfo.actualEntryStartDate"/>
+                    <set field="highInfo.actualStartDate" from-field="timeEntriesInfo.actualEntryStartDate"/>
                 </then>
             </if>
-        </if-not-empty>
-        <!-- update actual completion date by the max date form sub tasks associated entries
-        (if after actualCompletionDate field) -->
-        <if-not-empty field="summaryInfo.actualEntryCompletionDate">
+          </if-not-empty>
+          <!-- update actual completion date by the max date form sub tasks associated TimeEntries
+          (if after actualCompletionDate field) -->
+          <if-not-empty field="timeEntriesInfo.actualEntryCompletionDate">
             <if>
                 <condition>
                     <or>
                         <if-empty field="highInfo.actualCompletionDate"/>
-                        <if-compare-field field="highInfo.actualCompletionDate" operator="less" type="Timestamp" to-field="summaryInfo.actualEntryCompletionDate"/>
+                        <if-compare-field field="highInfo.actualCompletionDate" operator="less" type="Timestamp" to-field="timeEntriesInfo.actualEntryCompletionDate"/>
                     </or>
                 </condition>
                 <then>
-                    <set field="highInfo.actualCompletionDate" from-field="summaryInfo.actualEntryCompletionDate"/>
+                    <set field="highInfo.actualCompletionDate" from-field="timeEntriesInfo.actualEntryCompletionDate"/>
                 </then>
             </if>
+          </if-not-empty>
         </if-not-empty>
+        
     </simple-method>
 
     <simple-method method-name="combineInfo" short-description="combine lower level status, dates of tasks.">
@@ -1140,6 +1151,9 @@
          the timesheet associated to this time entry and has the same rateType as this timeEntry
         -actualHoursOriginal is the total of hours in time entries without application of percentage declared in partyRate
          -->
+        <clear-field field="originalHours"/>
+        <clear-field field="actualHours"/>
+        <clear-field field="originalActualHours"/>
 
         <!-- I- get timeEntries for which there is no rate  (originalHours)-->
         <entity-condition list="notRatedValues" entity-name="ProjectPhaseTaskActualNotRatedHoursView">
@@ -1166,6 +1180,7 @@
             <select-field field-name="totalRatedHours"/>
         </entity-condition>
         <first-from-list list="ratedValues" entry="ratedValue"/>
+        <!-- not used ratedValue.totalRatedHours  because not works, reason seem to be totalRatedHours is a calculated field ??? -->
         <call-object-method method-name="getDouble" obj-field="ratedValue" ret-field="actualHours">
             <string value="totalRatedHours"/>
         </call-object-method>