From 4e2b00a957c33863229916c4e59e2dc3c5ce2058 Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Tue, 20 Jan 2015 15:19:51 +0100 Subject: [PATCH] =?UTF-8?q?U=20po=C5=BEadavk=C5=AF=20se=20nyn=C3=AD=20zobr?= =?UTF-8?q?azuje=20fakturovan=C3=A1=20=C4=8D=C3=A1stka.=20Opraveno=20maz?= =?UTF-8?q?=C3=A1n=C3=AD=20objedn=C3=A1vek-=20pokud=20je=20mazan=C3=A1=20o?= =?UTF-8?q?bjedn=C3=A1vka=20ozna=C4=8Den=C3=A1=20jako=20objednan=C3=A1,=20?= =?UTF-8?q?mus=C3=ADme=20z=20polo=C5=BEek=20smazat=20=C4=8D=C3=ADslo=20obj?= =?UTF-8?q?edn=C3=A1vky,=20aby=20se=20nab=C3=ADdly=20pro=20dal=C5=A1=C3=AD?= =?UTF-8?q?=20objedn=C3=A1vku.=20closes=20#193?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../services/orders/OrderServiceImpl.java | 18 ++++++++++++++++++ .../requirement/RequirementService.java | 2 ++ .../requirement/RequirementServiceImpl.java | 12 ++++++++++++ .../main/orders/requirements/ReqListMyAll.java | 15 +++++++++++++++ .../orders/requirements/ReqListMyCenters.java | 15 +++++++++++++++ .../requirements/ReqListMyWorkgroups.java | 15 +++++++++++++++ .../webapp/WEB-INF/locales/zk-label.properties | 2 ++ .../main/orders/requirements/reqListMyAll.zul | 10 +++++++++- .../orders/requirements/reqListMyCenters.zul | 10 +++++++++- .../requirements/reqListMyWorkgroups.zul | 10 +++++++++- 10 files changed, 106 insertions(+), 3 deletions(-) diff --git a/src/main/java/info/bukova/isspst/services/orders/OrderServiceImpl.java b/src/main/java/info/bukova/isspst/services/orders/OrderServiceImpl.java index 42f5ab84..2e0b1e69 100644 --- a/src/main/java/info/bukova/isspst/services/orders/OrderServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/orders/OrderServiceImpl.java @@ -200,4 +200,22 @@ public class OrderServiceImpl extends AbstractOwnedService implements super.update(order); } + + @Override + @Transactional + @PreAuthorize("hasPermission(this, 'PERM_DELETE') or hasPermission(#entity, this.getDeleteEntityPermission())") + public void delete(Order order) { + for (OrderItem item : order.getItems()) + { + RequirementItem rItem = item.getReqItem(); + + if (rItem != null) + { + rItem.setOrderNum(null); + requirementItemDao.modify(rItem); + } + } + + super.delete(order); + } } diff --git a/src/main/java/info/bukova/isspst/services/requirement/RequirementService.java b/src/main/java/info/bukova/isspst/services/requirement/RequirementService.java index 770e69d1..6c99d859 100644 --- a/src/main/java/info/bukova/isspst/services/requirement/RequirementService.java +++ b/src/main/java/info/bukova/isspst/services/requirement/RequirementService.java @@ -26,4 +26,6 @@ public interface RequirementService extends RequirementBaseService public RequirementItem calcItemValuesFromItemTotal(RequirementItem item); public BigDecimal calcSumTotalFromItems(List items); + + public BigDecimal getInvoicedAmount(Requirement req); } diff --git a/src/main/java/info/bukova/isspst/services/requirement/RequirementServiceImpl.java b/src/main/java/info/bukova/isspst/services/requirement/RequirementServiceImpl.java index 87b3fdd6..a97f078d 100644 --- a/src/main/java/info/bukova/isspst/services/requirement/RequirementServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/requirement/RequirementServiceImpl.java @@ -16,6 +16,7 @@ import java.util.Date; import java.util.List; import org.hibernate.Hibernate; +import org.hibernate.Query; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; @@ -240,4 +241,15 @@ public class RequirementServiceImpl extends RequirementBaseServiceImpl protected void beforeSelectViaUrl() { BindUtils.postGlobalCommand(null, null, "selectAll", null); } + + public BigDecimal getInvoicedAmount() { + if (getDataBean() != null) { + return requirementService.getInvoicedAmount(getDataBean()); + } else { + return null; + } + } + + @Override + @NotifyChange({ "dataBean", "ableToDelete", "canApprove", "invoicedAmount" }) + public void setDataBean(Requirement data) { + super.setDataBean(data); + } } diff --git a/src/main/java/info/bukova/isspst/ui/main/orders/requirements/ReqListMyCenters.java b/src/main/java/info/bukova/isspst/ui/main/orders/requirements/ReqListMyCenters.java index 0c116134..af243b72 100644 --- a/src/main/java/info/bukova/isspst/ui/main/orders/requirements/ReqListMyCenters.java +++ b/src/main/java/info/bukova/isspst/ui/main/orders/requirements/ReqListMyCenters.java @@ -7,6 +7,7 @@ import info.bukova.isspst.services.requirement.RequirementService; import info.bukova.isspst.services.workgroups.WorkgroupService; import info.bukova.isspst.ui.requirement.RequirementSubpage; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; @@ -64,4 +65,18 @@ public class ReqListMyCenters extends RequirementSubpage protected void beforeSelectViaUrl() { BindUtils.postGlobalCommand(null, null, "selectCentre", null); } + + public BigDecimal getInvoicedAmount() { + if (getDataBean() != null) { + return requirementService.getInvoicedAmount(getDataBean()); + } else { + return null; + } + } + + @Override + @NotifyChange({ "dataBean", "ableToDelete", "canApprove", "invoicedAmount" }) + public void setDataBean(Requirement data) { + super.setDataBean(data); + } } diff --git a/src/main/java/info/bukova/isspst/ui/main/orders/requirements/ReqListMyWorkgroups.java b/src/main/java/info/bukova/isspst/ui/main/orders/requirements/ReqListMyWorkgroups.java index 90e0a2c2..22b7af87 100644 --- a/src/main/java/info/bukova/isspst/ui/main/orders/requirements/ReqListMyWorkgroups.java +++ b/src/main/java/info/bukova/isspst/ui/main/orders/requirements/ReqListMyWorkgroups.java @@ -7,6 +7,7 @@ import info.bukova.isspst.services.requirement.RequirementService; import info.bukova.isspst.services.workgroups.WorkgroupService; import info.bukova.isspst.ui.requirement.RequirementSubpage; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; @@ -64,4 +65,18 @@ public class ReqListMyWorkgroups extends RequirementSubpage protected void beforeSelectViaUrl() { BindUtils.postGlobalCommand(null, null, "selectWorkgroup", null); } + + public BigDecimal getInvoicedAmount() { + if (getDataBean() != null) { + return requirementService.getInvoicedAmount(getDataBean()); + } else { + return null; + } + } + + @Override + @NotifyChange({ "dataBean", "ableToDelete", "canApprove", "invoicedAmount" }) + public void setDataBean(Requirement data) { + super.setDataBean(data); + } } diff --git a/src/main/webapp/WEB-INF/locales/zk-label.properties b/src/main/webapp/WEB-INF/locales/zk-label.properties index 47672f56..709389c5 100644 --- a/src/main/webapp/WEB-INF/locales/zk-label.properties +++ b/src/main/webapp/WEB-INF/locales/zk-label.properties @@ -40,6 +40,8 @@ RequirementItemUnitPrice=Jedn. cena RequirementItemTotal=Celkem RequirementItemDescription=Poznámka +RequirementInvoicedAmount=Fakturovaná částka: + AgendaMyOrders=Aktuální AgendaOrdersHistory=Ukončené diff --git a/src/main/webapp/main/orders/requirements/reqListMyAll.zul b/src/main/webapp/main/orders/requirements/reqListMyAll.zul index 336536c8..7e827ccf 100644 --- a/src/main/webapp/main/orders/requirements/reqListMyAll.zul +++ b/src/main/webapp/main/orders/requirements/reqListMyAll.zul @@ -188,6 +188,14 @@
- + + + + + + +
diff --git a/src/main/webapp/main/orders/requirements/reqListMyCenters.zul b/src/main/webapp/main/orders/requirements/reqListMyCenters.zul index 336536c8..98582b47 100644 --- a/src/main/webapp/main/orders/requirements/reqListMyCenters.zul +++ b/src/main/webapp/main/orders/requirements/reqListMyCenters.zul @@ -188,6 +188,14 @@
- + + + + + + +
diff --git a/src/main/webapp/main/orders/requirements/reqListMyWorkgroups.zul b/src/main/webapp/main/orders/requirements/reqListMyWorkgroups.zul index 44a57fd7..12e32e86 100644 --- a/src/main/webapp/main/orders/requirements/reqListMyWorkgroups.zul +++ b/src/main/webapp/main/orders/requirements/reqListMyWorkgroups.zul @@ -188,6 +188,14 @@
- + + + + + + +