diff --git a/src/main/java/info/bukova/isspst/services/requirement/RequirementTypeServiceImpl.java b/src/main/java/info/bukova/isspst/services/requirement/RequirementTypeServiceImpl.java index 62de731d..9b6750bf 100644 --- a/src/main/java/info/bukova/isspst/services/requirement/RequirementTypeServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/requirement/RequirementTypeServiceImpl.java @@ -21,7 +21,7 @@ public class RequirementTypeServiceImpl extends AbstractOwnedService filterCentres(RequirementType reqType, List source) { - if (!reqType.getLimitCentres()) { + if (reqType.getLimitCentres() == null || !reqType.getLimitCentres()) { return source; } diff --git a/src/main/java/info/bukova/isspst/ui/main/orders/requirements/RequirementForm.java b/src/main/java/info/bukova/isspst/ui/main/orders/requirements/RequirementForm.java index 794d0d7b..f809d82f 100644 --- a/src/main/java/info/bukova/isspst/ui/main/orders/requirements/RequirementForm.java +++ b/src/main/java/info/bukova/isspst/ui/main/orders/requirements/RequirementForm.java @@ -5,6 +5,7 @@ import info.bukova.isspst.data.Requirement; import info.bukova.isspst.data.RequirementItem; import info.bukova.isspst.data.RequirementSubject; import info.bukova.isspst.data.Workgroup; +import info.bukova.isspst.services.requirement.RequirementService; import info.bukova.isspst.services.requirement.RequirementTypeService; import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.workgroups.WorkgroupService; @@ -40,6 +41,9 @@ public class RequirementForm extends FormViewModel @WireVariable private RequirementTypeService reqTypeService; + + @WireVariable + private RequirementService requirementService; private RequirementItem selectedItem; @@ -105,6 +109,7 @@ public class RequirementForm extends FormViewModel this.setBigDecimalConverter(new BigDecimalConverter()); this.setRequirementFormValidator(new RequirementFormValidator()); this.setSyncItems(this.getDataBean().getItems()); + requirementService.loadType(getDataBean()); this.centres = reqTypeService.filterCentres(getDataBean().getType(), workgroupService.getUserCentres(userService.getCurrent())); } diff --git a/src/main/java/info/bukova/isspst/ui/requirement/TripRequirementForm.java b/src/main/java/info/bukova/isspst/ui/requirement/TripRequirementForm.java index 872a9cc1..ecaae786 100644 --- a/src/main/java/info/bukova/isspst/ui/requirement/TripRequirementForm.java +++ b/src/main/java/info/bukova/isspst/ui/requirement/TripRequirementForm.java @@ -13,6 +13,7 @@ import info.bukova.isspst.data.TripRequirement; import info.bukova.isspst.data.User; import info.bukova.isspst.data.Workgroup; import info.bukova.isspst.services.requirement.RequirementTypeService; +import info.bukova.isspst.services.requirement.TripRequirementService; import info.bukova.isspst.services.settings.GlobalSettingsService; import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.workgroups.WorkgroupService; @@ -29,6 +30,8 @@ public class TripRequirementForm extends FormViewModel { private GlobalSettingsService settingsService; @WireVariable private RequirementTypeService reqTypeService; + @WireVariable + private TripRequirementService tripRequirementService; private List centres; private List users; private List passengers; @@ -37,6 +40,7 @@ public class TripRequirementForm extends FormViewModel { @Init(superclass = true) public void init() { + tripRequirementService.loadType(getDataBean()); centres = reqTypeService.filterCentres(getDataBean().getType(), workgroupService.getUserCentres(userService.getCurrent())); users = userService.getAll(); passengers = getDataBean().getPassengers();