svn commit: r703701 - in /ofbiz/trunk/applications/workeffort: entitydef/entitymodel_view.xml src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java

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

svn commit: r703701 - in /ofbiz/trunk/applications/workeffort: entitydef/entitymodel_view.xml src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java

adrianc
Author: adrianc
Date: Sat Oct 11 11:05:58 2008
New Revision: 703701

URL: http://svn.apache.org/viewvc?rev=703701&view=rev
Log:
WorkEffortServices.java getWorkEffortEventsByPeriod(...) method fixed to return assigned fixed assets.

Modified:
    ofbiz/trunk/applications/workeffort/entitydef/entitymodel_view.xml
    ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java

Modified: ofbiz/trunk/applications/workeffort/entitydef/entitymodel_view.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/entitydef/entitymodel_view.xml?rev=703701&r1=703700&r2=703701&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/entitydef/entitymodel_view.xml (original)
+++ ofbiz/trunk/applications/workeffort/entitydef/entitymodel_view.xml Sat Oct 11 11:05:58 2008
@@ -181,16 +181,14 @@
       <view-link entity-alias="WE" rel-entity-alias="WEFAA">
         <key-map field-name="workEffortId"/>
       </view-link>
-      <relation type="one-nofk" rel-entity-name="WorkEffort">
-        <key-map field-name="workEffortId"/>
-      </relation>
-      <relation type="one-nofk" rel-entity-name="WorkEffortFixedAssetAssign">
-        <key-map field-name="workEffortId"/>
+      <relation type="one-nofk" rel-entity-name="FixedAsset">
         <key-map field-name="fixedAssetId"/>
-        <key-map field-name="fromDate"/>
       </relation>
-      <relation type="one-nofk" rel-entity-name="WorkEffortType">
-        <key-map field-name="workEffortTypeId"/>
+      <relation type="one-nofk" rel-entity-name="StatusItem">
+        <key-map field-name="statusId"/>
+      </relation>
+      <relation type="one-nofk" rel-entity-name="StatusItem" title="Availability">
+        <key-map field-name="availabilityStatusId" rel-field-name="statusId"/>
       </relation>
     </view-entity>
     <view-entity entity-name="WorkEffortAndPartyAssign"

Modified: ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java?rev=703701&r1=703700&r2=703701&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java (original)
+++ ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java Sat Oct 11 11:05:58 2008
@@ -362,7 +362,7 @@
         }
         if (UtilValidate.isNotEmpty(fixedAssetId)) {
             entityExprList.add(EntityCondition.makeCondition("fixedAssetId", EntityOperator.EQUALS, fixedAssetId));
-            typesList.add(EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, "PROD_ORDER_TASK"));
+//            typesList.add(EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, "PROD_ORDER_TASK"));
             entityExprList.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "PRUN_CREATED"));
             entityExprList.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "PRUN_COMPLETED"));
             entityExprList.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "PRUN_CLOSED"));
@@ -488,13 +488,16 @@
             entityExprList.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "EVENT_CANCELLED"));
         }
         EntityConditionList<EntityCondition> ecl = EntityCondition.makeCondition(entityExprList);
-        
-        // Use the View Entity
+        List<String> orderByList = UtilMisc.toList("estimatedStartDate");
         if (partyIdsToUse.size() > 0 || UtilValidate.isNotEmpty(facilityId) || UtilValidate.isNotEmpty(fixedAssetId)) {
             try {
                 List<GenericValue> tempWorkEfforts = null;
                 if (UtilValidate.isNotEmpty(partyIds)) {
-                    tempWorkEfforts = EntityUtil.filterByDate(delegator.findList("WorkEffortAndPartyAssign", ecl, null, UtilMisc.toList("estimatedStartDate"), null, false));
+                    tempWorkEfforts = EntityUtil.filterByDate(delegator.findList("WorkEffortAndPartyAssign", ecl, null, orderByList, null, false));
+                } else if (UtilValidate.isNotEmpty(fixedAssetId)) {
+                    // Get "old style" work efforts and "new style" work efforts
+                    tempWorkEfforts = delegator.findList("WorkEffort", ecl, null, orderByList, null, false);
+                    tempWorkEfforts.addAll(EntityUtil.filterByDate(delegator.findList("WorkEffortAndFixedAssetAssign", ecl, null, orderByList, null, false)));
                 } else {
                     tempWorkEfforts = delegator.findList("WorkEffort", ecl, null, UtilMisc.toList("estimatedStartDate"), null, false);
                 }