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 @@
- + + + + + + +