From 13f35611fd885b3a55d741388580adbcd623e0fa Mon Sep 17 00:00:00 2001 From: Franta Pribyl Date: Mon, 20 Oct 2014 08:26:10 +0200 Subject: [PATCH] =?UTF-8?q?Kdy=C5=BE=20se=20p=C5=99id=C3=A1v=C3=A1=20polo?= =?UTF-8?q?=C5=BEka=20po=C5=BEadavku=20(skupina=20materi=C3=A1lu/slu=C5=BE?= =?UTF-8?q?by)=20p=C5=99es=20combo,=20tak=20se=20p=C5=99enese=20i=20m?= =?UTF-8?q?=C4=9Brn=C3=A1=20jednotka.=20M=C4=9Brnou=20jednotku=20lze=20zm?= =?UTF-8?q?=C4=9Bnit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes #157 --- .../ui/main/orders/requirements/RequirementForm.java | 12 +++++++++++- src/main/webapp/main/orders/requirements/reqForm.zul | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) 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 2c36d4fe..1d7d4a0a 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 @@ -1,5 +1,6 @@ package info.bukova.isspst.ui.main.orders.requirements; +import info.bukova.isspst.data.MUnitEmb; import info.bukova.isspst.data.Material; import info.bukova.isspst.data.Requirement; import info.bukova.isspst.data.RequirementItem; @@ -234,6 +235,15 @@ public class RequirementForm extends FormViewModel if (subject != null) { + boolean isMaterial = (subject instanceof Material); + + if (isMaterial) + { + Material materialItem = (Material) subject; + MUnitEmb munit = materialItem.getMunit(); + this.selectedItem.setMunit(munit); + } + // Skupina materiálu nebo služeb je propojená, nastavit k zadanému // kódu i správný název skupiny materiálu nebo služby this.selectedItem.setName(subject.getName()); @@ -254,7 +264,7 @@ public class RequirementForm extends FormViewModel item.setUnitPrice(BigDecimal.valueOf(0)); item.setTotal(BigDecimal.valueOf(0)); item.setDescription(""); - item.setMunit(null); + item.setMunit(new MUnitEmb()); this.setSelectedItem(item); this.getDataBean().addItem(item); diff --git a/src/main/webapp/main/orders/requirements/reqForm.zul b/src/main/webapp/main/orders/requirements/reqForm.zul index 9a2a10f2..4894234c 100644 --- a/src/main/webapp/main/orders/requirements/reqForm.zul +++ b/src/main/webapp/main/orders/requirements/reqForm.zul @@ -174,7 +174,7 @@