Author: pgil
Date: Fri Oct 9 18:49:42 2015
New Revision: 1707791
URL:
http://svn.apache.org/viewvc?rev=1707791&view=revLog:
OFBIZ-6654 Display of a recurrent workeffort in workeffort calendar do not respect estimatedStart/CompletionDate
Fix getWorkEffortEventsByPeriod service by :
- ignoring actual date timed workeffort in temporal expression process
- excluding workeffort occurence that are out of estimated date range
Thanks Adrian for testing and feedback
Modified:
ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java
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=1707791&r1=1707790&r2=1707791&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 Fri Oct 9 18:49:42 2015
@@ -662,7 +662,13 @@ public class WorkEffortServices {
if (UtilValidate.isNotEmpty(partyIdsToUse) && !"WES_PUBLIC".equals(workEffort.getString("scopeEnumId")) && !partyIdsToUse.contains(workEffort.getString("partyId"))) {
continue;
}
+ // if the workeffort has actual date time, using temporal expression has no sense
+ if (UtilValidate.isNotEmpty(workEffort.getTimestamp("actualStartDate")) || UtilValidate.isNotEmpty(workEffort.getTimestamp("actualCompletionDate"))) {
+ continue;
+ }
TemporalExpression tempExpr = TemporalExpressionWorker.getTemporalExpression(delegator, workEffort.getString("tempExprId"));
+ DateRange weRange = new DateRange(workEffort.getTimestamp("estimatedStartDate"), workEffort.getTimestamp("estimatedCompletionDate"));
+
Set<Date> occurrences = tempExpr.getRange(range, cal);
for (Date occurrence : occurrences) {
for (DateRange periodRange : periodRanges) {
@@ -678,7 +684,9 @@ public class WorkEffortServices {
cloneWorkEffort.set("estimatedStartDate", periodRange.startStamp());
cloneWorkEffort.set("estimatedCompletionDate", periodRange.endStamp());
}
- inclusions.add(cloneWorkEffort);
+ if (weRange.includes(cloneWorkEffort.getTimestamp("estimatedStartDate"))) {
+ inclusions.add(cloneWorkEffort);
+ }
}
}
}