ItEr44S11CUImportarTraballoRealizadoPorSubcontrataItEr43S14: Changed end date of resource allocation tab when start constraint date is set.
This commit is contained in:
parent
46008bf9c7
commit
83710d6027
8 changed files with 45 additions and 8 deletions
|
|
@ -147,7 +147,8 @@ public class AllocationRowsHandler {
|
|||
&& !currentRows.isEmpty() && formBinder.getAssignedHours() <= 0) {
|
||||
formBinder.markAssignedHoursMustBePositive();
|
||||
}
|
||||
if (formBinder.getAllocationEnd().isBefore(
|
||||
if (calculatedValue != CalculatedValue.END_DATE
|
||||
&& formBinder.getAllocationEnd().isBefore(
|
||||
new LocalDate(task.getStartDate()))) {
|
||||
formBinder.markEndDateMustBeAfterStartDate();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -590,4 +590,9 @@ public class FormBinder {
|
|||
return sum;
|
||||
}
|
||||
|
||||
public void setStartDate(Date date) {
|
||||
taskStartDateBox.setValue(date);
|
||||
doApply();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
package org.navalplanner.web.planner.allocation;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.navalplanner.business.common.ProportionalDistributor;
|
||||
|
|
@ -72,4 +73,6 @@ public interface IResourceAllocationModel extends INewAllocationsAdder {
|
|||
|
||||
ProportionalDistributor addDefaultAllocations();
|
||||
|
||||
void setStartDate(Date date);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import static org.navalplanner.web.I18nHelper._;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
|
|
@ -70,6 +71,7 @@ import org.zkoss.zul.Row;
|
|||
import org.zkoss.zul.RowRenderer;
|
||||
import org.zkoss.zul.SimpleListModel;
|
||||
import org.zkoss.zul.Tab;
|
||||
import org.zkoss.zul.api.Tabpanel;
|
||||
|
||||
/**
|
||||
* Controller for {@link ResourceAllocation} view.
|
||||
|
|
@ -119,6 +121,8 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
|
||||
private Tab workerSearchTab;
|
||||
|
||||
private Tabpanel tabpanel;
|
||||
|
||||
public static void registerNeededScripts() {
|
||||
getScriptsRegister()
|
||||
.register(ScriptsRequiredByAdvancedAllocation.class);
|
||||
|
|
@ -132,6 +136,7 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
@Override
|
||||
public void doAfterCompose(Component comp) throws Exception {
|
||||
super.doAfterCompose(comp);
|
||||
tabpanel = (Tabpanel) comp;
|
||||
allResourcesPerDay = new Decimalbox();
|
||||
makeReadyInputsForCalculationTypes();
|
||||
prepareCalculationTypesGrid();
|
||||
|
|
@ -561,4 +566,9 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
resourceAllocationModel.accept(allocation);
|
||||
}
|
||||
|
||||
public void setStartDate(Date date) {
|
||||
resourceAllocationModel.setStartDate(date);
|
||||
formBinder.setStartDate(date);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -403,4 +403,11 @@ public class ResourceAllocationModel implements IResourceAllocationModel {
|
|||
return AggregatedHoursGroup.sum(task.getAggregatedByCriterions());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStartDate(Date date) {
|
||||
if (task != null) {
|
||||
task.setStartDate(date);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ package org.navalplanner.web.planner.taskedition;
|
|||
|
||||
import static org.navalplanner.web.I18nHelper._;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.navalplanner.business.common.exceptions.ValidationException;
|
||||
import org.navalplanner.business.planner.entities.AggregateOfResourceAllocations;
|
||||
|
|
@ -294,4 +296,18 @@ public class EditTaskController extends GenericForwardComposer {
|
|||
return (taskElement instanceof Task);
|
||||
}
|
||||
|
||||
public Date getStartConstraintDate() {
|
||||
if ((taskElement == null) || (!isTask())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return ((Task) taskElement).getStartConstraint().getConstraintDate();
|
||||
}
|
||||
|
||||
public void setStartConstraintDate(Date date) {
|
||||
if ((taskElement != null) && (isTask())) {
|
||||
resourceAllocationController.setStartDate(date);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -204,12 +204,6 @@ public class TaskPropertiesController extends GenericForwardComposer {
|
|||
.getStartConstraintType();
|
||||
startConstraintTypes.setSelectedItemApi(findComboWithType(type));
|
||||
startConstraintDate.setVisible(type.isAssociatedDateRequired());
|
||||
|
||||
Date constraintDate = task.getStartConstraint()
|
||||
.getConstraintDate();
|
||||
if (constraintDate != null) {
|
||||
startConstraintDate.setValue(constraintDate);
|
||||
}
|
||||
}
|
||||
|
||||
private Comboitem findComboWithType(StartConstraintType type) {
|
||||
|
|
|
|||
|
|
@ -91,7 +91,8 @@
|
|||
<vbox>
|
||||
<combobox id="startConstraintTypes">
|
||||
</combobox>
|
||||
<datebox id="startConstraintDate" constraint ="no empty"/>
|
||||
<datebox id="startConstraintDate" constraint ="no empty"
|
||||
value="@{editController.startConstraintDate}" />
|
||||
</vbox>
|
||||
</row>
|
||||
<row id="subcontract" visible="@{editController.isTask}">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue