V agendě Procesy schválení lze u jednotlivých schvalovacích rolí nastavit, jestli bude vyžadován při schválení elektronický podpis.

closes #242
Verze_3.0
Josef Rokos 10 years ago
parent b70041bfff
commit c0922921c5

@ -1,15 +1,14 @@
package info.bukova.isspst.data; 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.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.Table; import javax.persistence.Table;
import java.math.BigDecimal;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
@Entity @Entity
@Table(name = "WORKFLOW") @Table(name = "WORKFLOW")
@ -25,6 +24,8 @@ public class Workflow extends BaseData {
private Integer wOrder; private Integer wOrder;
@Column(name = "WLIMIT", precision=15, scale=4) @Column(name = "WLIMIT", precision=15, scale=4)
private BigDecimal limit; private BigDecimal limit;
@Column(name = "SIGNATURE")
private Boolean signature;
public Boolean getCentre() { public Boolean getCentre() {
return centre; return centre;
@ -68,4 +69,11 @@ public class Workflow extends BaseData {
this.limit = limit; this.limit = limit;
} }
public Boolean getSignature() {
return signature;
}
public void setSignature(Boolean signature) {
this.signature = signature;
}
} }

@ -2,6 +2,7 @@ package info.bukova.isspst.services.requirement;
import info.bukova.isspst.data.RequirementBase; import info.bukova.isspst.data.RequirementBase;
import info.bukova.isspst.data.User; import info.bukova.isspst.data.User;
import info.bukova.isspst.data.Workflow;
import info.bukova.isspst.services.Service; import info.bukova.isspst.services.Service;
import java.util.Date; import java.util.Date;
@ -26,6 +27,7 @@ public interface RequirementBaseService<T extends RequirementBase> extends Servi
public boolean canApprove(T entity); public boolean canApprove(T entity);
public List<User> getNextApprover(T entity); public List<User> getNextApprover(T entity);
public boolean prepareSignData(T entity, Date approveDate); public boolean prepareSignData(T entity, Date approveDate);
public Workflow getNextWorkflow(T entity);
public List<T> getMy(); public List<T> getMy();

@ -150,6 +150,7 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
workflow.setLimit(w.getLimit()); workflow.setLimit(w.getLimit());
workflow.setOrder(w.getOrder()); workflow.setOrder(w.getOrder());
workflow.setRole(w.getRole()); workflow.setRole(w.getRole());
workflow.setSignature(w.getSignature());
entity.getWorkflow().add(workflow); entity.getWorkflow().add(workflow);
} }
} }
@ -277,6 +278,12 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
super.update(e); super.update(e);
if (signedPdf != null) {
saveSignedDoc(e, signedPdf);
} else if (wf.getSignature() != null && wf.getSignature()) {
throw new ApproveException("ErrApproveMustBeSigned");
}
if (!autoApprove(e, approveDate)) { if (!autoApprove(e, approveDate)) {
this.sendToApprovers(e); this.sendToApprovers(e);
@ -300,11 +307,6 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
} }
} }
if (signedPdf != null)
{
saveSignedDoc(e, signedPdf);
}
postApprove(e); postApprove(e);
} }
@ -381,7 +383,11 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
return false; return false;
} }
protected Workflow getNextWorkflow(T e) { @Override
@Transactional
public Workflow getNextWorkflow(T entity) {
T e = dao.getById(entity.getId());
AuthItem authItem = null; AuthItem authItem = null;
if (e.getWorkflow() == null) { if (e.getWorkflow() == null) {
return null; return null;

@ -33,6 +33,7 @@ public class ApproveDialogVM {
@WireVariable @WireVariable
private SessionData sessionData; private SessionData sessionData;
private boolean signed; private boolean signed;
private boolean signRequired;
private boolean timer; private boolean timer;
private byte[] signedPdf; private byte[] signedPdf;
@ -53,7 +54,14 @@ public class ApproveDialogVM {
this.grid = grid; this.grid = grid;
this.approveDate = new Date(); 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; this.timer = false;
} }
@ -103,4 +111,7 @@ public class ApproveDialogVM {
return timer; return timer;
} }
public boolean isSignRequired() {
return signRequired;
}
} }

@ -6,13 +6,6 @@ import info.bukova.isspst.data.Role;
import info.bukova.isspst.data.Workflow; import info.bukova.isspst.data.Workflow;
import info.bukova.isspst.services.requirement.RequirementTypeService; import info.bukova.isspst.services.requirement.RequirementTypeService;
import info.bukova.isspst.services.users.RoleService; 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.BindingParam;
import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.GlobalCommand; 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.Listitem;
import org.zkoss.zul.Window; 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 { public class RequirementTypesVM {
@WireVariable @WireVariable
@ -237,6 +236,18 @@ public class RequirementTypesVM {
win.doModal(); 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 @GlobalCommand
@NotifyChange("selected") @NotifyChange("selected")
public void refresh() { public void refresh() {

@ -412,3 +412,7 @@ ForeignPersons = Cizí osoby
TripBillResultMessageText = Zpráva z pracovní cesty TripBillResultMessageText = Zpráva z pracovní cesty
ErrFillTripBillResultMessageText = Vyplňte zprávu z pracovní cesty. ErrFillTripBillResultMessageText = Vyplňte zprávu z pracovní cesty.
ErrFillTripBillResultTimes = Zadejte časy odjezdu a příjezdu. 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 790 B

@ -17,12 +17,12 @@
<label value="${labels.RequirementApproveDate}"/> <label value="${labels.RequirementApproveDate}"/>
<datebox <datebox
value="@bind(vm.approveDate)" value="@bind(vm.approveDate)"
format="${labels.DateFormat}" disabled="@load(vm.signed)"/> format="${labels.DateFormat}" disabled="@load(vm.signed and vm.signRequired)"/>
</hbox> </hbox>
<separator bar="true" hflex="1"/> <separator bar="true" hflex="1"/>
<hbox> <hbox>
<button label="Podepsat" onClick="@command('signPdf')" sclass="nicebutton" disabled="@load(vm.signed)"/> <button label="Podepsat" onClick="@command('signPdf')" sclass="nicebutton" disabled="@load(vm.signed or not vm.signRequired)"/>
<button image="/img/approve-016.png" label="${labels.Confirm}" onClick="@command('approve', window=approveWin)" sclass="nicebutton" disabled="@load(not vm.signed)"/> <button image="/img/approve-016.png" label="${labels.Confirm}" onClick="@command('approve', window=approveWin)" sclass="nicebutton" disabled="@load(not vm.signed and vm.signRequired)"/>
<button image="~./zul/img/misc/drag-disallow.png" label="${labels.ButtonStorno}" onClick="approveWin.detach()" sclass="nicebutton"/> <button image="~./zul/img/misc/drag-disallow.png" label="${labels.ButtonStorno}" onClick="approveWin.detach()" sclass="nicebutton"/>
</hbox> </hbox>
</vbox> </vbox>

@ -1,5 +1,7 @@
<?page title="${labels.AgendaWorkflow}" contentType="text/html;charset=UTF-8"?> <?page title="${labels.AgendaWorkflow}" contentType="text/html;charset=UTF-8"?>
<zk> <zk xmlns="http://www.zkoss.org/2005/zul"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd">
<window border="normal" apply="org.zkoss.bind.BindComposer" <window border="normal" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.requirement.RequirementTypesVM')" viewModel="@id('vm') @init('info.bukova.isspst.ui.requirement.RequirementTypesVM')"
vflex="1"> vflex="1">
@ -63,45 +65,65 @@
<groupbox mold="3d" visible="@load(not empty vm.selected)"> <groupbox mold="3d" visible="@load(not empty vm.selected)">
<caption label="${labels.Workflow}"/> <caption label="${labels.Workflow}"/>
<vbox> <vbox>
<label value="${labels.ContextMenu}"/>
<listbox id="wgWorkflow" model="@load(vm.selected.workflow)" droppable="workgroup" <listbox id="wgWorkflow" model="@load(vm.selected.workflow)" droppable="workgroup"
onDrop="@command('addRoleWg', event=event)" onDrop="@command('addRoleWg', event=event)"
selectedItem="@bind(vm.wgSelWorkflow)"> selectedItem="@bind(vm.wgSelWorkflow)">
<listhead> <listhead>
<listheader width="50px"/>
<listheader label="${labels.WorkgroupWorkflow}"/> <listheader label="${labels.WorkgroupWorkflow}"/>
</listhead> </listhead>
<template name="model"> <template name="model">
<listitem label="@load(each.role.description)" visible="@load(not each.centre)" <listitem visible="@load(not each.centre)"
onDrop="@command('reorderWg', event=event)" draggable="workgroup" droppable="workgroup" onDrop="@command('reorderWg', event=event)" draggable="workgroup" droppable="workgroup"
context="limitPopUpWg" context="limitPopUpWg"
style="@load(empty each.limit ? '' : 'background-color: #e1fdd5')" style="@load(empty each.limit ? '' : 'background-color: #e1fdd5')"
tooltiptext="@load(empty each.limit ? '' : labels.Limit.concat(' ').concat(each.limit))"/> tooltiptext="@load(empty each.limit ? '' : labels.Limit.concat(' ').concat(each.limit))">
<listcell>
<image src="/img/money-small.png" visible="@load(not empty each.limit)"/>
<image src="/img/sign-small.png" visible="@load(each.signature)"/>
</listcell>
<listcell label="@load(each.role.description)"/>
</listitem>
</template> </template>
</listbox> </listbox>
<listbox id="centreWorkflow" model="@load(vm.selected.workflow)" droppable="centre" <listbox id="centreWorkflow" model="@load(vm.selected.workflow)" droppable="centre"
onDrop="@command('addRoleCentre', event=event)" onDrop="@command('addRoleCentre', event=event)"
selectedItem="@bind(vm.centreSelWorkflow)"> selectedItem="@bind(vm.centreSelWorkflow)">
<listhead> <listhead>
<listheader width="50px"/>
<listheader label="${labels.CentreWorkflow}"/> <listheader label="${labels.CentreWorkflow}"/>
</listhead> </listhead>
<template name="model"> <template name="model">
<listitem label="@load(each.role.description)" visible="@load(each.centre)" <listitem visible="@load(each.centre)"
onDrop="@command('reorderCentre', event=event)" draggable="centre" droppable="centre" onDrop="@command('reorderCentre', event=event)" draggable="centre" droppable="centre"
context="limitPopUp" context="limitPopUp"
style="@load(empty each.limit ? '' : 'background-color: #e1fdd5')" tooltiptext="@load(empty each.limit ? '' : labels.Limit.concat(' ').concat(each.limit))">
tooltiptext="@load(empty each.limit ? '' : labels.Limit.concat(' ').concat(each.limit))"/> <listcell>
<image src="/img/money-small.png" visible="@load(not empty each.limit)"/>
<image src="/img/sign-small.png" visible="@load(each.signature)"/>
</listcell>
<listcell label="@load(each.role.description)"/>
</listitem>
</template> </template>
</listbox> </listbox>
</vbox> </vbox>
</groupbox> </groupbox>
<menupopup id="limitPopUp"> <menupopup id="limitPopUp">
<menuitem label="${labels.OverLimit}" checkmark="true" <menuitem label="${labels.OverLimit}" checkmark="true"
checked="@load(not empty vm.centreSelWorkflow.limit)" checked="@load(not empty vm.centreSelWorkflow.limit)"
onClick="@command('overLimit', workflow=centreWorkflow.selectedItem.value)"/> onClick="@command('overLimit', workflow=centreWorkflow.selectedItem.value)"/>
<menuitem label="${labels.DigitalSignature}" checkmark="true"
checked="@load(vm.centreSelWorkflow.signature)"
onClick="@command('toggleSignature', workflow=centreWorkflow.selectedItem.value)"/>
</menupopup> </menupopup>
<menupopup id="limitPopUpWg"> <menupopup id="limitPopUpWg">
<menuitem label="${labels.OverLimit}" checkmark="true" <menuitem label="${labels.OverLimit}" checkmark="true"
checked="@load(not empty vm.wgSelWorkflow.limit)" checked="@load(not empty vm.wgSelWorkflow.limit)"
onClick="@command('overLimit', workflow=wgWorkflow.selectedItem.value)"/> onClick="@command('overLimit', workflow=wgWorkflow.selectedItem.value)"/>
<menuitem label="${labels.DigitalSignature}" checkmark="true"
checked="@load(vm.wgSelWorkflow.signature)"
onClick="@command('toggleSignature', workflow=wgWorkflow.selectedItem.value)"/>
</menupopup> </menupopup>
</div> </div>
</hbox> </hbox>

Loading…
Cancel
Save