diff --git a/applications/workeffort/entitydef/entitymodel_view.xml b/applications/workeffort/entitydef/entitymodel_view.xml index 64f7f82f6c..5417690f15 100644 --- a/applications/workeffort/entitydef/entitymodel_view.xml +++ b/applications/workeffort/entitydef/entitymodel_view.xml @@ -181,16 +181,14 @@ under the License. - - - - - + - - - + + + + + ecl = EntityCondition.makeCondition(entityExprList); - - // Use the View Entity + List orderByList = UtilMisc.toList("estimatedStartDate"); if (partyIdsToUse.size() > 0 || UtilValidate.isNotEmpty(facilityId) || UtilValidate.isNotEmpty(fixedAssetId)) { try { List 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); }