From c0922921c5faadf0b009e746e856a981bdd272b8 Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Sat, 11 Jul 2015 01:05:41 +0200 Subject: [PATCH] =?UTF-8?q?V=20agend=C4=9B=20Procesy=20schv=C3=A1len=C3=AD?= =?UTF-8?q?=20lze=20u=20jednotliv=C3=BDch=20schvalovac=C3=ADch=20rol=C3=AD?= =?UTF-8?q?=20nastavit,=20jestli=20bude=20vy=C5=BEadov=C3=A1n=20p=C5=99i?= =?UTF-8?q?=20schv=C3=A1len=C3=AD=20elektronick=C3=BD=20podpis.=20closes?= =?UTF-8?q?=20#242?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../info/bukova/isspst/data/Workflow.java | 18 +++++--- .../requirement/RequirementBaseService.java | 2 + .../RequirementBaseServiceImpl.java | 20 ++++++--- .../isspst/ui/main/ApproveDialogVM.java | 13 +++++- .../ui/requirement/RequirementTypesVM.java | 25 ++++++++--- .../WEB-INF/locales/zk-label.properties | 4 ++ src/main/webapp/img/sign-small.png | Bin 0 -> 790 bytes src/main/webapp/main/approveDialog.zul | 6 +-- .../webapp/settings/workflow/workflow.zul | 42 +++++++++++++----- 9 files changed, 97 insertions(+), 33 deletions(-) create mode 100644 src/main/webapp/img/sign-small.png diff --git a/src/main/java/info/bukova/isspst/data/Workflow.java b/src/main/java/info/bukova/isspst/data/Workflow.java index ac489428..e6248890 100644 --- a/src/main/java/info/bukova/isspst/data/Workflow.java +++ b/src/main/java/info/bukova/isspst/data/Workflow.java @@ -1,15 +1,14 @@ package info.bukova.isspst.data; -import java.math.BigDecimal; +import org.hibernate.annotations.LazyCollection; +import org.hibernate.annotations.LazyCollectionOption; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; - -import org.hibernate.annotations.LazyCollection; -import org.hibernate.annotations.LazyCollectionOption; +import java.math.BigDecimal; @Entity @Table(name = "WORKFLOW") @@ -24,7 +23,9 @@ public class Workflow extends BaseData { @Column(name = "WORDER") private Integer wOrder; @Column(name = "WLIMIT", precision=15, scale=4) - private BigDecimal limit; + private BigDecimal limit; + @Column(name = "SIGNATURE") + private Boolean signature; public Boolean getCentre() { return centre; @@ -68,4 +69,11 @@ public class Workflow extends BaseData { this.limit = limit; } + public Boolean getSignature() { + return signature; + } + + public void setSignature(Boolean signature) { + this.signature = signature; + } } diff --git a/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseService.java b/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseService.java index 860c4044..99b6834e 100644 --- a/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseService.java +++ b/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseService.java @@ -2,6 +2,7 @@ package info.bukova.isspst.services.requirement; import info.bukova.isspst.data.RequirementBase; import info.bukova.isspst.data.User; +import info.bukova.isspst.data.Workflow; import info.bukova.isspst.services.Service; import java.util.Date; @@ -26,6 +27,7 @@ public interface RequirementBaseService extends Servi public boolean canApprove(T entity); public List getNextApprover(T entity); public boolean prepareSignData(T entity, Date approveDate); + public Workflow getNextWorkflow(T entity); public List getMy(); diff --git a/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java b/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java index 93427584..753e344a 100644 --- a/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java @@ -150,6 +150,7 @@ public abstract class RequirementBaseServiceImpl exte workflow.setLimit(w.getLimit()); workflow.setOrder(w.getOrder()); workflow.setRole(w.getRole()); + workflow.setSignature(w.getSignature()); entity.getWorkflow().add(workflow); } } @@ -277,6 +278,12 @@ public abstract class RequirementBaseServiceImpl exte super.update(e); + if (signedPdf != null) { + saveSignedDoc(e, signedPdf); + } else if (wf.getSignature() != null && wf.getSignature()) { + throw new ApproveException("ErrApproveMustBeSigned"); + } + if (!autoApprove(e, approveDate)) { this.sendToApprovers(e); @@ -300,11 +307,6 @@ public abstract class RequirementBaseServiceImpl exte } } - if (signedPdf != null) - { - saveSignedDoc(e, signedPdf); - } - postApprove(e); } @@ -380,8 +382,12 @@ public abstract class RequirementBaseServiceImpl exte return false; } - - protected Workflow getNextWorkflow(T e) { + + @Override + @Transactional + public Workflow getNextWorkflow(T entity) { + T e = dao.getById(entity.getId()); + AuthItem authItem = null; if (e.getWorkflow() == null) { return null; diff --git a/src/main/java/info/bukova/isspst/ui/main/ApproveDialogVM.java b/src/main/java/info/bukova/isspst/ui/main/ApproveDialogVM.java index da74d6f8..3433900e 100644 --- a/src/main/java/info/bukova/isspst/ui/main/ApproveDialogVM.java +++ b/src/main/java/info/bukova/isspst/ui/main/ApproveDialogVM.java @@ -33,6 +33,7 @@ public class ApproveDialogVM { @WireVariable private SessionData sessionData; private boolean signed; + private boolean signRequired; private boolean timer; private byte[] signedPdf; @@ -53,7 +54,14 @@ public class ApproveDialogVM { this.grid = grid; this.approveDate = new Date(); - this.signed = false; + if (service.getNextWorkflow(requirement).getSignature() != null + && service.getNextWorkflow(requirement).getSignature()) { + this.signed = false; + this.signRequired = true; + } else { + this.signRequired = false; + } + this.timer = false; } @@ -103,4 +111,7 @@ public class ApproveDialogVM { return timer; } + public boolean isSignRequired() { + return signRequired; + } } diff --git a/src/main/java/info/bukova/isspst/ui/requirement/RequirementTypesVM.java b/src/main/java/info/bukova/isspst/ui/requirement/RequirementTypesVM.java index 279b8e7d..31a19d5a 100644 --- a/src/main/java/info/bukova/isspst/ui/requirement/RequirementTypesVM.java +++ b/src/main/java/info/bukova/isspst/ui/requirement/RequirementTypesVM.java @@ -6,13 +6,6 @@ import info.bukova.isspst.data.Role; import info.bukova.isspst.data.Workflow; import info.bukova.isspst.services.requirement.RequirementTypeService; import info.bukova.isspst.services.users.RoleService; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import org.zkoss.bind.annotation.BindingParam; import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.GlobalCommand; @@ -24,6 +17,12 @@ import org.zkoss.zk.ui.select.annotation.WireVariable; import org.zkoss.zul.Listitem; import org.zkoss.zul.Window; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + public class RequirementTypesVM { @WireVariable @@ -236,6 +235,18 @@ public class RequirementTypesVM { Window win = (Window) Executions.createComponents("/settings/workflow/limit.zul", null, params); win.doModal(); } + + @Command + @NotifyChange({"selected", "centreSelWorkflow", "wgSelWorkflow"}) + public void toggleSignature(@BindingParam("workflow") Workflow workflow) { + if (workflow.getSignature() != null && workflow.getSignature()) { + workflow.setSignature(false); + } else { + workflow.setSignature(true); + } + + reqTypeService.update(selected); + } @GlobalCommand @NotifyChange("selected") diff --git a/src/main/webapp/WEB-INF/locales/zk-label.properties b/src/main/webapp/WEB-INF/locales/zk-label.properties index 535c0d1b..1df6aba3 100644 --- a/src/main/webapp/WEB-INF/locales/zk-label.properties +++ b/src/main/webapp/WEB-INF/locales/zk-label.properties @@ -412,3 +412,7 @@ ForeignPersons = Cizí osoby TripBillResultMessageText = Zpráva z pracovní cesty ErrFillTripBillResultMessageText = Vyplňte zprávu z pracovní cesty. ErrFillTripBillResultTimes = Zadejte časy odjezdu a příjezdu. + +ErrApproveMustBeSigned = Schválení musí být digitálně podepsané. +DigitalSignature = Elektronický podpis +ContextMenu = Volby v kontextovém menu diff --git a/src/main/webapp/img/sign-small.png b/src/main/webapp/img/sign-small.png new file mode 100644 index 0000000000000000000000000000000000000000..8834f3f5923898a7e258d73f69a13a23c9f325ca GIT binary patch literal 790 zcmV+x1L^#UP)!`Q15b@fzyDt0{Q2Vu7Xu%Q3rHtG0I`4wU9l|~cCrHXU4J9Y@QYCv=t6!iLwA#v zKmR@FynAE;0|UPW1H)(O0+2d@00JAJAaEVS01h?=hI{X&7{34J7Sp#gUnDBUFSdJ8 zHvZ4g8u^XZw6+0E!8PHCT7OR*UV=4{r>~dH>x)n zzJ6ybDa1tk`15dZ)H07*qoM6N<$g32FRjsO4v literal 0 HcmV?d00001 diff --git a/src/main/webapp/main/approveDialog.zul b/src/main/webapp/main/approveDialog.zul index cd803199..b4645ece 100644 --- a/src/main/webapp/main/approveDialog.zul +++ b/src/main/webapp/main/approveDialog.zul @@ -17,12 +17,12 @@