ItEr17S13CUConfiguracionDeOrganizacionsDeTraballoConUnidadesTraballoItEr15S11: Checking that there's at least one HoursGroup for every OrderLine.

This commit is contained in:
Manuel Rego Casasnovas 2009-07-14 10:00:51 +02:00 committed by Javier Moran Rua
parent 5752c205fb
commit 5b7c3f45c2
2 changed files with 11 additions and 0 deletions

View file

@ -136,4 +136,9 @@ public abstract class OrderElement {
public boolean isScheduled() {
return !taskElements.isEmpty();
}
public boolean checkAtLeastOneHoursGroup() {
return (getHoursGroups().size() > 0);
}
}

View file

@ -236,6 +236,12 @@ public class OrderElementController extends GenericForwardComposer {
* managed by "save-when" at .zul file.
*/
public void back() {
if (!getOrderElement().checkAtLeastOneHoursGroup()) {
throw new WrongValueException(window
.getFellow("hoursGroupsListbox"),
"At least one HoursGroup is needed");
}
window.setVisible(false);
Util.reloadBindings(window.getParent());
}