Author: pgil
Date: Fri Oct 9 18:51:29 2015
New Revision: 1707793
URL:
http://svn.apache.org/viewvc?rev=1707793&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/branches/release13.07/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java
Modified: ofbiz/branches/release13.07/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java?rev=1707793&r1=1707792&r2=1707793&view=diff==============================================================================
--- ofbiz/branches/release13.07/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java (original)
+++ ofbiz/branches/release13.07/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java Fri Oct 9 18:51:29 2015
@@ -676,7 +676,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) {
@@ -692,7 +698,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);
+ }
}
}
}