[Bug #797] checks out that deadline is greater than start date in project popup window.
FEA : ItEr68S04BugFixing
This commit is contained in:
parent
47d92b81e4
commit
789734c3e3
3 changed files with 52 additions and 3 deletions
|
|
@ -1105,6 +1105,10 @@ public class OrderCRUDController extends GenericForwardComposer {
|
|||
Util.reloadBindings(editWindow);
|
||||
}
|
||||
|
||||
public void setCodeAutogeneratedInModel(boolean codeAutogenerated) {
|
||||
orderModel.setCodeAutogenerated(codeAutogenerated);
|
||||
}
|
||||
|
||||
public OrderStatusEnum[] getOrderStatus() {
|
||||
return OrderStatusEnum.values();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
package org.navalplanner.web.orders;
|
||||
|
||||
import static org.navalplanner.web.I18nHelper._;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
|
@ -34,8 +36,11 @@ import org.navalplanner.web.planner.tabs.MultipleTabsPlannerController;
|
|||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.Executions;
|
||||
import org.zkoss.zk.ui.SuspendNotAllowedException;
|
||||
import org.zkoss.zk.ui.WrongValueException;
|
||||
import org.zkoss.zk.ui.util.GenericForwardComposer;
|
||||
import org.zkoss.zul.ComboitemRenderer;
|
||||
import org.zkoss.zul.Constraint;
|
||||
import org.zkoss.zul.Datebox;
|
||||
import org.zkoss.zul.Grid;
|
||||
import org.zkoss.zul.Window;
|
||||
|
||||
|
|
@ -64,6 +69,10 @@ public class ProjectDetailsController extends GenericForwardComposer {
|
|||
|
||||
private Window window;
|
||||
|
||||
private Datebox initDate;
|
||||
|
||||
private Datebox deadline;
|
||||
|
||||
public ProjectDetailsController() {
|
||||
Window window = (Window) Executions.createComponents(
|
||||
"/orders/_projectDetails.zul", null,
|
||||
|
|
@ -128,7 +137,7 @@ public class ProjectDetailsController extends GenericForwardComposer {
|
|||
}
|
||||
|
||||
public void setCodeAutogenerated(boolean codeAutogenerated) {
|
||||
orderController.setCodeAutogenerated(codeAutogenerated);
|
||||
orderController.setCodeAutogeneratedInModel(codeAutogenerated);
|
||||
Util.reloadBindings(gridProjectDetails);
|
||||
}
|
||||
|
||||
|
|
@ -164,4 +173,38 @@ public class ProjectDetailsController extends GenericForwardComposer {
|
|||
order.setInitDate(new Date());
|
||||
order.setCalendar(defaultCalendar);
|
||||
}
|
||||
|
||||
public Constraint checkConstraintFinishDate() {
|
||||
return new Constraint() {
|
||||
@Override
|
||||
public void validate(Component comp, Object value)
|
||||
throws WrongValueException {
|
||||
Date finishDate = (Date) value;
|
||||
if ((finishDate != null) && (initDate.getValue() != null)
|
||||
&& (finishDate.compareTo(initDate.getValue()) < 0)) {
|
||||
deadline.setValue(null);
|
||||
getOrder().setDeadline(null);
|
||||
throw new WrongValueException(comp,
|
||||
_("must be greater than start date"));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public Constraint checkConstraintStartDate() {
|
||||
return new Constraint() {
|
||||
@Override
|
||||
public void validate(Component comp, Object value)
|
||||
throws WrongValueException {
|
||||
Date startDate = (Date) value;
|
||||
if ((startDate != null) && (deadline.getValue() != null)
|
||||
&& (startDate.compareTo(deadline.getValue()) > 0)) {
|
||||
initDate.setValue(null);
|
||||
getOrder().setInitDate(null);
|
||||
throw new WrongValueException(comp,
|
||||
_("must be lower than finish date"));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -47,11 +47,13 @@
|
|||
<row>
|
||||
<label value="${i18n:_('Starting date')}" />
|
||||
<datebox id="initDate"
|
||||
value="@{projectController.order.initDate}" />
|
||||
value="@{projectController.order.initDate}"
|
||||
constraint = "@{projectController.checkConstraintStartDate}" />
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Deadline')}" />
|
||||
<datebox id="deadline" value="@{projectController.order.deadline}" />
|
||||
<datebox id="deadline" value="@{projectController.order.deadline}"
|
||||
constraint = "@{projectController.checkConstraintFinishDate}"/>
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Customer')}" />
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue