From 3944232a98bbdef9b0138b5ebdbfe8be5ac9a35d Mon Sep 17 00:00:00 2001 From: Javier Moran Rua Date: Sat, 13 Oct 2012 17:36:41 +0200 Subject: [PATCH] Adds margins additional to task limits(start, end) for default load ratios calculation in resource allocation advance search. Two margins have been added: * A margin before the task start date. * A margin after the task end date. The time used in these two margins has been the same and is equal to 30 days. FEA: ItEr77S10ResourceAllocationLoadInformation --- .../components/NewAllocationSelector.java | 2 ++ .../ResourceAllocationController.java | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/NewAllocationSelector.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/NewAllocationSelector.java index c61b06873..f6c529c36 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/NewAllocationSelector.java +++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/NewAllocationSelector.java @@ -45,6 +45,8 @@ import org.zkoss.zul.Radiogroup; @SuppressWarnings("serial") public class NewAllocationSelector extends AllocationSelector { + public static final int DAYS_LEAD_LAG_TO_TASK_LIMITS_DATES_FILTERING_INITIALIZATION = 30; + private NewAllocationSelectorController selectorController; private ResourceAllocationBehaviour behaviour; diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/ResourceAllocationController.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/ResourceAllocationController.java index c0144bbea..6a07051b9 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/ResourceAllocationController.java +++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/ResourceAllocationController.java @@ -31,6 +31,7 @@ import java.util.List; import org.apache.commons.lang.Validate; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.joda.time.LocalDate; import org.libreplan.business.orders.entities.AggregatedHoursGroup; import org.libreplan.business.planner.entities.CalculatedValue; import org.libreplan.business.planner.entities.DerivedAllocation; @@ -322,10 +323,18 @@ public class ResourceAllocationController extends GenericForwardComposer { } public void goToAdvancedSearch() { - newAllocationSelector.setStartFilteringDate(resourceAllocationModel - .getTaskStart()); - newAllocationSelector.setEndFilteringDate(resourceAllocationModel - .getTaskEnd()); + newAllocationSelector + .setStartFilteringDate(LocalDate + .fromDateFields(resourceAllocationModel.getTaskStart()) + .minusDays( + NewAllocationSelector.DAYS_LEAD_LAG_TO_TASK_LIMITS_DATES_FILTERING_INITIALIZATION) + .toDateTimeAtStartOfDay().toDate()); + newAllocationSelector + .setEndFilteringDate(LocalDate + .fromDateFields(resourceAllocationModel.getTaskEnd()) + .plusDays( + NewAllocationSelector.DAYS_LEAD_LAG_TO_TASK_LIMITS_DATES_FILTERING_INITIALIZATION) + .toDateTimeAtStartOfDay().toDate()); applyButton.setVisible(false); workerSearchTab.setSelected(true); // The initial search and ratio load calculations is raised