From ba99079a859eb868b2a388582e82fe815d48fae1 Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Tue, 20 Jan 2015 10:31:30 +0100 Subject: [PATCH 1/5] =?UTF-8?q?V=20agend=C4=9B=20Fakturace=20bylo=20rozcho?= =?UTF-8?q?zeno=20filtrov=C3=A1n=C3=AD=20podle=20=C5=BEadatele.=20Odkaz=20?= =?UTF-8?q?na=20n=C3=A1pov=C4=9Bdu=20v=20toolbaru.=20Zv=C3=BD=C5=A1en=20se?= =?UTF-8?q?ssion=20timeout=20na=20480=20minut.=20refs=20#182?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../isspst/filters/InvoicingFilter.java | 4 +++- .../isspst/ui/main/approved/ApprovedList.java | 2 +- .../ui/main/invoicing/InvoicingList.java | 8 +++++++ .../WEB-INF/locales/zk-label.properties | 3 +++ src/main/webapp/WEB-INF/web.xml | 4 ++++ src/main/webapp/app/mainMenu.zul | 3 +++ src/main/webapp/app/template.zhtml | 2 +- .../webapp/main/invoicing/invoicingGrid.zul | 21 +++++++++++++++++++ 8 files changed, 44 insertions(+), 3 deletions(-) diff --git a/src/main/java/info/bukova/isspst/filters/InvoicingFilter.java b/src/main/java/info/bukova/isspst/filters/InvoicingFilter.java index 166f44f5..8573b4a5 100644 --- a/src/main/java/info/bukova/isspst/filters/InvoicingFilter.java +++ b/src/main/java/info/bukova/isspst/filters/InvoicingFilter.java @@ -4,6 +4,7 @@ import info.bukova.isspst.DateTimeUtils; import info.bukova.isspst.StringUtils; import info.bukova.isspst.data.Invoicing; import info.bukova.isspst.data.Requirement; +import info.bukova.isspst.data.User; import info.bukova.isspst.data.Workgroup; import org.hamcrest.Description; @@ -48,8 +49,9 @@ public class InvoicingFilter implements Filter boolean foundReqDate = DateTimeUtils.isEqualByDateForFilter(item.getRequirement().getReqDate(), condition.getRequirement().getReqDate()); boolean foundCenter = Workgroup.isEqualByWorkgroupForFilter(item.getRequirement().getCentre(), condition.getRequirement().getCentre()); boolean foundWorkgroup = Workgroup.isEqualByWorkgroupForFilter(item.getRequirement().getWorkgroup(), condition.getRequirement().getWorkgroup()); + boolean foundUser = User.isEqualByUserForFilter(item.getRequirement().getOwnedBy(), condition.getRequirement().getOwnedBy()); boolean foundDescription = StringUtils.isEqualForFilter(item.getRequirement().getDescription(), condition.getRequirement().getDescription()); - return (foundNumser && foundReqDate && foundCenter && foundDescription && foundWorkgroup); + return (foundNumser && foundReqDate && foundCenter && foundDescription && foundWorkgroup && foundUser); } @Factory diff --git a/src/main/java/info/bukova/isspst/ui/main/approved/ApprovedList.java b/src/main/java/info/bukova/isspst/ui/main/approved/ApprovedList.java index f708fab5..ecdfc471 100644 --- a/src/main/java/info/bukova/isspst/ui/main/approved/ApprovedList.java +++ b/src/main/java/info/bukova/isspst/ui/main/approved/ApprovedList.java @@ -85,7 +85,7 @@ public class ApprovedList extends ListViewModel public List getUsers() { - return this.userService.getAll(); + return this.userService.getUsersForCombo(); } @Command diff --git a/src/main/java/info/bukova/isspst/ui/main/invoicing/InvoicingList.java b/src/main/java/info/bukova/isspst/ui/main/invoicing/InvoicingList.java index 1c38b78a..2de94126 100644 --- a/src/main/java/info/bukova/isspst/ui/main/invoicing/InvoicingList.java +++ b/src/main/java/info/bukova/isspst/ui/main/invoicing/InvoicingList.java @@ -3,9 +3,11 @@ package info.bukova.isspst.ui.main.invoicing; import java.util.List; import info.bukova.isspst.data.Invoicing; +import info.bukova.isspst.data.User; import info.bukova.isspst.data.Workgroup; import info.bukova.isspst.filters.InvoicingFilter; import info.bukova.isspst.services.invoicing.InvoicingService; +import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.workgroups.WorkgroupService; import info.bukova.isspst.ui.ListViewModel; @@ -18,6 +20,8 @@ public class InvoicingList extends ListViewModel { private InvoicingService invoicingService; @WireVariable private WorkgroupService workgroupService; + @WireVariable + private UserService userService; @Init(superclass = true) public void initInvoicing() { @@ -45,4 +49,8 @@ public class InvoicingList extends ListViewModel { return workgroupService.getWorkgroups(); } + public List getUsers() { + return userService.getUsersForCombo(); + } + } diff --git a/src/main/webapp/WEB-INF/locales/zk-label.properties b/src/main/webapp/WEB-INF/locales/zk-label.properties index f4ccef91..7fe9c936 100644 --- a/src/main/webapp/WEB-INF/locales/zk-label.properties +++ b/src/main/webapp/WEB-INF/locales/zk-label.properties @@ -358,3 +358,6 @@ WorkgroupFormCannotAddUser=Uživatele nelze přidat WorkgroupFormCannotAddWorkgroup=Komisi nelze přidat WorkgroupFormOrderLimit=Limit nákupů WorkgroupIsInWorkgroup=Komisi nelze smazat, protože je členem některého střediska + +GoogleDriveUrl=Odkaz na Google Drive +Help=Pomoc diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index da4c395b..442da6bb 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -187,6 +187,10 @@ /* + + 480 + + index.zul index.zhtml diff --git a/src/main/webapp/app/mainMenu.zul b/src/main/webapp/app/mainMenu.zul index 91bfcf0d..dc706c94 100644 --- a/src/main/webapp/app/mainMenu.zul +++ b/src/main/webapp/app/mainMenu.zul @@ -133,5 +133,8 @@ href="/j_spring_security_logout" /> + \ No newline at end of file diff --git a/src/main/webapp/app/template.zhtml b/src/main/webapp/app/template.zhtml index bca9beb4..2bdf230c 100644 --- a/src/main/webapp/app/template.zhtml +++ b/src/main/webapp/app/template.zhtml @@ -51,6 +51,6 @@
- + \ No newline at end of file diff --git a/src/main/webapp/main/invoicing/invoicingGrid.zul b/src/main/webapp/main/invoicing/invoicingGrid.zul index c2fdd775..53ae6fa6 100644 --- a/src/main/webapp/main/invoicing/invoicingGrid.zul +++ b/src/main/webapp/main/invoicing/invoicingGrid.zul @@ -123,6 +123,27 @@ + +
+
+ + + +
+
+ +
+
+
From d9fd26bbadba009d675955f778d27d504d90cc41 Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Tue, 20 Jan 2015 14:11:59 +0100 Subject: [PATCH 2/5] =?UTF-8?q?Ve=20schv=C3=A1len=C3=BDch=20polo=C5=BEk?= =?UTF-8?q?=C3=A1ch=20po=C5=BEadavk=C5=AF=20byl=20do=20gridu=20p=C5=99idan?= =?UTF-8?q?=C3=BD=20sloupec=20s=20=C4=8D=C3=ADslem=20po=C5=BEadavku.=20clo?= =?UTF-8?q?ses=20#192?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WEB-INF/locales/zk-label.properties | 2 +- src/main/webapp/main/orders/approved/grid.zul | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/main/webapp/WEB-INF/locales/zk-label.properties b/src/main/webapp/WEB-INF/locales/zk-label.properties index 7fe9c936..47672f56 100644 --- a/src/main/webapp/WEB-INF/locales/zk-label.properties +++ b/src/main/webapp/WEB-INF/locales/zk-label.properties @@ -360,4 +360,4 @@ WorkgroupFormOrderLimit=Limit nákupů WorkgroupIsInWorkgroup=Komisi nelze smazat, protože je členem některého střediska GoogleDriveUrl=Odkaz na Google Drive -Help=Pomoc +Help=Příručka diff --git a/src/main/webapp/main/orders/approved/grid.zul b/src/main/webapp/main/orders/approved/grid.zul index 77bbc099..33d27a2d 100644 --- a/src/main/webapp/main/orders/approved/grid.zul +++ b/src/main/webapp/main/orders/approved/grid.zul @@ -32,6 +32,10 @@ + @@ -82,6 +86,21 @@ +
+
+ +
+
+ +
+
+
+
+ From 4e2b00a957c33863229916c4e59e2dc3c5ce2058 Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Tue, 20 Jan 2015 15:19:51 +0100 Subject: [PATCH 3/5] =?UTF-8?q?U=20po=C5=BEadavk=C5=AF=20se=20nyn=C3=AD=20?= =?UTF-8?q?zobrazuje=20fakturovan=C3=A1=20=C4=8D=C3=A1stka.=20Opraveno=20m?= =?UTF-8?q?az=C3=A1n=C3=AD=20objedn=C3=A1vek-=20pokud=20je=20mazan=C3=A1?= =?UTF-8?q?=20objedn=C3=A1vka=20ozna=C4=8Den=C3=A1=20jako=20objednan=C3=A1?= =?UTF-8?q?,=20mus=C3=ADme=20z=20polo=C5=BEek=20smazat=20=C4=8D=C3=ADslo?= =?UTF-8?q?=20objedn=C3=A1vky,=20aby=20se=20nab=C3=ADdly=20pro=20dal=C5=A1?= =?UTF-8?q?=C3=AD=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 @@
- + + + + + + +
From ecbc2be47c29fbb690eea526cb6fcbdaca6b12af Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Wed, 21 Jan 2015 10:59:15 +0100 Subject: [PATCH 4/5] =?UTF-8?q?V=20agend=C4=9B=20Fakturace=20po=C5=BEadavk?= =?UTF-8?q?=C5=AF=20byl=20opraven=20lazy=20load=20vlastn=C3=ADka=20po?= =?UTF-8?q?=C5=BEadavku.=20refs=20#182?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../isspst/services/invoicing/InvoicingServiceImpl.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/info/bukova/isspst/services/invoicing/InvoicingServiceImpl.java b/src/main/java/info/bukova/isspst/services/invoicing/InvoicingServiceImpl.java index 9fb504b9..d7263af3 100644 --- a/src/main/java/info/bukova/isspst/services/invoicing/InvoicingServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/invoicing/InvoicingServiceImpl.java @@ -64,5 +64,13 @@ public class InvoicingServiceImpl extends AbstractOwnedService implem Query q = dao.getQuery("select inv from Invoicing as inv join fetch inv.requirement rq join fetch rq.ownedBy order by rq.numser"); return q.list(); } + + @Transactional + @LazyLoader("form") + public void loadOwnedBy(Invoicing invoice) { + Invoicing inv = getById(invoice.getId()); + Hibernate.initialize(inv.getRequirement().getOwnedBy()); + invoice.getRequirement().setOwnedBy(inv.getRequirement().getOwnedBy()); + } } From 884bc8267d050a5e848e73b4c5e10828c429e9d0 Mon Sep 17 00:00:00 2001 From: Franta Pribyl Date: Mon, 9 Feb 2015 13:27:32 +0100 Subject: [PATCH 5/5] =?UTF-8?q?U=20nov=C3=BDch=20objedn=C3=A1vek=20lze=20n?= =?UTF-8?q?yn=C3=AD=20zatrhout,=20=C5=BEe=20je=20rovnou=20objedn=C3=A1no..?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes #196 --- .../isspst/services/orders/OrderService.java | 2 ++ .../services/orders/OrderServiceImpl.java | 22 +++++++++++++++---- .../ui/main/orders/created/OrderForm.java | 11 ++++++++++ 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/main/java/info/bukova/isspst/services/orders/OrderService.java b/src/main/java/info/bukova/isspst/services/orders/OrderService.java index 1fe1e0c2..89a99112 100644 --- a/src/main/java/info/bukova/isspst/services/orders/OrderService.java +++ b/src/main/java/info/bukova/isspst/services/orders/OrderService.java @@ -22,5 +22,7 @@ public interface OrderService extends Service { public BigDecimal calcSumTotalFromItems(List items); + public void addApprovedItems(Order order, boolean orderedChanged); + public void updateApprovedItems(Order order, boolean orderedChanged); } 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 2e0b1e69..801cf13c 100644 --- a/src/main/java/info/bukova/isspst/services/orders/OrderServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/orders/OrderServiceImpl.java @@ -180,16 +180,14 @@ public class OrderServiceImpl extends AbstractOwnedService implements return sumTotal; } - @Transactional - @PreAuthorize("hasPermission(this, 'PERM_EDIT') or hasPermission(#entity, this.getUpdateEntityPermission())") - public void updateApprovedItems(Order order, boolean orderedChanged) + protected void setApprovedItems(Order order, boolean orderedChanged) { if (orderedChanged) { for (OrderItem item : order.getItems()) { RequirementItem rItem = item.getReqItem(); - + if (rItem != null) { rItem.setOrderNum(order.isOrdered() ? order.getNumser() : null); @@ -197,7 +195,23 @@ public class OrderServiceImpl extends AbstractOwnedService implements } } } + } + + @Override + @Transactional + @PreAuthorize("hasPermission(this, 'PERM_ADD')") + public void addApprovedItems(Order order, boolean orderedChanged) + { + this.add(order); + this.setApprovedItems(order, orderedChanged); + } + @Override + @Transactional + @PreAuthorize("hasPermission(this, 'PERM_EDIT') or hasPermission(#entity, this.getUpdateEntityPermission())") + public void updateApprovedItems(Order order, boolean orderedChanged) + { + this.setApprovedItems(order, orderedChanged); super.update(order); } diff --git a/src/main/java/info/bukova/isspst/ui/main/orders/created/OrderForm.java b/src/main/java/info/bukova/isspst/ui/main/orders/created/OrderForm.java index a2773232..e0a82d1a 100644 --- a/src/main/java/info/bukova/isspst/ui/main/orders/created/OrderForm.java +++ b/src/main/java/info/bukova/isspst/ui/main/orders/created/OrderForm.java @@ -297,6 +297,17 @@ public class OrderForm extends FormViewModel this.calcAndUpdateFormTotalPrice(form); } + @Override + protected void doAdd() + { + // Zjisti, zda se změnil příznak objednávky (objednáno/neobjednáno) + boolean orderedChanged = (this.recordBeforeEdit.isOrdered() != this.getDataBean().isOrdered()); + // Aktualizovat příznak schválených položek, aby se nemohli vložit do + // jiných objednávek + orderService.addApprovedItems(this.getDataBean(), orderedChanged); + BindUtils.postGlobalCommand(null, null, "reload", null); + } + @Override protected void doSave() {