Fixed issue regarding using labels and dates at the same time
FEA: ItEr77S15FilteringEnhancements
This commit is contained in:
parent
80f84d22ea
commit
6936dd2ff1
3 changed files with 31 additions and 30 deletions
|
|
@ -30,6 +30,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.libreplan.business.common.entities.ProgressType;
|
||||
import org.libreplan.business.common.exceptions.InstanceNotFoundException;
|
||||
import org.libreplan.business.planner.entities.TaskElement;
|
||||
|
|
@ -185,6 +186,23 @@ public class CompanyPlanningController implements Composer {
|
|||
.getFinderPattern(), user
|
||||
.getProjectsFilterLabel()));
|
||||
}
|
||||
|
||||
// Calculate filter based on user preferences
|
||||
if (user != null) {
|
||||
if (filterStartDate.getValue() == null
|
||||
&& (user.getProjectsFilterPeriodSince() != null)) {
|
||||
filterStartDate.setValue(new LocalDate()
|
||||
.minusMonths(user.getProjectsFilterPeriodSince())
|
||||
.toDateTimeAtStartOfDay().toDate());
|
||||
}
|
||||
if (filterFinishDate.getValue() == null
|
||||
&& (user.getProjectsFilterPeriodTo() != null)) {
|
||||
filterFinishDate.setValue(new LocalDate()
|
||||
.plusMonths(user.getProjectsFilterPeriodTo())
|
||||
.toDateMidnight().toDate());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -343,12 +361,10 @@ public class CompanyPlanningController implements Composer {
|
|||
IPredicate predicate = model.getDefaultPredicate(includeOrderElements);
|
||||
//show filter dates calculated by default on screen
|
||||
if(model.getFilterStartDate() != null) {
|
||||
filterStartDate.setValue(model.getFilterStartDate().
|
||||
toDateMidnight().toDate());
|
||||
filterStartDate.setValue(model.getFilterStartDate());
|
||||
}
|
||||
if(model.getFilterFinishDate() != null) {
|
||||
filterFinishDate.setValue(model.getFilterFinishDate().
|
||||
toDateMidnight().toDate());
|
||||
filterFinishDate.setValue(model.getFilterFinishDate());
|
||||
}
|
||||
|
||||
return predicate;
|
||||
|
|
|
|||
|
|
@ -745,23 +745,6 @@ public class CompanyPlanningModel implements ICompanyPlanningModel {
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
// Calculate filter based on user preferences
|
||||
if (user != null) {
|
||||
if (calculateStartDate
|
||||
&& (user.getProjectsFilterPeriodSince() != null)) {
|
||||
startDate = new LocalDate()
|
||||
.minusMonths(user.getProjectsFilterPeriodSince())
|
||||
.toDateTimeAtStartOfDay().toDate();
|
||||
calculateStartDate = false;
|
||||
}
|
||||
if (calculateEndDate && (user.getProjectsFilterPeriodTo() != null)) {
|
||||
endDate = new LocalDate()
|
||||
.plusMonths(user.getProjectsFilterPeriodTo())
|
||||
.toDateMidnight().toDate();
|
||||
calculateEndDate = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Filter predicate needs to be calculated based on the projects dates
|
||||
if ((calculateStartDate) || (calculateEndDate)) {
|
||||
if (currentScenario == null) {
|
||||
|
|
@ -807,18 +790,19 @@ public class CompanyPlanningModel implements ICompanyPlanningModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LocalDate getFilterStartDate() {
|
||||
return filterStartDate;
|
||||
public Date getFilterStartDate() {
|
||||
return ((filterStartDate == null) ? null : filterStartDate
|
||||
.toDateTimeAtStartOfDay().toDate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocalDate getFilterFinishDate() {
|
||||
return filterFinishDate;
|
||||
public Date getFilterFinishDate() {
|
||||
return ((filterStartDate == null) ? null : filterFinishDate
|
||||
.toDateMidnight().toDate());
|
||||
}
|
||||
|
||||
private AvailabilityTimeLine.Interval getFilterInterval() {
|
||||
return AvailabilityTimeLine.Interval.create(getFilterStartDate(),
|
||||
getFilterFinishDate());
|
||||
return AvailabilityTimeLine.Interval.create(filterStartDate,
|
||||
filterFinishDate);
|
||||
}
|
||||
|
||||
private class CompanyLoadChartFiller extends StandardLoadChartFiller {
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
package org.libreplan.web.planner.company;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.libreplan.business.common.entities.ProgressType;
|
||||
|
|
@ -45,9 +46,9 @@ public interface ICompanyPlanningModel {
|
|||
|
||||
public void setTabsController(MultipleTabsPlannerController tabsController);
|
||||
|
||||
LocalDate getFilterStartDate();
|
||||
Date getFilterStartDate();
|
||||
|
||||
LocalDate getFilterFinishDate();
|
||||
Date getFilterFinishDate();
|
||||
|
||||
ProgressType getProgressTypeFromConfiguration();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue