21 Commits

Author SHA1 Message Date
pepa cd6a6cf5a6 Přidaná sestava "Protokol o kontrole" - digitální podpis při schvalování nákupů. 2015-09-07 22:08:21 +02:00
pepa d1ccaf530d Při napojování uživatele z AD se login převede na malá písmena. Opravena chyba při mazání uživatele.
closes #237
2015-08-18 22:21:05 +02:00
pepa 10439b5001 Merge branch 'master' of https://git.bukova.info/repos/git/isspst 2015-08-08 22:53:15 +02:00
pepa b33f9f2e8a Pokud se upraví požadavek, u kterého je podepsaný dokument, tak se dokument smaže a požadavek se nastaví jako nový.
closes #227
2015-08-08 22:52:10 +02:00
franta 07d0949bea Merge branch 'master' of https://git.bukova.info/repos/git/isspst 2015-07-14 20:21:10 +02:00
franta 2819cc125c Implementován validátor pro Globální nastavení.
closes #236
2015-07-14 20:17:32 +02:00
pepa c0922921c5 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
2015-07-11 01:05:41 +02:00
pepa b70041bfff Změněn způsob ukládání PDF dokumentu. Data se předávájí ve ViewModelu, tak nemůže dojít k tomu, že by se schválením jiného záznamu v druhém okně prohlížeče uložilo jiné PDF.
refs #243
2015-07-10 15:29:44 +02:00
pepa b5ffa07644 Aktualizace podepisovací aplikace- opraveno náhodné zatuhnutí po startu.
refs #224
2015-07-09 08:22:32 +02:00
pepa cccd8177fa Implementace uložiště podepsaných dokumentů. Při prvním podpisu se uloží podepsané PDF a vytvoří se záznam v agendě podepsaných dokumentů.
closes #243
2015-07-08 12:55:41 +02:00
pepa 6db416dd04 Vyřešeno generování PDF pro podpis na základě entity, která se schvaluje.
closes #240
2015-07-03 13:36:23 +02:00
pepa 05faa87071 Digitální podpis se zobrazí v PDF viditelně. Server předá podepisovací aplikaci ID fieldu, kde se podpis zobrazí. ID je zadáno v reportu jaku parametr pole signature.
refs #224
2015-07-02 14:12:26 +02:00
pepa 11e3a48b28 Ve windows se spustí podepisovací aplikace, která si bere certifikáty ze systémového uložiště.
refs #224
2015-06-25 13:08:06 +02:00
pepa d7999e78ca Merge remote-tracking branch 'origin/master' 2015-06-24 12:54:57 +02:00
pepa d6cff454fd Základní implementace podepisování PDF dokumentů. Podpis implementován pouze pro sestavu schválení služební cesty (natvrdo v kódu). Spouští se univerzální podepisovací aplikace, která čte certifikát ze souboru.
closes #224
2015-06-24 12:54:31 +02:00
franta 1d30f0d0c7 Merge branch 'master' of https://git.bukova.info/repos/git/isspst 2015-06-24 10:16:36 +02:00
franta 9fb1ef7601 Přidána základní funkčnost zobrazování dat agendy.
refs #225
2015-06-24 10:14:21 +02:00
pepa 312b62af7b Merge branch 'Verze_2.0' 2015-06-21 00:36:08 +02:00
pepa 162cea6001 Merge branch 'Verze_2.0' 2015-06-15 21:18:14 +02:00
pepa 1164e11107 Merge branch 'master' of https://git.bukova.info/repos/git/isspst 2015-06-13 00:07:05 +02:00
franta c9a56887dc Připraveny podklady pro novou agendu "Podepsané dokumenty"
Vzhled agendy (grid/strom/...) zatím není znám.

closes #222
2015-06-04 14:19:54 +02:00
73 changed files with 3200 additions and 333 deletions
+79
View File
@@ -0,0 +1,79 @@
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 16464111046498525641 (0xe47c45c4252121c9)
Signature Algorithm: sha1WithRSAEncryption
Issuer: C=CZ, ST=Vysocina, O=bukova.info, CN=Josef Rokos/emailAddress=rokos@bukova.info
Validity
Not Before: Jun 24 09:59:50 2015 GMT
Not After : Jun 21 09:59:50 2025 GMT
Subject: C=CZ, ST=Vysocina, O=bukova.info, CN=Josef Rokos/emailAddress=rokos@bukova.info
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (2048 bit)
Modulus:
00:bc:fb:64:50:5b:58:03:8c:20:1c:77:d3:50:31:
94:55:78:d6:05:bb:bc:88:9d:cb:20:b1:8c:ff:ac:
fc:97:1a:b1:9c:29:c4:ac:af:ed:3b:de:93:d5:cf:
75:3e:d0:05:41:32:bf:12:25:53:60:28:af:ff:3e:
3c:3a:4c:52:78:3f:b2:78:b9:c6:2f:fc:0e:44:eb:
65:c3:7f:38:2b:ab:88:37:8c:68:55:69:e3:3d:5e:
9b:99:25:11:55:06:ab:e8:c1:fa:54:da:5b:e7:9b:
3e:3f:39:4f:cf:b3:cb:48:cf:96:02:89:0b:7e:24:
c7:00:e9:ce:8d:ea:07:cf:21:f2:89:51:c8:cc:7a:
04:e4:68:6f:1c:a8:e0:76:18:40:62:ee:2f:bd:13:
64:b7:1e:2e:18:bb:b1:d4:17:d5:fb:1f:07:59:65:
46:f0:c4:51:dc:ac:62:ff:31:a8:72:26:a6:1a:88:
37:23:82:49:9a:02:d2:39:74:98:71:7f:a4:77:52:
3a:ed:22:2e:99:9c:81:2c:48:16:3c:82:7b:af:2c:
0d:4b:28:4d:e0:46:7d:b5:b8:ea:3f:e7:5a:5b:4f:
d8:06:b2:a3:86:2f:8b:5b:9c:bc:04:2e:64:b6:e1:
09:c9:14:6d:54:7e:86:40:7b:66:33:27:33:4a:3d:
7c:97
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Subject Key Identifier:
EF:9B:88:5C:07:27:79:EA:60:90:5C:7A:28:45:FB:7F:35:E6:CB:3F
X509v3 Authority Key Identifier:
keyid:EF:9B:88:5C:07:27:79:EA:60:90:5C:7A:28:45:FB:7F:35:E6:CB:3F
X509v3 Basic Constraints:
CA:TRUE
Signature Algorithm: sha1WithRSAEncryption
08:e9:a4:32:cc:35:7c:66:5a:ea:f2:bd:e6:75:78:81:52:11:
22:27:32:c9:ec:91:6e:51:8a:f1:1e:0f:25:8a:e1:64:ba:e4:
85:1c:e4:fd:75:f0:26:3d:65:62:16:29:20:4f:5f:d2:66:36:
de:2b:bd:7b:96:71:f6:2c:d1:c5:54:69:89:dd:52:20:49:49:
b1:ac:09:b4:1e:33:59:0d:89:fd:a4:28:7a:70:96:e5:cb:58:
7e:b9:1d:02:7a:33:ee:ad:6a:ad:2c:3c:5e:7d:cc:f5:72:69:
51:fd:77:b4:0f:10:fd:9e:c2:1a:04:c5:a9:56:6e:fd:66:9f:
b6:1c:f9:d3:68:f4:4f:8c:6c:67:af:f5:e0:a5:30:67:a6:a7:
9b:6e:16:89:8a:e5:b4:20:f4:f7:74:f4:9c:ca:5d:c7:2f:e6:
30:9d:6b:2e:95:29:c1:e7:aa:d7:d6:59:dc:a9:f0:10:40:02:
66:3f:58:a2:38:8c:89:1a:0b:94:1a:e5:80:49:14:44:f4:06:
b1:11:1a:cd:ef:76:6a:bf:f8:6f:58:9d:af:a3:6b:9a:8e:bb:
6c:10:d6:d8:4e:73:58:20:0b:99:38:41:d4:22:d4:80:0b:09:
0d:25:40:3e:66:15:a0:44:4e:d6:59:5a:58:07:e5:4b:62:f1:
e9:ae:b6:7c
-----BEGIN CERTIFICATE-----
MIIDrzCCApegAwIBAgIJAOR8RcQlISHJMA0GCSqGSIb3DQEBBQUAMG4xCzAJBgNV
BAYTAkNaMREwDwYDVQQIDAhWeXNvY2luYTEUMBIGA1UECgwLYnVrb3ZhLmluZm8x
FDASBgNVBAMMC0pvc2VmIFJva29zMSAwHgYJKoZIhvcNAQkBFhFyb2tvc0BidWtv
dmEuaW5mbzAeFw0xNTA2MjQwOTU5NTBaFw0yNTA2MjEwOTU5NTBaMG4xCzAJBgNV
BAYTAkNaMREwDwYDVQQIDAhWeXNvY2luYTEUMBIGA1UECgwLYnVrb3ZhLmluZm8x
FDASBgNVBAMMC0pvc2VmIFJva29zMSAwHgYJKoZIhvcNAQkBFhFyb2tvc0BidWtv
dmEuaW5mbzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALz7ZFBbWAOM
IBx301AxlFV41gW7vIidyyCxjP+s/JcasZwpxKyv7Tvek9XPdT7QBUEyvxIlU2Ao
r/8+PDpMUng/sni5xi/8DkTrZcN/OCuriDeMaFVp4z1em5klEVUGq+jB+lTaW+eb
Pj85T8+zy0jPlgKJC34kxwDpzo3qB88h8olRyMx6BORobxyo4HYYQGLuL70TZLce
Lhi7sdQX1fsfB1llRvDEUdysYv8xqHImphqINyOCSZoC0jl0mHF/pHdSOu0iLpmc
gSxIFjyCe68sDUsoTeBGfbW46j/nWltP2Aayo4Yvi1ucvAQuZLbhCckUbVR+hkB7
ZjMnM0o9fJcCAwEAAaNQME4wHQYDVR0OBBYEFO+biFwHJ3nqYJBceihF+3815ss/
MB8GA1UdIwQYMBaAFO+biFwHJ3nqYJBceihF+3815ss/MAwGA1UdEwQFMAMBAf8w
DQYJKoZIhvcNAQEFBQADggEBAAjppDLMNXxmWuryveZ1eIFSESInMsnskW5RivEe
DyWK4WS65IUc5P118CY9ZWIWKSBPX9JmNt4rvXuWcfYs0cVUaYndUiBJSbGsCbQe
M1kNif2kKHpwluXLWH65HQJ6M+6taq0sPF59zPVyaVH9d7QPEP2ewhoExalWbv1m
n7Yc+dNo9E+MbGev9eClMGemp5tuFomK5bQg9Pd09JzKXccv5jCday6VKcHnqtfW
Wdyp8BBAAmY/WKI4jIkaC5Qa5YBJFET0BrERGs3vdmq/+G9Yna+ja5qOu2wQ1thO
c1ggC5k4QdQi1IALCQ0lQD5mFaBETtZZWlgH5Uti8emutnw=
-----END CERTIFICATE-----
@@ -23,6 +23,7 @@ import info.bukova.isspst.services.reqsubjects.ServiceItemService;
import info.bukova.isspst.services.requirement.RequirementService;
import info.bukova.isspst.services.requirement.RequirementTypeService;
import info.bukova.isspst.services.requirement.TripRequirementService;
import info.bukova.isspst.services.signeddocs.SignedDocumentService;
import info.bukova.isspst.services.tripbill.TripBillService;
import info.bukova.isspst.services.users.RoleService;
import info.bukova.isspst.services.users.UserService;
@@ -86,6 +87,7 @@ public class Constants {
public final static String MOD_ORDER = "ORDER";
public final static String MOD_INVOICING = "INVOICING";
public final static String MOD_SEARCH = "SEARCH";
public final static String MOD_SIGNEDDOCS = "SIGNEDDOCS";
public final static Module MODULES[] = {
new Module(MOD_USERS, "Uživatelé", UserService.class),
new Module(MOD_PERMISSIONS, "Práva", RoleService.class),
@@ -103,6 +105,7 @@ public class Constants {
new Module(MOD_ORDER, "Objednávky", OrderService.class),
new Module(MOD_INVOICING, "Fakturace požadavků", InvoicingService.class),
new Module(MOD_SEARCH, "Fulltextové vyhledávání", FullTextService.class, true, false),
new Module(MOD_SIGNEDDOCS, "Podepsané dokumenty", SignedDocumentService.class, true, false),
};
public final static String PERM_APPROVE = "PERM_APPROVE";
@@ -130,16 +133,19 @@ public class Constants {
new Permission(PERM_APPROVE, "Schválení", MOD_TRIPREQUIREMENTS, PermissionType.WORKGROUP),
new Permission(PERM_SEARCH, "Vyhledávat", MOD_SEARCH, PermissionType.GLOBAL),
new Permission(PERM_READ, "Číst", MOD_SIGNEDDOCS, PermissionType.GLOBAL)
};
public final static String DYNAMIC_REPORT_NAME = "Tabulková sestava";
public final static ReportMapping REPORTS[] = {
new ReportMapping(MOD_ADDRESSBOOK, new Report("Adresní karty", "address")),
new ReportMapping(MOD_ADDRESSBOOK, new Report("Adresa", "address", false, true)),
new ReportMapping(MOD_TRIPBILL, new Report("Žádost", "tripRequirement", false, true)),
new ReportMapping(MOD_TRIPBILL, new Report("Vyúčtování", "tripBill", false, true, true)),
new ReportMapping(MOD_ORDER, new Report("Objednávka", "order", true, true)),
new ReportMapping(MOD_REQUIREMENTS, new Report("Požadavky", "requirements"))
new ReportMapping(MOD_ADDRESSBOOK, new Report(1, false, "Adresní karty", "address")),
new ReportMapping(MOD_ADDRESSBOOK, new Report(2, false, "Adresa", "address", false, true)),
new ReportMapping(MOD_TRIPBILL, new Report(3, false, "Žádost", "tripRequirement", false, true)),
new ReportMapping(MOD_TRIPBILL, new Report(4, true, "Vyúčtování", "tripBill", false, true, true)),
new ReportMapping(MOD_ORDER, new Report(5, false, "Objednávka", "order", true, true)),
new ReportMapping(MOD_REQUIREMENTS, new Report(6, false, "Požadavky", "requirements")),
new ReportMapping(MOD_TRIPREQUIREMENTS, new Report(7, true, "Žádost o SC", "tripRequirementApp", false, true)),
new ReportMapping(MOD_REQUIREMENTS, new Report(8, true, "Protokol o kontrole", "orderRequirement", false, true))
};
public final static String REQTYPE_ORDER = "ORDER";
@@ -164,4 +170,9 @@ public class Constants {
public final static int LEN_TEXT = 255;
public final static int LEN_DESCRIPTION = 8192;
public final static int LEN_RESULT_MESSAGE = 8192;
public final static String MAIL_URL_KEYWORD = "-url-";
public final static String KEY_SIGN_DATA = "SIGN_DATA";
public final static String KEY_SIGN_GUID = "SIGN_GUID";
}
@@ -1,5 +1,12 @@
package info.bukova.isspst;
import info.bukova.isspst.data.DataModel;
import info.bukova.isspst.services.Service;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import javax.servlet.ServletContext;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -38,6 +45,48 @@ public class ModuleUtils {
return null;
}
public static Module getModule(DataModel entity, ServletContext sc) {
WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(sc);
for (Module m : Constants.MODULES) {
Service<?> service;
try {
service = (Service<?>) ctx.getBean(m.getServiceClass());
} catch (NoSuchBeanDefinitionException e) {
String[] beans = ctx.getBeanNamesForType(m.getServiceClass());
for (String s : beans) {
service = (Service<?>) ctx.getBean(s);
if (service.getEntityClasses().contains(entity.getClass())) {
return m;
}
}
continue;
} catch (ClassCastException e) { //nestandardní moduly neřeší...
continue;
}
if (service.getEntityClasses().contains(entity.getClass())) {
return m;
}
}
return null;
}
public static Service<?> getServiceInstance(Module m, ServletContext sc) {
WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(sc);
try {
return (Service<?>) ctx.getBean(m.getServiceClass());
} catch (NoSuchBeanDefinitionException e) {
String[] beans = ctx.getBeanNamesForType(m.getServiceClass());
return (Service<?>) ctx.getBean(beans[0]);
}
}
public static boolean isActive(String id) {
return getModule(id).isActive();
}
@@ -0,0 +1,31 @@
package info.bukova.isspst;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RegExUtils {
public static List<String> getMatches(String input, String regEx, int group) {
List<String> list = new ArrayList<String>();
if (!StringUtils.isNullOrEmpty(input) && !StringUtils.isNullOrEmpty(regEx)) {
Pattern pattern = Pattern.compile(regEx);
Matcher matcher = pattern.matcher(input);
int groupCount = matcher.groupCount() + 1;
if ((groupCount >= 0) && (group < groupCount)) {
while (matcher.find()) {
String item = matcher.group(group);
list.add(item);
}
}
}
return list;
}
public static List<String> getMatches(String input, String regEx) {
return RegExUtils.getMatches(input, regEx, 0);
}
}
@@ -5,6 +5,7 @@ import info.bukova.isspst.data.User;
import info.bukova.isspst.data.Workgroup;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -13,16 +14,18 @@ public class SessionData implements Serializable {
/**
*
*/
private static final long serialVersionUID = -764426911263559758L;
private static final long serialVersionUID = -764426911263559759L;
private List<Workgroup> userCentres;
private List<Workgroup> userWorkgroups;
private User currentUser;
private Map<Integer, List<Role>> workgroupRoles;
private boolean loginFailed;
private Map<String, Object> properties;
public SessionData() {
loginFailed = false;
properties = new HashMap<String, Object>();
}
public List<Workgroup> getUserCentres() {
@@ -65,4 +68,11 @@ public class SessionData implements Serializable {
this.loginFailed = loginFailed;
}
public void setProperty(String key, Object value) {
properties.put(key, value);
}
public Object getProperty(String key) {
return properties.get(key);
}
}
@@ -0,0 +1,25 @@
package info.bukova.isspst;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import javax.servlet.ServletContext;
/**
* @author Pepa Rokos
*/
public class SpringUtils {
private static WebApplicationContext webCtx(ServletContext sc) {
return WebApplicationContextUtils.getRequiredWebApplicationContext(sc);
}
public static Object getBean(String name, ServletContext sc) {
return webCtx(sc).getBean(name);
}
public static <T> T getBean(Class<T> clazz, ServletContext sc) {
return webCtx(sc).getBean(clazz);
}
}
@@ -0,0 +1,7 @@
package info.bukova.isspst.dao;
import info.bukova.isspst.data.SignedDocument;
public interface SignedDocumentDao extends BaseDao<SignedDocument> {
}
@@ -0,0 +1,9 @@
package info.bukova.isspst.dao.jpa;
import info.bukova.isspst.dao.SignedDocumentDao;
import info.bukova.isspst.data.SignedDocument;
public class SignedDocumentDaoJPA extends BaseDaoJPA<SignedDocument> implements SignedDocumentDao {
}
@@ -0,0 +1,114 @@
package info.bukova.isspst.data;
import info.bukova.isspst.Constants;
import info.bukova.isspst.Module;
import info.bukova.isspst.StringUtils;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import org.hibernate.search.annotations.IndexedEmbedded;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Entity
@Table(name = "SIGNED_DOCUMENTS")
public class SignedDocument extends BaseData {
@Column(name = "MODULE_NAME", length = Constants.LEN_TEXT)
private String moduleName;
@Column(name = "RECORD_ID")
private int recordId;
@Column(name = "NUMSER", length = Constants.LEN_TEXT)
private String numser;
@Column(name = "DESCRIPTION", length = Constants.LEN_DESCRIPTION)
private String description;
@Column(name = "SIGN_DATE")
private Date signDate;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "signedDocument", orphanRemoval = true)
@LazyCollection(LazyCollectionOption.TRUE)
@IndexedEmbedded
private List<SignedDocumentItem> items;
public String getModuleName() {
return moduleName;
}
public void setModuleName(String moduleName) {
this.moduleName = moduleName;
}
public int getRecordId() {
return recordId;
}
public void setRecordId(int recordId) {
this.recordId = recordId;
}
public String getNumser() {
return numser;
}
public void setNumser(String numser) {
this.numser = numser;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Date getSignDate() {
return signDate;
}
public void setSignDate(Date signDate) {
this.signDate = signDate;
}
public String getAgendaName() {
if (StringUtils.isNullOrEmpty(this.moduleName)) {
return "";
}
for (Module m : Constants.MODULES) {
if (this.moduleName.equals(m.getId())) {
return m.getName();
}
}
return "";
}
public List<SignedDocumentItem> getItems() {
return items;
}
public void setItems(List<SignedDocumentItem> items) {
this.items = items;
}
public void addItem(SignedDocumentItem item) {
if (items == null) {
items = new ArrayList<SignedDocumentItem>();
}
item.setSignedDocument(this);
this.items.add(item);
}
}
@@ -0,0 +1,88 @@
package info.bukova.isspst.data;
import info.bukova.isspst.Constants;
import info.bukova.isspst.reporting.Report;
import info.bukova.isspst.reporting.ReportMapping;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name = "SIGNED_DOCUMENTS_ITEMS")
public class SignedDocumentItem {
@Id
@Column(name = "ID")
@GeneratedValue
private int id;
@Column(name = "REPORT_ID")
private long reportId;
@Column(name = "REPORT_NAME", length = Constants.LEN_TEXT)
private String reportName;
@Column(name = "FILENAME", length = Constants.LEN_TEXT)
private String fileName;
@ManyToOne
@JoinColumn(name = "SIGNED_DOCUMENT_ID")
private SignedDocument signedDocument;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public long getReportId() {
return reportId;
}
public void setReportId(long reportId) {
this.reportId = reportId;
}
public String getReportName() {
return reportName;
}
public void setReportName(String reportName) {
this.reportName = reportName;
}
public String getActualReportName() {
for (ReportMapping rm : Constants.REPORTS) {
Report rep = rm.getReport();
if (this.reportId == rep.getReportId()) {
return rep.getName();
}
}
return reportName;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public SignedDocument getSignedDocument() {
return signedDocument;
}
public void setSignedDocument(SignedDocument signedDocument) {
this.signedDocument = signedDocument;
}
}
@@ -2,11 +2,13 @@ package info.bukova.isspst.data;
import info.bukova.isspst.Constants;
import info.bukova.isspst.storage.EntityWithAttachment;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;
import javax.persistence.CascadeType;
import javax.persistence.Column;
@@ -16,14 +18,10 @@ import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Entity
@Table(name = "TRIP_BILL")
@@ -66,7 +64,7 @@ public class TripBill extends BaseData implements EntityWithAttachment {
@JoinColumn(name = "APPROVAL_ID")
private TripBillApproval approval;
@Column(name = "SAVED")
private Boolean saved;
private Boolean saved; // Nastaveno na true, pokud uživatel udělá změnu- nepřenáší se pak částky od žadatele
public TripBill() {
billItems = new ArrayList<TripBillItem>();
@@ -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")
@@ -25,6 +24,8 @@ public class Workflow extends BaseData {
private Integer wOrder;
@Column(name = "WLIMIT", precision=15, scale=4)
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;
}
}
@@ -0,0 +1,64 @@
package info.bukova.isspst.filters;
import info.bukova.isspst.DateTimeUtils;
import info.bukova.isspst.StringUtils;
import info.bukova.isspst.data.SignedDocument;
import org.hamcrest.Description;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
public class SignedDocumentFilter implements Filter<SignedDocument>
{
private SignedDocument condition;
public SignedDocumentFilter(SignedDocument cond)
{
this.condition = cond;
}
private static class SignedDocumentMatcher extends TypeSafeMatcher<SignedDocument>
{
private SignedDocument condition;
public SignedDocumentMatcher(SignedDocument cond)
{
this.condition = cond;
}
@Override
public void describeTo(Description desc)
{
desc.appendText("SignedDocument matches");
}
@Override
public boolean matchesSafely(SignedDocument item)
{
boolean foundAgendaName = StringUtils.isEqualForFilter(item.getAgendaName(), condition.getAgendaName());
boolean foundNumSer = StringUtils.isEqualForFilter(item.getNumser(), condition.getNumser());
boolean foundDescription = StringUtils.isEqualForFilter(item.getDescription(), condition.getDescription());
boolean foundSignDate = DateTimeUtils.isEqualByDateForFilter(item.getSignDate(), condition.getSignDate());
return (foundAgendaName && foundNumSer && foundDescription && foundSignDate);
}
@Factory
public static Matcher<SignedDocument> matchBuilding(SignedDocument item)
{
return new SignedDocumentMatcher(item);
}
}
@Override
public SignedDocumentMatcher matcher()
{
return new SignedDocumentMatcher(condition);
}
@Override
public String queryString()
{
return "";
}
}
@@ -1,5 +1,6 @@
package info.bukova.isspst.mail;
import info.bukova.isspst.Constants;
import info.bukova.isspst.EntityUrlResolver;
import info.bukova.isspst.UrlResolverHolder;
@@ -57,7 +58,7 @@ public class EntityMessageBuilder implements MessageBuilder {
for (String p : properties) {
try {
if (p.equals("-url-")) {
if (p.equals(Constants.MAIL_URL_KEYWORD)) {
ret = ret.replaceAll("\\[" + p + "\\]", getUrl(data));
} else {
ret = ret.replaceAll("\\[" + p + "\\]", BeanUtils.getProperty(data, p));
@@ -74,7 +74,7 @@ public class ParamFiller {
definition.setParam("P_PREV_APPROVER_SIGNATURE", storage.serverPath(prevApproverSettings.getSignatureFile()));
}
AuthItem lastAuth = tb.getApproval().getAuthorization().get(tb.getRequirement().getAuthorization().size() - 1);
AuthItem lastAuth = tb.getApproval().getAuthorization().get(tb.getApproval().getAuthorization().size() - 1);
definition.setParam("P_APPROVE_DATE", lastAuth.getAuthDate());
User u = lastAuth.getApprover();
@@ -1,18 +1,21 @@
package info.bukova.isspst.reporting;
import java.io.File;
import javax.servlet.ServletContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.bukova.isspst.SpringUtils;
import info.bukova.isspst.data.DataModel;
import info.bukova.isspst.data.SignedDocumentItem;
import info.bukova.isspst.services.signeddocs.SignedDocumentService;
import info.bukova.isspst.storage.ReportFileStorage;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.JasperRunManager;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import net.sf.jasperreports.engine.util.JRLoader;
import net.sf.jasperreports.engine.util.JRProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.ServletContext;
import java.io.File;
@SuppressWarnings("deprecation")
public class PredefinedGenerator implements Generator {
@@ -29,6 +32,11 @@ public class PredefinedGenerator implements Generator {
@Override
public byte[] generate() {
byte[] bytes = null;
SignedDocumentItem signedItem = getSignedDocument();
if (signedItem != null) {
return fromStorage(signedItem);
}
try {
JasperReport report = (JasperReport) JRLoader.loadObject(getReportFile());
@@ -44,6 +52,18 @@ public class PredefinedGenerator implements Generator {
return bytes;
}
private byte[] fromStorage(SignedDocumentItem sdItem) {
ReportFileStorage reportStorage = SpringUtils.getBean(ReportFileStorage.class, ctx);
return reportStorage.fileData(sdItem);
}
private SignedDocumentItem getSignedDocument() {
SignedDocumentService sdService = SpringUtils.getBean(SignedDocumentService.class, ctx);
SignedDocumentItem sdItem = sdService.getItem((DataModel) definition.getDataSet().get(0), definition.getReport().getReportId());
return sdItem;
}
protected File getReportFile() {
return new File(ctx.getRealPath("WEB-INF/reports") + "/" + definition.getReport().getJasperFile() + ".jasper");
}
@@ -4,6 +4,8 @@ package info.bukova.isspst.reporting;
public class Report {
private ReportType type;
private long reportId;
private boolean signable;
private String name;
private String jasperFile;
private boolean hasSettings;
@@ -11,53 +13,65 @@ public class Report {
private boolean hasCondition;
public Report() {
this.reportId = 0;
this.signable = false;
hasSettings = false;
singleRecord = false;
hasCondition = false;
}
/**
* @param reportId
* @param signable
* @param name
* @param jasperFile
*/
public Report(String name, String jasperFile) {
public Report(long reportId, boolean signable, String name, String jasperFile) {
this();
this.type = ReportType.DEFINED;
this.reportId = reportId;
this.signable = signable;
this.name = name;
this.jasperFile = jasperFile;
}
/**
* @param reportId
* @param signable
* @param name
* @param jasperFile
* @param hasSettings
*/
public Report(String name, String jasperFile, boolean hasSettings) {
this(name, jasperFile);
public Report(long reportId, boolean signable, String name, String jasperFile, boolean hasSettings) {
this(reportId, signable, name, jasperFile);
this.hasSettings = hasSettings;
}
/**
* @param reportId
* @param signable
* @param name
* @param jasperFile
* @param hasSettings
* @param singleRecord
*/
public Report(String name, String jasperFile, boolean hasSettings, boolean singleRecord) {
this(name, jasperFile, hasSettings);
public Report(long reportId, boolean signable, String name, String jasperFile, boolean hasSettings, boolean singleRecord) {
this(reportId, signable, name, jasperFile, hasSettings);
this.singleRecord = singleRecord;
}
/**
*
* @param reportId
* @param signable
* @param name
* @param jasperFile
* @param hasSettings
* @param singleRecord
* @param hasCondition
*/
public Report(String name, String jasperFile, boolean hasSettings, boolean singleRecord, boolean hasCondition) {
this(name, jasperFile, hasSettings, singleRecord);
public Report(long reportId, boolean signable, String name, String jasperFile, boolean hasSettings, boolean singleRecord, boolean hasCondition) {
this(reportId, signable, name, jasperFile, hasSettings, singleRecord);
this.hasCondition = hasCondition;
}
@@ -108,4 +122,20 @@ public class Report {
public void setHasCondition(boolean hasCondition) {
this.hasCondition = hasCondition;
}
public long getReportId() {
return reportId;
}
public void setReportId(long reportId) {
this.reportId = reportId;
}
public boolean isSignable() {
return signable;
}
public void setSignable(boolean signable) {
this.signable = signable;
}
}
@@ -1,17 +1,17 @@
package info.bukova.isspst.reporting;
import java.io.IOException;
import java.io.OutputStream;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import info.bukova.isspst.storage.ReportFileStorage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
@Controller
public class ReportController {
@@ -21,6 +21,8 @@ public class ReportController {
private GeneratorFactory factory;
@Autowired
private ParamFiller paramFiller;
@Autowired
private ReportFileStorage reportFileStorage;
private static final String ERROR_MESSAGE = "<html><body><b>Generator returned no data!</b><br/>%s</body></html>";
private final static Logger logger = LoggerFactory.getLogger(ReportController.class);
@@ -46,13 +48,20 @@ public class ReportController {
try {
os = response.getOutputStream();
if (reportDefinition.getReport() == null || reportDefinition.getDataSet() == null) {
if ((reportDefinition.getReport() == null || reportDefinition.getDataSet() == null) && reportDefinition.getSignedDocItem() == null) {
throw new ReportException("Definition is null");
}
paramFiller.fill();
Generator gen = factory.createGenerator(reportDefinition);
byte[] data = gen.generate();
byte[] data;
if (reportDefinition.getSignedDocItem() == null) {
paramFiller.fill();
Generator gen = factory.createGenerator(reportDefinition);
data = gen.generate();
} else {
data = reportFileStorage.fileData(reportDefinition.getSignedDocItem());
}
response.setContentType(contentType);
response.setContentLength(data.length);
@@ -1,5 +1,6 @@
package info.bukova.isspst.reporting;
import info.bukova.isspst.data.SignedDocumentItem;
import info.bukova.isspst.services.Service;
import java.io.Serializable;
@@ -20,6 +21,7 @@ public class ReportDefinition implements Serializable {
private List<String> fieldsToPrint;
private String reportTitle;
private Service<Object> service;
private SignedDocumentItem signedDocItem;
public ReportDefinition() {
params = new HashMap<String, Object>();
@@ -92,6 +94,7 @@ public class ReportDefinition implements Serializable {
reportTitle = "";
service = null;
params.clear();
signedDocItem = null;
}
public String getReportTitle() {
@@ -110,4 +113,11 @@ public class ReportDefinition implements Serializable {
this.service = service;
}
public SignedDocumentItem getSignedDocItem() {
return signedDocItem;
}
public void setSignedDocItem(SignedDocumentItem signedDocItem) {
this.signedDocItem = signedDocItem;
}
}
@@ -0,0 +1,66 @@
package info.bukova.isspst.reporting;
import com.lowagie.text.Rectangle;
import com.lowagie.text.pdf.PdfAnnotation;
import com.lowagie.text.pdf.PdfFormField;
import com.lowagie.text.pdf.PdfName;
import net.sf.jasperreports.engine.JRGenericPrintElement;
import net.sf.jasperreports.engine.JRPropertiesMap;
import net.sf.jasperreports.engine.export.GenericElementHandler;
import net.sf.jasperreports.engine.export.GenericElementHandlerBundle;
import net.sf.jasperreports.engine.export.GenericElementPdfHandler;
import net.sf.jasperreports.engine.export.JRPdfExporter;
import net.sf.jasperreports.engine.export.JRPdfExporterContext;
import net.sf.jasperreports.extensions.ExtensionsRegistry;
import net.sf.jasperreports.extensions.ExtensionsRegistryFactory;
import net.sf.jasperreports.extensions.SingletonExtensionRegistry;
/**
* @author Pepa Rokos
*/
public class SignaturePdfHandler implements GenericElementPdfHandler, GenericElementHandlerBundle, ExtensionsRegistryFactory {
@Override
public ExtensionsRegistry createRegistry(String registryId, JRPropertiesMap properties) {
return new SingletonExtensionRegistry<GenericElementHandlerBundle>(GenericElementHandlerBundle.class, this);
}
@Override
public void exportElement(JRPdfExporterContext exporterContext, JRGenericPrintElement element) {
PdfFormField field = PdfFormField.createSignature(exporterContext.getPdfWriter());
Object param = element.getParameterValue("index");
String index = param != null ? String.valueOf(param) : null;
if (index != null) {
field.setFieldName("signature-" + index);
} else {
field.setFieldName("signature");
}
field.setFieldFlags(PdfAnnotation.FLAGS_PRINT | PdfAnnotation.FLAGS_LOCKED);
field.setWidget(new Rectangle(element.getX(),
exporterContext.getExportedReport().getPageHeight() - element.getY(),
element.getX() + element.getWidth(),
exporterContext.getExportedReport().getPageHeight() - element.getY() - element.getHeight()), PdfName.HIGHLIGHT);
exporterContext.getPdfWriter().addAnnotation(field);
}
@Override
public boolean toExport(JRGenericPrintElement element) {
return true;
}
@Override
public String getNamespace() {
return "urn:sig:sig";
}
@Override
public GenericElementHandler getHandler(String elementName, String exporterKey) {
if (elementName.equals("signature") && exporterKey.equals(JRPdfExporter.PDF_EXPORTER_KEY)) {
return this;
}
return null;
}
}
@@ -5,9 +5,6 @@ import info.bukova.isspst.data.User;
import info.bukova.isspst.services.users.LdapUserImporter;
import info.bukova.isspst.services.users.RoleService;
import info.bukova.isspst.services.users.UserService;
import java.util.Collection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ldap.core.DirContextOperations;
@@ -15,6 +12,8 @@ import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.ldap.userdetails.LdapAuthoritiesPopulator;
import java.util.Collection;
public class AuthPopulator implements LdapAuthoritiesPopulator {
private UserService userService;
@@ -30,7 +29,8 @@ public class AuthPopulator implements LdapAuthoritiesPopulator {
public Collection<? extends GrantedAuthority> getGrantedAuthorities(
DirContextOperations userData, String login) {
User user = null;
User user;
try {
user = (User) userService.loadUserByUsername(login);
} catch (UsernameNotFoundException e) {
@@ -14,6 +14,7 @@ import info.bukova.isspst.storage.DocumentFileStorage;
import org.hibernate.NonUniqueResultException;
import org.hibernate.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.GenericTypeResolver;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
@@ -22,6 +23,7 @@ import javax.validation.Validator;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@@ -40,8 +42,20 @@ public abstract class AbstractService<T extends DataModel> implements Service<T>
private DocumentFileStorage documentFileStorage;
private NumberSeriesService numberSeriesService;
private Class<T> entityClass;
public AbstractService() {
entityClass = (Class<T>) GenericTypeResolver.resolveTypeArgument(getClass(), AbstractService.class);
}
@Override
public List<Class<?>> getEntityClasses() {
List<Class<?>> classes = new ArrayList<Class<?>>();
classes.add(entityClass);
return classes;
}
public void setDocumentFileStorage(DocumentFileStorage storage) {
this.documentFileStorage = storage;
}
@@ -23,5 +23,6 @@ public interface Service<T> {
public Module getModule();
public List<Report> getReports();
public boolean canPrintRecord(T entity);
public List<Class<?>> getEntityClasses();
}
@@ -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;
@@ -22,9 +23,11 @@ public interface RequirementBaseService<T extends RequirementBase> extends Servi
public void loadType(T data);
public void loadWorkflow(T data);
public void approve(T entity);
public void approve(T entity, Date approveDate);
public void approve(T entity, Date approveDate, byte[] signedPdf);
public boolean canApprove(T entity);
public List<User> getNextApprover(T entity);
public boolean prepareSignData(T entity, Date approveDate);
public Workflow getNextWorkflow(T entity);
public List<T> getMy();
@@ -1,23 +1,38 @@
package info.bukova.isspst.services.requirement;
import info.bukova.isspst.Constants;
import info.bukova.isspst.Module;
import info.bukova.isspst.ModuleUtils;
import info.bukova.isspst.data.AuthItem;
import info.bukova.isspst.data.DataModel;
import info.bukova.isspst.data.JobMapping;
import info.bukova.isspst.data.RequirementBase;
import info.bukova.isspst.data.RequirementState;
import info.bukova.isspst.data.Role;
import info.bukova.isspst.data.SettingsData;
import info.bukova.isspst.data.SignedDocument;
import info.bukova.isspst.data.SignedDocumentItem;
import info.bukova.isspst.data.User;
import info.bukova.isspst.data.Workflow;
import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.mail.MailMessage;
import info.bukova.isspst.mail.Mailer;
import info.bukova.isspst.mail.MessageBuilder;
import info.bukova.isspst.reporting.Generator;
import info.bukova.isspst.reporting.GeneratorFactory;
import info.bukova.isspst.reporting.ParamFiller;
import info.bukova.isspst.reporting.Report;
import info.bukova.isspst.reporting.ReportDefinition;
import info.bukova.isspst.services.AbstractOwnedService;
import info.bukova.isspst.services.LazyLoader;
import info.bukova.isspst.services.Service;
import info.bukova.isspst.services.settings.GlobalSettingsService;
import info.bukova.isspst.services.signeddocs.SignedDocumentService;
import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.signapi.SignData;
import info.bukova.isspst.storage.FileStorage;
import info.bukova.isspst.storage.ReportFileStorage;
import org.hibernate.LazyInitializationException;
import org.hibernate.Query;
import org.springframework.beans.factory.annotation.Autowired;
@@ -25,9 +40,11 @@ import org.springframework.security.access.prepost.PostFilter;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.ServletContext;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
* @author Pepa Rokos
@@ -50,6 +67,20 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
private UserService userService;
@Autowired
protected WorkgroupService workgroupService;
@Autowired
private ReportDefinition reportDefinition;
@Autowired
private ParamFiller paramFiller;
@Autowired
private GeneratorFactory genFactory;
@Autowired
private ServletContext servletContext;
@Autowired
private FileStorage storage;
@Autowired
private SignedDocumentService signedDocumentService;
@Autowired
private ReportFileStorage signedDocStorage;
@Override
@Transactional
@@ -119,6 +150,7 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
workflow.setLimit(w.getLimit());
workflow.setOrder(w.getOrder());
workflow.setRole(w.getRole());
workflow.setSignature(w.getSignature());
entity.getWorkflow().add(workflow);
}
}
@@ -214,7 +246,7 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
}
}
protected void approve(T entity, User user, Date approveDate) {
protected void approve(T entity, User user, Date approveDate, byte[] signedPdf) {
T e = (T) dao.getById(entity.getId());
if (e.getReqDate().getTime() > approveDate.getTime()) {
@@ -246,6 +278,12 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> 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);
@@ -273,7 +311,7 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
}
protected void approve(T entity, User user) {
approve(entity, user, new Date());
approve(entity, user, new Date(), null);
}
@Override
@@ -286,8 +324,8 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
@Override
@Transactional
@PreAuthorize("this.canApprove(#entity)")
public void approve(T entity, Date approveDate) {
approve(entity, getLoggedInUser(), approveDate);
public void approve(T entity, Date approveDate, byte[] signedPdf) {
approve(entity, getLoggedInUser(), approveDate, signedPdf);
}
/**
@@ -310,6 +348,30 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
}
protected void saveSignedDoc(T entity, byte[] signedPdf) {
DataModel reportEntity = entityForSignReport(entity);
SignedDocumentItem signedItem = signedDocumentService.getItem(entityForSignReport(entity), getSignReport(entity).getReportId());
if (signedItem == null) {
SignedDocument signDoc = new SignedDocument();
signDoc.setDescription(entity.getDescription());
signDoc.setNumser(entity.getNumser());
signDoc.setRecordId(reportEntity.getId());
signDoc.setModuleName(ModuleUtils.getModule(reportEntity, servletContext).getId());
signDoc.setSignDate(entity.getLastApproveDate());
SignedDocumentItem item = new SignedDocumentItem();
item.setReportId(reportDefinition.getReport().getReportId());
item.setReportName(reportDefinition.getReport().getName());
signDoc.addItem(item);
signedDocStorage.saveFile(signedPdf, item);
signedDocumentService.addFromApprove(signDoc);
} else {
signedDocStorage.saveFile(signedPdf, signedItem);
}
}
@Override
@Transactional
public boolean canApprove(T entity) {
@@ -321,7 +383,11 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> 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;
@@ -408,4 +474,96 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
return Constants.PERM_DELETE_NEW;
}
@Override
@Transactional
public boolean prepareSignData(T entity, Date approveDate) {
SignData data = new SignData();
sessionData.setProperty(Constants.KEY_SIGN_DATA, data);
data.setSignGuid(UUID.randomUUID().toString());
sessionData.setProperty(Constants.KEY_SIGN_GUID, data.getSignGuid());
reportDefinition.clear();
reportDefinition.setSingleObject(entityForSignReport(entity));
Report report = getSignReport(entity);
if (report == null) {
return false;
}
reportDefinition.setReport(report);
Module module = ModuleUtils.getModule(entityForSignReport(entity), servletContext);
reportDefinition.setService((Service<Object>) ModuleUtils.getServiceInstance(module, servletContext));
paramFiller.fill();
Generator gen = genFactory.createGenerator(reportDefinition);
data.setPdfData(gen.generate());
data.setDescription(entity.getDescription());
data.setNumser(entity.getNumser());
data.setSignDate(approveDate);
data.setSigned(signedDocumentService.getItem(entityForSignReport(entity), report.getReportId()) != null);
if (getNextWorkflow(entity).getCentre()) { // viditelné podpisy lze pouze na urovni strediska
if (entity.getState() == RequirementState.NEW) {
data.setAreaId(1);
} else {
loadAuthItems(entity);
int wgCount = 0;
for (Workflow wf : entity.getWorkflow()) {
if (!wf.getCentre()) {
++wgCount;
}
}
data.setAreaId(entity.getAuthorization().size() - wgCount + 1);
}
if (userService.getUserSettings().getSignatureFile() != null) {
data.setSignImg(storage.fileData(userService.getUserSettings().getSignatureFile()));
}
}
return true;
}
protected DataModel entityForSignReport(T entity) {
return entity;
}
private Report getSignReport(T entity) {
Module module = ModuleUtils.getModule(entityForSignReport(entity), servletContext);
Report report = null;
for (Report r : module.getReports()) {
if (r.isSignable()) {
report = r;
break;
}
}
return report;
}
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_EDIT') or hasPermission(#entity, this.getUpdateEntityPermission())")
public void update(T entity) {
entity.getAuthorization().clear();
entity.setState(RequirementState.NEW);
SignedDocument doc = signedDocumentService.getForEntity(entity);
if (doc != null) {
signedDocumentService.delFromApprove(doc);
}
super.update(entity);
sendToApprovers(entity);
}
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_DELETE') or hasPermission(#entity, this.getDeleteEntityPermission())")
public void delete(T entity) {
signedDocumentService.delFromApprove(signedDocumentService.getForEntity(entity));
super.delete(entity);
}
}
@@ -60,7 +60,7 @@ public class RequirementServiceImpl extends RequirementBaseServiceImpl<Requireme
if ((entity.getSumTotal() != null)
&& (entity.getSumTotal().compareTo(nextWf.getLimit()) == -1))
{
approve(entity, approvers.get(0), approveDate);
approve(entity, approvers.get(0), approveDate, null);
return true;
}
@@ -0,0 +1,15 @@
package info.bukova.isspst.services.signeddocs;
import info.bukova.isspst.data.DataModel;
import info.bukova.isspst.data.SignedDocument;
import info.bukova.isspst.data.SignedDocumentItem;
import info.bukova.isspst.services.Service;
public interface SignedDocumentService extends Service<SignedDocument> {
SignedDocument getForEntity(DataModel entity);
SignedDocumentItem getItem(DataModel entity, long reportId);
void addFromApprove(SignedDocument document);
void delFromApprove(SignedDocument document);
}
@@ -0,0 +1,87 @@
package info.bukova.isspst.services.signeddocs;
import info.bukova.isspst.Module;
import info.bukova.isspst.ModuleUtils;
import info.bukova.isspst.data.DataModel;
import info.bukova.isspst.data.SignedDocument;
import info.bukova.isspst.data.SignedDocumentItem;
import info.bukova.isspst.services.AbstractOwnedService;
import info.bukova.isspst.services.LazyLoader;
import info.bukova.isspst.storage.ReportFileStorage;
import org.hibernate.Hibernate;
import org.hibernate.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.ServletContext;
public class SignedDocumentServiceImpl extends AbstractOwnedService<SignedDocument> implements SignedDocumentService {
@Autowired
private ServletContext servletContext;
@Autowired
private ReportFileStorage signedDocStorage;
@LazyLoader("grid")
@Transactional
public void lazyLoadItems(SignedDocument signedDocument) {
if (signedDocument == null) {
return;
}
SignedDocument sd = dao.getById(signedDocument.getId());
Hibernate.initialize(sd.getItems());
signedDocument.setItems(sd.getItems());
}
@Override
@Transactional
public SignedDocument getForEntity(DataModel entity) {
Module module = ModuleUtils.getModule(entity, servletContext);
if (module == null) {
return null;
}
Query q = dao.getQuery("from SignedDocument where moduleName = :module and recordId = :record");
q.setParameter("module", module.getId());
q.setParameter("record", entity.getId());
return (SignedDocument) q.uniqueResult();
}
@Override
@Transactional
public SignedDocumentItem getItem(DataModel entity, long reportId) {
SignedDocument doc = getForEntity(entity);
if (doc == null) {
return null;
}
for (SignedDocumentItem item : doc.getItems()) {
if (item.getReportId() == reportId) {
return item;
}
}
return null;
}
@Override
public void addFromApprove(SignedDocument document) {
super.add(document);
}
@Override
public void delFromApprove(SignedDocument document) {
super.delete(document);
for (SignedDocumentItem item : document.getItems()) {
signedDocStorage.removeFile(item);
}
}
}
@@ -2,19 +2,19 @@ package info.bukova.isspst.services.tripbill;
import info.bukova.isspst.Constants;
import info.bukova.isspst.StringUtils;
import info.bukova.isspst.data.DataModel;
import info.bukova.isspst.data.RequirementState;
import info.bukova.isspst.data.TripBill;
import info.bukova.isspst.data.TripBillApproval;
import info.bukova.isspst.services.IsspstException;
import info.bukova.isspst.services.requirement.RequirementBaseServiceImpl;
import info.bukova.isspst.services.requirement.RequirementTypeService;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
/**
* @author Pepa Rokos
*/
@@ -53,4 +53,9 @@ public class TripBillApprovalServiceImpl extends RequirementBaseServiceImpl<Trip
postAdd(entity);
}
@Override
protected DataModel entityForSignReport(TripBillApproval entity) {
return entity.getBill();
}
}
@@ -3,9 +3,6 @@ package info.bukova.isspst.services.users;
import info.bukova.isspst.Constants;
import info.bukova.isspst.data.User;
import info.bukova.isspst.security.AuthMethod;
import java.util.Collection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ldap.core.DirContextAdapter;
@@ -16,6 +13,8 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider;
import org.springframework.security.ldap.userdetails.UserDetailsContextMapper;
import java.util.Collection;
/**
* Mapovač doménových uživatelů Active Directory na uživatele aplikace. Pokud uživatel není v aplikační databází,
* importu je se tam pomoci {@link LdapUserImporter}. Tento objekt se předává do {@link ActiveDirectoryLdapAuthenticationProvider}.
@@ -40,6 +39,7 @@ public class AdUserCtxMapper implements UserDetailsContextMapper {
@Override
public UserDetails mapUserFromContext(DirContextOperations userData,
String username, Collection<? extends GrantedAuthority> authorities) {
username = username.toLowerCase();
try {
User user = (User) userService.loadUserByUsername(username);
@@ -7,15 +7,7 @@ import info.bukova.isspst.data.UserSettingsData;
import info.bukova.isspst.security.AuthMethod;
import info.bukova.isspst.services.AbstractService;
import info.bukova.isspst.services.StringXmlMarshaller;
//import info.bukova.isspst.services.LazyLoader;
import info.bukova.isspst.services.workgroups.WorkgroupService;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;
import org.hibernate.LazyInitializationException;
@@ -31,6 +23,13 @@ import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
//import info.bukova.isspst.services.LazyLoader;
public class UserServiceImpl extends AbstractService<User> implements UserService {
private PasswordEncoder encoder;
@@ -220,6 +219,7 @@ public class UserServiceImpl extends AbstractService<User> implements UserServic
}
@Override
@Transactional
public void delete(User entity) {
workgroupService.loadParents(entity);
@@ -0,0 +1,10 @@
package info.bukova.isspst.signapi;
/**
* @author Pepa Rokos
*/
public interface JnlpGenerator {
public byte[] generate();
}
@@ -0,0 +1,121 @@
package info.bukova.isspst.signapi;
import org.springframework.beans.factory.annotation.Autowired;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import javax.servlet.http.HttpServletRequest;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.ByteArrayOutputStream;
/**
* @author Pepa Rokos
*/
public class JnlpGeneratorImpl implements JnlpGenerator {
@Autowired
private HttpServletRequest request;
@Override
public byte[] generate() {
String sessionId;
if (request.getParameter("id") != null && !request.getParameter("id").isEmpty()) {
sessionId = request.getParameter("id");
} else {
sessionId = request.getSession().getId();
}
try {
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document document = docBuilder.newDocument();
Element root = document.createElement("jnlp");
root.setAttribute("spec", "1.0+");
String signerUrl = request.getRequestURL().toString();
signerUrl = signerUrl.substring(0, signerUrl.indexOf(request.getServletPath())) + "/api/sign";
root.setAttribute("codebase", signerUrl);
root.setAttribute("href", "signer.jnlp" + "?id=" + sessionId);
document.appendChild(root);
Element info = document.createElement("information");
Element title = document.createElement("title");
title.appendChild(document.createTextNode("Signer component"));
info.appendChild(title);
Element vendor = document.createElement("vendor");
vendor.appendChild(document.createTextNode("bukova.info"));
info.appendChild(vendor);
root.appendChild(info);
Element security = document.createElement("security");
security.appendChild(document.createElement("all-permissions"));
root.appendChild(security);
Element resources = document.createElement("resources");
resources.setAttribute("os", "Linux");
Element j2se = document.createElement("j2se");
j2se.setAttribute("version", "1.8+");
Element jar = document.createElement("jar");
jar.setAttribute("href", "pdfsigner.jar");
resources.appendChild(j2se);
resources.appendChild(jar);
root.appendChild(resources);
Element resourcesWin = document.createElement("resources");
resourcesWin.setAttribute("os", "Windows");
Element j2seWin = document.createElement("j2se");
j2seWin.setAttribute("version", "1.8+");
Element jarWin = document.createElement("jar");
jarWin.setAttribute("href", "pdfsignerWin.jar");
resourcesWin.appendChild(j2seWin);
resourcesWin.appendChild(jarWin);
root.appendChild(resourcesWin);
Element appDesc = document.createElement("application-desc");
appDesc.setAttribute("main-class", "info.bukova.pdfsigner.Main");
Element argUrl = document.createElement("argument");
argUrl.appendChild(document.createTextNode(signerUrl + "/data"));
appDesc.appendChild(argUrl);
Element argSession = document.createElement("argument");
argSession.appendChild(document.createTextNode(sessionId));
appDesc.appendChild(argSession);
root.appendChild(appDesc);
System.out.println(signerUrl);
System.out.println(request.getSession().getId());
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
DOMSource source = new DOMSource(document);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
StreamResult result = new StreamResult(bos);
transformer.transform(source, result);
return bos.toByteArray();
} catch (ParserConfigurationException e) {
e.printStackTrace();
} catch (TransformerConfigurationException e) {
e.printStackTrace();
} catch (TransformerException e) {
e.printStackTrace();
}
return null;
}
}
@@ -0,0 +1,92 @@
package info.bukova.isspst.signapi;
import java.io.Serializable;
import java.util.Date;
/**
* @author Pepa Rokos
*/
public class SignData implements Serializable {
private byte[] pdfData;
private byte[] signImg;
private int areaId;
private Date signDate;
private String description;
private String numser;
private boolean signed;
private String signGuid;
private boolean signSuccess;
public byte[] getPdfData() {
return pdfData;
}
public void setPdfData(byte[] pdfData) {
this.pdfData = pdfData;
}
public Date getSignDate() {
return signDate;
}
public void setSignDate(Date signDate) {
this.signDate = signDate;
}
public String getNumser() {
return numser;
}
public void setNumser(String numser) {
this.numser = numser;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public boolean isSigned() {
return signed;
}
public void setSigned(boolean signed) {
this.signed = signed;
}
public String getSignGuid() {
return signGuid;
}
public void setSignGuid(String signGuid) {
this.signGuid = signGuid;
}
public boolean isSignSuccess() {
return signSuccess;
}
public void setSignSuccess(boolean signSuccess) {
this.signSuccess = signSuccess;
}
public byte[] getSignImg() {
return signImg;
}
public void setSignImg(byte[] signImg) {
this.signImg = signImg;
}
public int getAreaId() {
return areaId;
}
public void setAreaId(int areaId) {
this.areaId = areaId;
}
}
@@ -0,0 +1,28 @@
package info.bukova.isspst.signapi;
import java.io.Serializable;
/**
* @author Pepa Rokos
*/
public class SignUploadResponse implements Serializable {
private boolean ok;
private String errorMessage;
public boolean isOk() {
return ok;
}
public void setOk(boolean ok) {
this.ok = ok;
}
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
}
@@ -0,0 +1,148 @@
package info.bukova.isspst.signapi;
import info.bukova.isspst.Constants;
import info.bukova.isspst.SessionData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.ServletContext;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
/**
* @author Pepa Rokos
*/
@Controller
public class SigningController {
@Autowired
private SessionData sessionData;
@Autowired
private JnlpGenerator jnlpGenerator;
@Autowired
private ServletContext context;
@RequestMapping(value="/sign/data", method= RequestMethod.GET)
public void dataForSign(HttpServletResponse response, HttpServletRequest request) {
SignData data = (SignData) sessionData.getProperty(Constants.KEY_SIGN_DATA);
ObjectOutputStream os = null;
try {
os = new ObjectOutputStream(response.getOutputStream());
response.setContentType("application/x-java-serialized-object");
os.writeObject(data);
os.flush();
os.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (os != null) {
try {
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
@RequestMapping(value="/sign/data", method= RequestMethod.POST)
public void signedData(HttpServletRequest request, HttpServletResponse response) {
ObjectInputStream ois = null;
ObjectOutputStream os = null;
String error = null;
try {
ois = new ObjectInputStream(request.getInputStream());
SignData data = (SignData) ois.readObject();
sessionData.setProperty(Constants.KEY_SIGN_DATA, data);
} catch (IOException e) {
e.printStackTrace();
error = "IO error";
} catch (ClassNotFoundException e) {
e.printStackTrace();
error = "Loading error";
}
try {
SignUploadResponse resp = new SignUploadResponse();
if (error == null) {
resp.setOk(true);
} else {
resp.setOk(false);
resp.setErrorMessage(error);
}
os = new ObjectOutputStream(response.getOutputStream());
response.setContentType("application/x-java-serialized-object");
os.writeObject(resp);
os.flush();
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
@RequestMapping(value="/sign/signer.jnlp", method= RequestMethod.GET)
public void jnlp(HttpServletResponse response) {
byte[] data = jnlpGenerator.generate();
sendByte(response, data, "application/x-java-jnlp-file");
}
@RequestMapping(value="/sign/pdfsigner.jar", method= RequestMethod.GET)
public void pdfsigner(HttpServletResponse response) {
sendJar(response, "Linux");
}
@RequestMapping(value="/sign/pdfsignerWin.jar", method= RequestMethod.GET)
public void pdfsignerWin(HttpServletResponse response) {
sendJar(response, "Windows");
}
private void sendJar(HttpServletResponse response, String os) {
File inputJar;
if (os.startsWith("Windows")) {
inputJar = new File(context.getRealPath("/WEB-INF/signer/PDFSignerWin.jar"));
} else {
inputJar = new File(context.getRealPath("/WEB-INF/signer/PDFSigner.jar"));
}
try {
byte[] data = new byte[(int) inputJar.length()];
FileInputStream is = new FileInputStream(inputJar);
is.read(data);
sendByte(response, data, "application/java-archive");
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
private void sendByte(HttpServletResponse response, byte[] data, String contentType) {
ServletOutputStream os = null;
try {
os = response.getOutputStream();
response.setContentType(contentType);
response.setContentLength(data.length);
os.write(data);
os.flush();
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
@@ -19,9 +19,9 @@ public abstract class AbstractFileStorage<T> implements FileStorage<T> {
os.flush();
os.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
throw new StorageException("File cannot be found: " + file.getName(), e.getCause());
} catch (IOException e) {
e.printStackTrace();
throw new StorageException("Cannot write file: " + file.getName(), e.getCause());
} finally {
try {
if (os != null) {
@@ -0,0 +1,10 @@
package info.bukova.isspst.storage;
import info.bukova.isspst.data.SignedDocumentItem;
/**
* @author Pepa Rokos
*/
public interface ReportFileStorage extends FileStorage<SignedDocumentItem> {
}
@@ -0,0 +1,75 @@
package info.bukova.isspst.storage;
import info.bukova.isspst.data.SignedDocumentItem;
import java.io.File;
import java.util.UUID;
/**
* @author Pepa Rokos
*/
public class ReportFileStorageImpl extends AbstractFileStorage<SignedDocumentItem> implements ReportFileStorage {
private String rootPath;
public void setRootPath(String rootPath) {
this.rootPath = rootPath;
}
private String getFilePath(String fileName) {
return rootPath + "/" + fileName;
}
@Override
public void saveFile(byte[] data, SignedDocumentItem signedDocumentItem) {
String fileName = signedDocumentItem.getFileName();
if (fileName == null) {
fileName = UUID.randomUUID().toString() + ".pdf";
}
saveFileDataToPath(data, getFilePath(fileName));
signedDocumentItem.setFileName(fileName);
}
@Override
public void saveFile(File file, SignedDocumentItem fileId) {
throw new UnsupportedOperationException();
}
@Override
public void removeFile(SignedDocumentItem signedDocumentItem) {
removeFileByPath(getFilePath(signedDocumentItem.getFileName()));
}
@Override
public void moveFile(String source, String destination) {
throw new UnsupportedOperationException();
}
@Override
public void createDirectory(String dir) {
throw new UnsupportedOperationException();
}
@Override
public byte[] fileData(SignedDocumentItem signedDocumentItem) {
return fileDataFromPath(getFilePath(signedDocumentItem.getFileName()));
}
@Override
public File file(SignedDocumentItem signedDocumentItem) {
return null;
}
@Override
public boolean dirExists(String path) {
return false;
}
@Override
public String serverPath(SignedDocumentItem signedDocumentItem) {
return null;
}
}
@@ -0,0 +1,19 @@
package info.bukova.isspst.ui;
import org.zkoss.bind.annotation.Init;
public class BindingViewModel<T> extends DocumentViewModel {
private BindingForm<T> dataForm;
@Init
public void initBindingViewModel() {
super.initDocumentViewModel();
dataForm = new BindingForm<T>();
}
public BindingForm<T> getDataForm() {
return this.dataForm;
}
}
@@ -20,28 +20,26 @@ import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Window;
public class FormViewModel<T extends DataModel> extends DocumentViewModel
public class FormViewModel<T extends DataModel> extends BindingViewModel<T>
{
private T dataBean;
private Map<String, String> errMessages;
private Service<T> service;
private boolean newRec;
private ServiceConstraint<T> constraint;
private BindingForm<T> dataForm;
@Init
public void initFormViewModel(@ExecutionArgParam("selected") T selected, @ExecutionArgParam("service") Service<T> service)
{
super.initDocumentViewModel();
super.initBindingViewModel();
this.dataBean = selected;
this.service = service;
constraint = new ServiceConstraint<T>();
constraint.setDataBean(selected);
constraint.setService(service);
dataForm = new BindingForm<T>();
dataForm.setDataBean(selected);
this.getDataForm().setDataBean(selected);
if (selected.getId() == 0 && selected.getCreated() == null)
{
@@ -186,9 +184,4 @@ public class FormViewModel<T extends DataModel> extends DocumentViewModel
{
return true;
}
public BindingForm<T> getDataForm() {
return dataForm;
}
}
@@ -1,15 +1,21 @@
package info.bukova.isspst.ui.main;
import info.bukova.isspst.Constants;
import info.bukova.isspst.SessionData;
import info.bukova.isspst.StringUtils;
import info.bukova.isspst.data.RequirementBase;
import info.bukova.isspst.services.requirement.ApproveException;
import info.bukova.isspst.services.requirement.RequirementBaseService;
import info.bukova.isspst.signapi.SignData;
import info.bukova.isspst.ui.ListViewModel;
import org.zkoss.bind.BindUtils;
import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.ExecutionArgParam;
import org.zkoss.bind.annotation.Init;
import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Window;
@@ -24,6 +30,12 @@ public class ApproveDialogVM {
private RequirementBase requirement;
private ListViewModel grid;
private Date approveDate;
@WireVariable
private SessionData sessionData;
private boolean signed;
private boolean signRequired;
private boolean timer;
private byte[] signedPdf;
public Date getApproveDate() {
return approveDate;
@@ -41,12 +53,22 @@ public class ApproveDialogVM {
this.requirement = requirement;
this.grid = grid;
this.approveDate = new Date();
if (service.getNextWorkflow(requirement).getSignature() != null
&& service.getNextWorkflow(requirement).getSignature()) {
this.signed = false;
this.signRequired = true;
} else {
this.signRequired = false;
}
this.timer = false;
}
@Command
public void approve(@BindingParam("window") Window window) {
try {
service.approve(requirement, approveDate);
service.approve(requirement, approveDate, signedPdf);
BindUtils.postNotifyChange(null, null, grid, "dataBean");
BindUtils.postNotifyChange(null, null, grid, "canApprove");
BindUtils.postGlobalCommand(null, null, "reload", null);
@@ -57,4 +79,39 @@ public class ApproveDialogVM {
}
}
@Command
@NotifyChange("timer")
public void signPdf() {
if (service.prepareSignData(requirement, approveDate)) {
timer = true;
Executions.getCurrent().sendRedirect("/api/sign/signer.jnlp", "signer");
}
}
@Command
@NotifyChange({"signed", "timer"})
public void onTimer() {
String guid = (String) sessionData.getProperty(Constants.KEY_SIGN_GUID);
SignData data = (SignData) sessionData.getProperty(Constants.KEY_SIGN_DATA);
if (guid.equals(data.getSignGuid()) && data.isSignSuccess()) {
signed = true;
timer = false;
signedPdf = data.getPdfData();
} else {
signed = false;
}
}
public boolean isSigned() {
return signed;
}
public boolean isTimer() {
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.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
@@ -237,6 +236,18 @@ public class RequirementTypesVM {
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")
public void refresh() {
@@ -6,13 +6,13 @@ import info.bukova.isspst.data.Address;
import info.bukova.isspst.data.Requirement;
import info.bukova.isspst.data.SettingsData;
import info.bukova.isspst.data.Vehicle;
import info.bukova.isspst.mail.MailMessage;
import info.bukova.isspst.services.settings.GlobalSettingsService;
import info.bukova.isspst.sort.ReflectionTools;
import info.bukova.isspst.storage.FileStorage;
import info.bukova.isspst.ui.DocumentViewModel;
import info.bukova.isspst.ui.BindingViewModel;
import info.bukova.isspst.ui.LocaleConverter;
import info.bukova.isspst.ui.SecurityHelper;
import info.bukova.isspst.validators.GlobalSettingValidator;
import java.awt.image.RenderedImage;
import java.io.IOException;
@@ -23,6 +23,10 @@ import java.util.Set;
import javax.imageio.ImageIO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.zkoss.bind.SimpleForm;
import org.zkoss.bind.Validator;
import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.ContextParam;
@@ -33,8 +37,9 @@ import org.zkoss.zk.ui.event.UploadEvent;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Window;
public class GlobalSettingsVM extends DocumentViewModel
public class GlobalSettingsVM extends BindingViewModel<SettingsData>
{
private final static Logger log = LoggerFactory.getLogger(GlobalSettingsVM.class.getName());
@WireVariable
private GlobalSettingsService settingsService;
@@ -45,11 +50,16 @@ public class GlobalSettingsVM extends DocumentViewModel
@WireVariable
private FileStorage storage;
private Validator globalSettingValidator;
@Init(superclass = true)
public void init() {
public void init(@BindingParam("window") Window mainWindow) {
settings = settingsService.getSettings();
locConverter = new LocaleConverter();
setRefundsHours(settings.getRefunds().keySet());
this.getDataForm().setDataBean(this.settings);
this.globalSettingValidator = new GlobalSettingValidator(mainWindow);
}
public SettingsData getSettings() {
@@ -108,16 +118,35 @@ public class GlobalSettingsVM extends DocumentViewModel
return locConverter;
}
@Command
@NotifyChange("settings")
public void insertField(@BindingParam("field") String field, @BindingParam("message") MailMessage message) {
message.setText(message.getText() + "[" + field + "]");
private void insertString(SimpleForm form, String property, String field) {
if (form == null) {
log.warn("SimpleForm neexistuje !!!");
return;
}
Set<String> set = form.getFieldNames();
if (set.contains(property)) {
String text = (String) form.getField(property);
text += "[" + field + "]";
form.setField(property, text);
this.getDataForm().bind();
return;
}
log.warn("SimpleForm property '" + property + "' neexistuje !!!");
}
@Command
@NotifyChange("settings")
public void insertUrl(@BindingParam("message") MailMessage message) {
message.setText(message.getText() + "[-url-]");
public void insertField2Fx(@BindingParam("form") SimpleForm form, @BindingParam("property") String property, @BindingParam("field") String field) {
this.insertString(form, property, field);
}
@Command
@NotifyChange("settings")
public void insertUrl2Fx(@BindingParam("form") SimpleForm form, @BindingParam("property") String property) {
this.insertString(form, property, Constants.MAIL_URL_KEYWORD);
}
@Command
@@ -185,4 +214,12 @@ public class GlobalSettingsVM extends DocumentViewModel
return null;
}
}
public Validator getGlobalSettingValidator() {
return globalSettingValidator;
}
public void setGlobalSettingValidator(Validator globalSettingValidator) {
this.globalSettingValidator = globalSettingValidator;
}
}
@@ -0,0 +1,86 @@
package info.bukova.isspst.ui.signeddocs;
import info.bukova.isspst.data.SignedDocument;
import info.bukova.isspst.data.SignedDocumentItem;
import info.bukova.isspst.filters.SignedDocumentFilter;
import info.bukova.isspst.reporting.ReportDefinition;
import info.bukova.isspst.services.signeddocs.SignedDocumentService;
import info.bukova.isspst.ui.ListViewModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.Init;
import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Window;
import java.util.ArrayList;
import java.util.List;
public class SignedDocsList extends ListViewModel<SignedDocument>
{
@SuppressWarnings("unused")
private final static Logger log = LoggerFactory.getLogger(SignedDocsList.class.getName());
@WireVariable
protected SignedDocumentService signedDocumentService;
protected SignedDocumentItem signedDocumentItem;
protected List<SignedDocumentItem> signedDocumentItems;
@WireVariable
private ReportDefinition reportDefinition;
@Init(superclass = true)
public void initSignedDocsList() {
service = signedDocumentService;
dataClass = SignedDocument.class;
formZul = "form.zul";
dataFilter = new SignedDocumentFilter(getFilterTemplate());
this.signedDocumentItem = null;
this.signedDocumentItems = new ArrayList<SignedDocumentItem>();
}
public SignedDocumentItem getSignedDocumentItem() {
return signedDocumentItem;
}
public void setSignedDocumentItem(SignedDocumentItem signedDocumentItem) {
this.signedDocumentItem = signedDocumentItem;
}
public List<SignedDocumentItem> getSignedDocumentItems() {
return signedDocumentItems;
}
public void setSignedDocumentItems(List<SignedDocumentItem> signedDocumentItems) {
this.signedDocumentItems = signedDocumentItems;
}
@Command
@NotifyChange("signedDocumentItems")
public void onChangeSelectSignedDocs(@BindingParam("ctrl") Listbox lb) {
if (lb == null) {
return;
}
if (lb.getSelectedIndex() > -1) {
this.signedDocumentItems = this.getDataBean().getItems();
}
else {
this.signedDocumentItems = new ArrayList<SignedDocumentItem>();
}
}
@Command
public void onOpen(@BindingParam("item") SignedDocumentItem item) {
reportDefinition.clear();
reportDefinition.setSignedDocItem(item);
Window reportWin = (Window) Executions.createComponents("/app/reporting/report.zul", null, null);
reportWin.doModal();
}
}
@@ -1,11 +1,12 @@
package info.bukova.isspst.validators;
import info.bukova.isspst.StringUtils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import info.bukova.isspst.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.zkoss.bind.Property;
import org.zkoss.bind.ValidationContext;
import org.zkoss.bind.validator.AbstractValidator;
@@ -17,7 +18,11 @@ import org.zkoss.zul.Messagebox;
public abstract class BaseValidator extends AbstractValidator
{
HtmlBasedComponent htmlComponent;
private final static Logger log = LoggerFactory.getLogger(BaseValidator.class.getName());
protected ValidationContext ctx;
private HtmlBasedComponent htmlComponent;
protected Logger getLogger()
{
@@ -124,4 +129,38 @@ public abstract class BaseValidator extends AbstractValidator
return (String)value;
}
protected String getStringProperty(String propertyName) {
if (this.ctx == null) {
log.warn("Neznámý ValidationContext!!!");
return "";
}
if (StringUtils.isNullOrTrimmedEmpty(propertyName)) {
log.warn("Chybné propertyName!!!");
return "";
}
Property property = ctx.getProperties(propertyName)[0];
if (property == null) {
log.warn("Neexistující propertyName!!!");
return "";
}
Object o = property.getValue();
if (o instanceof String) {
return (String) o;
}
else {
log.warn("Chybný typ property '" + propertyName + "'!!!");
return "";
}
}
@Override
public void validate(ValidationContext ctx) {
this.ctx = ctx;
}
}
@@ -0,0 +1,155 @@
package info.bukova.isspst.validators;
import info.bukova.isspst.Constants;
import info.bukova.isspst.RegExUtils;
import info.bukova.isspst.StringUtils;
import info.bukova.isspst.data.Requirement;
import info.bukova.isspst.data.SettingsData;
import info.bukova.isspst.sort.ReflectionTools;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.zkoss.bind.ValidationContext;
import org.zkoss.zk.ui.Component;
import org.zkoss.zul.Tab;
import org.zkoss.zul.Tabbox;
import org.zkoss.zul.Window;
public class GlobalSettingValidator extends BaseValidator {
private final static Logger log = LoggerFactory.getLogger(GlobalSettingValidator.class.getName());
private Window mainWindow;
private SettingsData settingsData;
public GlobalSettingValidator(Window mainWindow) {
this.mainWindow = mainWindow;
}
private String SwitchTabs(String idIncludedPage, String idTabBox, String idTab, boolean select) {
if (this.mainWindow == null) {
log.warn("Neznámé okno globálního nastavení!!!");
return "";
}
if (StringUtils.isNullOrEmpty(idTabBox) || StringUtils.isNullOrEmpty(idTab)) {
log.warn("Neznámý Tabbox nebo Tab identifikátor globálního nastavení!!!");
return "";
}
Component component = this.mainWindow;
if (!StringUtils.isNullOrEmpty(idIncludedPage)) {
Component includedPageComponent = component.getFellow(idIncludedPage);
if (includedPageComponent != null) {
component = includedPageComponent;
}
}
Tabbox tabBox = (Tabbox) component.getFellowIfAny(idTabBox, true);
if (tabBox == null) {
log.warn("Neznámý Tabbox identifikátor '" + idTabBox + "' globálního nastavení!!!");
return "";
}
else {
Tab tab = (Tab) component.getFellowIfAny(idTab, true);
if (tab == null) {
log.warn("Neznámý Tab identifikátor '" + idTab + "' globálního nastavení!!!");
return "";
}
else {
if (select) {
tabBox.setSelectedTab(tab);
}
return tab.getLabel();
}
}
}
private void validateMailMessage(String text, String idTab, String idComponent) {
if (this.ctx == null) {
log.warn("Neznámý ValidationContext!!!");
return;
}
List<String> properties = ReflectionTools.getEntityFields(Requirement.class);
properties.add(Constants.MAIL_URL_KEYWORD);
if (StringUtils.isNullOrEmpty(text)) {
return;
}
List<String> matches;
final String regex = "\\[([^\\[\\]]*?)\\]";
matches = RegExUtils.getMatches(text, regex, 1);
String message = "";
for (int i = 0; i < matches.size(); i++) {
String propertyCandidate = matches.get(i);
if (!properties.contains(propertyCandidate)) {
message = "Vlastnost [" + propertyCandidate + "] neexistuje!";
break;
}
}
if (StringUtils.isNullOrEmpty(message)) {
text = text.replaceAll(regex, "");
}
if (StringUtils.isNullOrEmpty(message) && text.contains("[")) {
message = "Chybně použitý speciální znak '[' !\n";
}
if (StringUtils.isNullOrEmpty(message) && text.contains("]")) {
message = "Chybně použitý speciální znak ']' !\n";
}
boolean badCondition = !StringUtils.isNullOrEmpty(message);
if (badCondition) {
this.SwitchTabs("", "idTabBox", "idTabEmails", true);
this.SwitchTabs("idIncludedPageEmails", "idTabBoxEmails", idTab, true);
this.errorMsg(this.ctx, message, idComponent);
}
}
@Override
public void validate(ValidationContext ctx) {
super.validate(ctx);
// Map<String, Property[]> map = ctx.getProperties();
//
// for (Map.Entry<String, Property[]> entry : map.entrySet()) {
// String key = entry.getKey();
// Property[] values = entry.getValue();
// }
String value;
value = this.getStringProperty("newReqTemplate.text");
this.validateMailMessage(value, "idTabEmailsNewRequirement", "idEmailNewReqTemplateText");
value = this.getStringProperty("authReqTemplate.text");
this.validateMailMessage(value, "idTabEmailsAuthRequirement", "idEmailAuthReqTemplateText");
value = this.getStringProperty("confReqTemplate.text");
this.validateMailMessage(value, "idTabEmailsConfirmRequirement", "idEmailConfReqTemplateText");
value = this.getStringProperty("reqPassenger.text");
this.validateMailMessage(value, "idTabEmailsReqTripPassengers", "idEmailReqPassengerTemplateText");
value = this.getStringProperty("confReqTripPassenger.text");
this.validateMailMessage(value, "idTabEmailsConfirmTripPassengers", "idEmailConfReqTripPassengerTemplateText");
}
}
+2
View File
@@ -36,5 +36,7 @@
<mapping class="info.bukova.isspst.data.FileMetainfo"></mapping>
<mapping class="info.bukova.isspst.data.FileContent"></mapping>
<mapping class="info.bukova.isspst.data.TripBillApproval"></mapping>
<mapping class="info.bukova.isspst.data.SignedDocument"></mapping>
<mapping class="info.bukova.isspst.data.SignedDocumentItem"></mapping>
</session-factory>
</hibernate-configuration>
@@ -0,0 +1 @@
net.sf.jasperreports.extension.registry.factory.sig=info.bukova.isspst.reporting.SignaturePdfHandler
@@ -1,5 +1,11 @@
# Default file
AppName=Objednávkový systém SPŠ Třebíč
AppName=Informační systém SPŠ Třebíč
AgendaSignedDocuments=Podepsané dokumenty
ActualDocuments=Aktuální dokumenty
AgendaName=Název agendy
SigningDate=Datum podepsání
PrintReports=Tiskové sestavy
FileName=Název souboru
AgendaActRequirements=Aktuální požadavky
AgendaRequirementsHistory=Ukončené požadavky
@@ -406,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
@@ -0,0 +1,191 @@
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="orderRequirement" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="abff8784-0f6e-4a9a-bf8e-f2285ba6e75f">
<property name="ireport.zoom" value="2.0"/>
<property name="ireport.x" value="284"/>
<property name="ireport.y" value="0"/>
<parameter name="P_LOGO" class="java.lang.String"/>
<parameter name="P_MAIN_ADDRESS" class="java.lang.String"/>
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["/home/pepa/Dokumenty/dev/java/isspst/"]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[]]>
</queryString>
<field name="authorization" class="java.util.List">
<fieldDescription><![CDATA[authorization]]></fieldDescription>
</field>
<field name="centre" class="info.bukova.isspst.data.Workgroup">
<fieldDescription><![CDATA[centre]]></fieldDescription>
</field>
<field name="items" class="java.util.List">
<fieldDescription><![CDATA[items]]></fieldDescription>
</field>
<field name="ownedBy" class="info.bukova.isspst.data.User">
<fieldDescription><![CDATA[ownedBy]]></fieldDescription>
</field>
<field name="numser" class="java.lang.String">
<fieldDescription><![CDATA[numser]]></fieldDescription>
</field>
<field name="reqDate" class="java.util.Date">
<fieldDescription><![CDATA[reqDate]]></fieldDescription>
</field>
<field name="sumTotal" class="java.math.BigDecimal">
<fieldDescription><![CDATA[sumTotal]]></fieldDescription>
</field>
<field name="workgroup" class="info.bukova.isspst.data.Workgroup">
<fieldDescription><![CDATA[workgroup]]></fieldDescription>
</field>
<field name="description" class="java.lang.String">
<fieldDescription><![CDATA[description]]></fieldDescription>
</field>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="54" splitType="Stretch">
<image onErrorType="Blank">
<reportElement uuid="692a2c5d-a058-4f16-8c03-dd0739d45ffb" x="0" y="0" width="100" height="54">
<printWhenExpression><![CDATA[$P{P_LOGO} != null]]></printWhenExpression>
</reportElement>
<imageExpression><![CDATA[$P{P_LOGO}]]></imageExpression>
</image>
<textField isBlankWhenNull="true">
<reportElement uuid="42aa4bd4-8b58-4e06-b7d9-ab3f1082b739" x="100" y="0" width="455" height="20"/>
<textElement textAlignment="Center">
<font isBold="true" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$P{P_MAIN_ADDRESS}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="3672bded-2358-40b4-a0f3-037e7fc50fa3" x="100" y="20" width="455" height="20"/>
<textElement textAlignment="Center">
<font isBold="true" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Protokol o předběžné kontrole]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="41" splitType="Stretch">
<textField>
<reportElement uuid="d1468362-4eba-425c-8534-f80eab528580" x="0" y="20" width="83" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{numser}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="b9b69697-354b-4cb0-a84c-a41fea872d15" x="0" y="0" width="83" height="20"/>
<textElement/>
<text><![CDATA[Poř. číslo]]></text>
</staticText>
<textField>
<reportElement uuid="09f38f15-b1e4-4975-997c-e70f19078c24" x="83" y="20" width="140" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[""+$F{centre}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="8e7dfc80-cdf7-4777-b0f2-35a98e02a339" x="223" y="20" width="140" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[""+$F{workgroup}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="2f5cd1fb-4f7e-4e9f-ba7c-b1f7b288a625" x="363" y="20" width="113" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[""+$F{ownedBy}]]></textFieldExpression>
</textField>
<textField pattern="dd. MM. yyyy">
<reportElement uuid="8eaf7add-3fe8-4115-9154-27c4b8904650" x="476" y="20" width="79" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{reqDate}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="01cebcaf-0e12-4a09-8956-590d45e19eef" x="83" y="0" width="140" height="20"/>
<textElement/>
<text><![CDATA[Středisko]]></text>
</staticText>
<staticText>
<reportElement uuid="17ac2428-7d56-411b-bcd9-7348df757b84" x="223" y="0" width="140" height="20"/>
<textElement/>
<text><![CDATA[Komise]]></text>
</staticText>
<staticText>
<reportElement uuid="f7790fa3-c39e-41ad-b94d-93c69afb14a9" x="363" y="0" width="113" height="20"/>
<textElement/>
<text><![CDATA[Vytvořil]]></text>
</staticText>
<staticText>
<reportElement uuid="93d65bd9-27b6-4952-a8eb-d57b14665d2b" x="476" y="0" width="79" height="20"/>
<textElement/>
<text><![CDATA[Datum]]></text>
</staticText>
<line>
<reportElement uuid="b93cc333-922f-404d-86d1-3af92064c807" x="0" y="40" width="555" height="1"/>
<graphicElement>
<pen lineStyle="Solid"/>
</graphicElement>
</line>
<line>
<reportElement uuid="f47cde5f-e0f7-4578-b3d7-4b1774284e0b" x="0" y="0" width="555" height="1"/>
</line>
<line>
<reportElement uuid="9ab3a189-c15e-4031-bc2e-ff329d4400c4" x="475" y="0" width="1" height="40"/>
</line>
<line>
<reportElement uuid="5c7c3117-8911-426d-ba2a-1b2ca842801d" x="362" y="0" width="1" height="40"/>
</line>
<line>
<reportElement uuid="a0968b35-779d-4b3c-9168-edfaa22e4cc3" x="554" y="0" width="1" height="40"/>
</line>
<line>
<reportElement uuid="2e919fcb-44aa-4a7a-bc86-8a6597f702e3" x="222" y="0" width="1" height="40"/>
</line>
<line>
<reportElement uuid="cf230cb5-d75e-41c5-8a26-5c65fdbddd82" x="82" y="0" width="1" height="40"/>
</line>
<line>
<reportElement uuid="da4a873e-2347-4362-9f29-59eb20b6d40b" x="-1" y="0" width="1" height="41"/>
</line>
</band>
</pageHeader>
<detail>
<band height="78" splitType="Stretch">
<subreport>
<reportElement uuid="6ba491d5-dc90-4be4-b70e-d7aae44ad3ce" x="0" y="4" width="554" height="73"/>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{items})]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "orderRequirementItems.jasper"]]></subreportExpression>
</subreport>
</band>
</detail>
<summary>
<band height="72" splitType="Stretch">
<staticText>
<reportElement uuid="f170d5a4-9595-4aee-8b1f-dc761b603a40" x="-1" y="10" width="59" height="20"/>
<textElement/>
<text><![CDATA[Příkazce:]]></text>
</staticText>
<genericElement>
<reportElement uuid="af57c2c2-8459-4647-9506-cc900edad55a" x="61" y="0" width="148" height="42"/>
<genericElementType namespace="urn:sig:sig" name="signature"/>
<genericElementParameter name="index">
<valueExpression><![CDATA[1]]></valueExpression>
</genericElementParameter>
</genericElement>
<staticText>
<reportElement uuid="c33d945b-9a1e-456a-bf36-c3e761540b78" x="223" y="10" width="100" height="20"/>
<textElement/>
<text><![CDATA[Správce rozpočtu:]]></text>
</staticText>
<genericElement>
<reportElement uuid="13896576-2961-40c4-a186-b89f54676644" x="323" y="0" width="148" height="42"/>
<genericElementType namespace="urn:sig:sig" name="signature"/>
<genericElementParameter name="index">
<valueExpression><![CDATA[3]]></valueExpression>
</genericElementParameter>
</genericElement>
<staticText>
<reportElement uuid="f37ccd3c-f71f-4c6e-a850-a9699f73e867" x="-1" y="52" width="555" height="20"/>
<textElement/>
<text><![CDATA[Pověření pracovníci potvrzují svými podpisy provedení předběžné kontroly v souladu se zákonem č. 320/2001 Sb.]]></text>
</staticText>
</band>
</summary>
</jasperReport>
@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="orderRequirementItems" pageWidth="552" pageHeight="842" columnWidth="552" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="7908f48d-e554-48b1-b4dd-c11ef78facbd">
<property name="ireport.zoom" value="1.5"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="textItem" class="java.lang.String">
<fieldDescription><![CDATA[textItem]]></fieldDescription>
</field>
<field name="quantity" class="java.math.BigDecimal">
<fieldDescription><![CDATA[quantity]]></fieldDescription>
</field>
<field name="total" class="java.math.BigDecimal">
<fieldDescription><![CDATA[total]]></fieldDescription>
</field>
<field name="description" class="java.lang.String">
<fieldDescription><![CDATA[description]]></fieldDescription>
</field>
<variable name="sumTotal" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{total}]]></variableExpression>
</variable>
<background>
<band splitType="Stretch"/>
</background>
<columnHeader>
<band height="31" splitType="Stretch">
<staticText>
<reportElement uuid="a09b3d2e-cf95-4881-93c6-708e11b6c085" x="2" y="2" width="211" height="29"/>
<textElement verticalAlignment="Middle">
<font size="10" isBold="false"/>
</textElement>
<text><![CDATA[Text položky]]></text>
</staticText>
<staticText>
<reportElement uuid="1b89a66f-1905-4c2c-a60a-8c493f7a7d9d" x="215" y="2" width="61" height="29"/>
<textElement verticalAlignment="Middle">
<font size="10" isBold="false"/>
</textElement>
<text><![CDATA[Množství]]></text>
</staticText>
<staticText>
<reportElement uuid="b38f8df2-e54a-4245-a9cb-7620ce2136f2" x="276" y="2" width="77" height="29"/>
<textElement verticalAlignment="Middle">
<font size="10" isBold="false"/>
</textElement>
<text><![CDATA[Předpokládaná celková cena]]></text>
</staticText>
<staticText>
<reportElement uuid="9ee00ce3-4d8a-4383-be96-e92301bff873" x="353" y="2" width="199" height="29"/>
<textElement verticalAlignment="Middle">
<font size="10" isBold="false"/>
</textElement>
<text><![CDATA[Poznámka]]></text>
</staticText>
<line>
<reportElement uuid="2d2a338f-570f-476c-97b0-5c6dde159fbe" x="352" y="0" width="1" height="31"/>
</line>
<line>
<reportElement uuid="6a7b4ebd-13ff-4174-b7a7-5e2d52e4556a" x="551" y="0" width="1" height="31"/>
</line>
<line>
<reportElement uuid="23a1033c-ab45-41fa-8fe0-4b7266efec08" x="275" y="0" width="1" height="31"/>
</line>
<line>
<reportElement uuid="440059ef-8740-4aa7-9a9f-444331d74065" x="214" y="0" width="1" height="31"/>
</line>
<line>
<reportElement uuid="4d61086f-7725-4cf7-bba0-084f02a4f7d1" x="0" y="0" width="1" height="31"/>
</line>
<line>
<reportElement uuid="004f8f2d-a8e6-470b-b0ca-97df8d0f82f7" x="0" y="-1" width="552" height="1"/>
</line>
<line>
<reportElement uuid="939c6d77-7055-4443-8495-e0f9ef3c231f" x="1" y="30" width="550" height="1"/>
</line>
</band>
</columnHeader>
<detail>
<band height="21" splitType="Stretch">
<textField>
<reportElement uuid="5723f178-f940-4925-ad9a-1fa697eb49c7" x="2" y="0" width="211" height="20"/>
<textElement verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{textItem}]]></textFieldExpression>
</textField>
<textField pattern="###0.00;-###0.00">
<reportElement uuid="6ff7e0cc-488f-4195-bccc-69b3e155cc13" x="276" y="0" width="76" height="20"/>
<textElement textAlignment="Right" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{total}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement uuid="dd95129e-6e74-4421-86e4-35484ebccdb0" x="353" y="0" width="199" height="20"/>
<textElement verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{description}]]></textFieldExpression>
</textField>
<textField pattern="###0.00;-###0.00">
<reportElement uuid="557ae236-bf5e-44b3-ba24-84c68fbeb5c5" x="215" y="0" width="60" height="20"/>
<textElement textAlignment="Right" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{quantity}]]></textFieldExpression>
</textField>
<line>
<reportElement uuid="8c57dfc4-31ce-44d4-b7b1-879b52dfb0fa" x="0" y="20" width="552" height="1"/>
</line>
<line>
<reportElement uuid="ffd7b1b5-43a6-4514-b4f4-12c7ab88a240" x="0" y="0" width="1" height="20"/>
</line>
<line>
<reportElement uuid="a11c2dbf-c5ee-4149-bde7-02166952e438" x="214" y="0" width="1" height="20"/>
</line>
<line>
<reportElement uuid="ee379730-e4de-4d94-9089-5f1e1de0533c" x="275" y="0" width="1" height="20"/>
</line>
<line>
<reportElement uuid="7e562dde-1389-4dad-9dce-bc746cbf86e1" x="352" y="0" width="1" height="20"/>
</line>
<line>
<reportElement uuid="3f1e7aab-88dd-4a0c-9da2-3d20d93e1ace" x="551" y="0" width="1" height="20"/>
</line>
</band>
</detail>
<summary>
<band height="21" splitType="Stretch">
<textField pattern="###0.00;-###0.00">
<reportElement uuid="1d885404-1f6d-4249-ba4d-80ded0762cc8" x="276" y="0" width="76" height="20"/>
<textElement textAlignment="Right" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$V{sumTotal}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="078354a7-cce2-4bd5-9e2c-a410d73e23fc" x="215" y="0" width="61" height="20"/>
<textElement verticalAlignment="Middle"/>
<text><![CDATA[Celkem]]></text>
</staticText>
</band>
</summary>
</jasperReport>
Binary file not shown.
+20 -30
View File
@@ -2,7 +2,7 @@
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="tripBill" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="10" bottomMargin="20" uuid="f59e8277-a431-4cdc-abaa-c82c1cf193af">
<property name="ireport.zoom" value="1.5"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="511"/>
<property name="ireport.y" value="396"/>
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["./"]]></defaultValueExpression>
</parameter>
@@ -58,12 +58,6 @@
</background>
<pageHeader>
<band height="275" splitType="Stretch">
<image onErrorType="Blank">
<reportElement uuid="f9a1f9fe-b6d4-4b1d-972a-59d43b380a5b" x="440" y="206" width="130" height="43">
<printWhenExpression><![CDATA[$P{P_PREV_APPROVER_SIGNATURE} != null]]></printWhenExpression>
</reportElement>
<imageExpression><![CDATA[$P{P_PREV_APPROVER_SIGNATURE}]]></imageExpression>
</image>
<staticText>
<reportElement uuid="6e60bd03-48b9-4555-91ab-757532d93e6a" x="10" y="61" width="143" height="20"/>
<textElement>
@@ -236,11 +230,13 @@ tuzemské pracovní cesty]]></text>
</textElement>
<textFieldExpression><![CDATA[$P{P_MAIN_ADDRESS}]]></textFieldExpression>
</textField>
<textField pattern="dd. MM. yyyy" isBlankWhenNull="false">
<reportElement uuid="d8f79af9-b603-4103-9f78-a98ef574447e" x="340" y="229" width="100" height="20"/>
<textElement verticalAlignment="Bottom"/>
<textFieldExpression><![CDATA[$P{P_PREV_APPROVE_DATE}]]></textFieldExpression>
</textField>
<genericElement>
<reportElement uuid="14ae63ff-6be2-4419-9f39-8c9c8d2daf42" x="382" y="206" width="162" height="42"/>
<genericElementType namespace="urn:sig:sig" name="signature"/>
<genericElementParameter name="index">
<valueExpression><![CDATA[1]]></valueExpression>
</genericElementParameter>
</genericElement>
</band>
</pageHeader>
<detail>
@@ -427,12 +423,6 @@ tuzemské pracovní cesty]]></text>
</reportElement>
<imageExpression><![CDATA[$P{P_PREV_APPROVER_SIGNATURE}]]></imageExpression>
</image>
<image onErrorType="Blank">
<reportElement uuid="2e42de6e-3f15-42c0-8a1d-5a21809f3193" x="290" y="103" width="130" height="46">
<printWhenExpression><![CDATA[$P{P_APPROVER_SIGNATURE} != null]]></printWhenExpression>
</reportElement>
<imageExpression><![CDATA[$P{P_APPROVER_SIGNATURE}]]></imageExpression>
</image>
<staticText>
<reportElement uuid="58e4cf15-a8e1-4b4d-b491-ad4a1825f0a3" x="281" y="5" width="30" height="15"/>
<textElement/>
@@ -472,11 +462,6 @@ tuzemské pracovní cesty]]></text>
</textElement>
<text><![CDATA[Účtovaná náhrada byla přezkoušena a upravena na Kč:]]></text>
</staticText>
<staticText>
<reportElement uuid="4aca1ec1-c2dc-47b9-a973-40ded5f52d29" x="260" y="103" width="290" height="20"/>
<textElement/>
<text><![CDATA[Datum a podpis zaměstnance, který upravil vyúčtování]]></text>
</staticText>
<line>
<reportElement uuid="2665a0ca-420d-46dc-9085-522ed3950c44" x="291" y="149" width="130" height="1"/>
</line>
@@ -571,13 +556,6 @@ tuzemské pracovní cesty]]></text>
<line>
<reportElement uuid="5e5a7c99-962e-4c99-b3ba-dbed5315f5aa" x="-1" y="-2" width="1" height="195"/>
</line>
<textField pattern="dd. MM. yyyy">
<reportElement uuid="7bbd89ae-f9e7-4359-b2df-5020b7a57456" x="292" y="135" width="100" height="13"/>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$P{P_APPROVE_DATE}]]></textFieldExpression>
</textField>
<textField pattern="dd. MM. yyyy">
<reportElement uuid="8f8ad8d2-dc49-46cc-8732-914951931569" x="440" y="135" width="100" height="15"/>
<textElement>
@@ -585,6 +563,18 @@ tuzemské pracovní cesty]]></text>
</textElement>
<textFieldExpression><![CDATA[$P{P_PREV_APPROVE_DATE}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="4aca1ec1-c2dc-47b9-a973-40ded5f52d29" x="260" y="103" width="290" height="20"/>
<textElement/>
<text><![CDATA[Datum a podpis zaměstnance, který upravil vyúčtování]]></text>
</staticText>
<genericElement>
<reportElement uuid="3753147d-3c79-4377-b296-3281ab3d54b3" x="291" y="103" width="130" height="46"/>
<genericElementType namespace="urn:sig:sig" name="signature"/>
<genericElementParameter name="index">
<valueExpression><![CDATA[2]]></valueExpression>
</genericElementParameter>
</genericElement>
</band>
</summary>
</jasperReport>
@@ -0,0 +1,353 @@
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="tripRequirement" pageWidth="612" pageHeight="792" columnWidth="572" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="0b7fa2d2-d452-4a1f-b1c0-2d8e16a22525">
<property name="ireport.zoom" value="1.5"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="387"/>
<style name="table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="Passengers" uuid="89ee82de-f017-493e-85d1-439a0ff3be72">
<queryString>
<![CDATA[]]>
</queryString>
<field name="fullName" class="java.lang.String">
<fieldDescription><![CDATA[fullName]]></fieldDescription>
</field>
</subDataset>
<subDataset name="dataset1" uuid="2030e480-17f9-4ac5-a8f1-7499b269f3b4"/>
<parameter name="P_USER_SIGNATURE" class="java.lang.String"/>
<parameter name="P_APPROVE_DATE" class="java.util.Date"/>
<parameter name="P_APPROVER_SIGNATURE" class="java.lang.String"/>
<parameter name="P_LOGO" class="java.lang.String"/>
<parameter name="P_MAIN_ADDRESS" class="java.lang.String"/>
<parameter name="P_PREV_APPROVE_DATE" class="java.util.Date"/>
<parameter name="P_PREV_APPROVER_SIGNATURE" class="java.lang.String"/>
<parameter name="SUBREPORT_DIR" class="java.lang.String"/>
<field name="ownedBy" class="info.bukova.isspst.data.User"/>
<field name="reqDate" class="java.util.Date"/>
<field name="from" class="java.lang.String"/>
<field name="tripDate" class="java.util.Date"/>
<field name="to" class="java.lang.String"/>
<field name="description" class="java.lang.String"/>
<field name="end" class="java.lang.String"/>
<field name="endDate" class="java.util.Date"/>
<field name="passengers" class="java.util.Collection"/>
<field name="foreignPersons" class="java.lang.String"/>
<field name="vehicle" class="info.bukova.isspst.data.Vehicle"/>
<field name="vehicle.code" class="java.lang.String"/>
<field name="requireDownPayment" class="java.lang.Boolean"/>
<field name="downPayment" class="java.math.BigDecimal"/>
<field name="ownedBy.address" class="info.bukova.isspst.data.UsersAddress"/>
<field name="ownedBy.address.street" class="java.lang.String"/>
<field name="ownedBy.address.houseNumber" class="java.lang.String"/>
<field name="ownedBy.address.zipCode" class="java.lang.String"/>
<field name="ownedBy.address.city" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch">
<image onErrorType="Blank">
<reportElement uuid="ef1dc796-f5c6-4036-99eb-26e7b6b7abbc" x="0" y="0" width="100" height="79" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[$P{P_LOGO} != null]]></printWhenExpression>
</reportElement>
<imageExpression><![CDATA[$P{P_LOGO}]]></imageExpression>
</image>
<textField>
<reportElement uuid="3e2074cd-220c-4c9a-b94c-a0a254cc24a6" x="100" y="0" width="471" height="34"/>
<textElement textAlignment="Center">
<font isBold="true" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$P{P_MAIN_ADDRESS}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="a7a82c52-e8b8-41cf-b13a-ebc54d30d04f" x="101" y="34" width="470" height="45"/>
<textElement textAlignment="Center" verticalAlignment="Bottom">
<font size="14" isBold="true" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[CESTOVNÍ PŘÍKAZ
k tuzemské pracovní cestě]]></text>
</staticText>
</band>
</title>
<detail>
<band height="529" splitType="Stretch">
<staticText>
<reportElement uuid="f6445d7f-1e96-4d17-9f1d-27eaa8f15022" x="0" y="7" width="143" height="20"/>
<textElement/>
<text><![CDATA[Příjmení, jméno, titul:]]></text>
</staticText>
<staticText>
<reportElement uuid="6f073490-98cc-445b-8b51-81facf335657" x="0" y="27" width="100" height="20"/>
<textElement/>
<text><![CDATA[Bydliště:]]></text>
</staticText>
<staticText>
<reportElement uuid="a3e2a5d3-ea50-48bd-94ea-4530f6624b52" x="0" y="51" width="572" height="20"/>
<textElement textAlignment="Center">
<font size="12" pdfFontName="Helvetica-Bold"/>
</textElement>
<text><![CDATA[Souhlasím s vysláním na pracovní cestu]]></text>
</staticText>
<staticText>
<reportElement uuid="306f2b85-5dc6-40a6-8c44-76ed46831680" x="0" y="76" width="143" height="20"/>
<textElement/>
<text><![CDATA[Požaduji poskytnutí zálohy:]]></text>
</staticText>
<line>
<reportElement uuid="029f1b4c-5f59-4a5e-8d3d-b644af41b657" x="301" y="121" width="271" height="1"/>
</line>
<staticText>
<reportElement uuid="2f0f450a-b89d-4862-b82e-4eb1e9861927" x="301" y="128" width="271" height="20"/>
<textElement textAlignment="Center"/>
<text><![CDATA[Datum a podpis]]></text>
</staticText>
<textField pattern="dd. MM. yyyy">
<reportElement uuid="dd5f12d3-9ce1-4565-83ed-fe9004e3a6c3" x="301" y="101" width="77" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{reqDate}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="a2912fef-ae4a-4c7e-b08c-3f5f6b92a534" x="0" y="157" width="572" height="20"/>
<textElement textAlignment="Center">
<font size="16" isBold="true" pdfFontName="Helvetica-Bold" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[PODMÍNKY PRACOVNÍ CESTY]]></text>
</staticText>
<line>
<reportElement uuid="b415fa20-91d9-4772-9b73-fd26b6cf32a3" x="0" y="177" width="572" height="1"/>
</line>
<line>
<reportElement uuid="74a5cf40-10b4-4f99-8945-5e14323a7b98" x="0" y="253" width="572" height="1"/>
</line>
<line>
<reportElement uuid="a3a337aa-8b1c-4f4f-abc0-4b5a6cba04d5" x="0" y="156" width="572" height="1"/>
</line>
<staticText>
<reportElement uuid="ed4e3928-9a68-4f61-9876-254547efa04e" x="0" y="180" width="143" height="27"/>
<textElement textAlignment="Center"/>
<text><![CDATA[Počátek cesty (místo, datum, hodina)]]></text>
</staticText>
<textField>
<reportElement uuid="ed4a676e-2647-4a91-a1b5-1ff326f50359" x="0" y="208" width="143" height="20"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{from}]]></textFieldExpression>
</textField>
<textField pattern="dd. MM. yyyy">
<reportElement uuid="fd80824e-0a50-4e37-abd5-1c8bf92ded4a" x="0" y="228" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{tripDate}]]></textFieldExpression>
</textField>
<textField pattern="hh:mm">
<reportElement uuid="4d004341-3dc5-4b77-a0f2-d93c93aff176" x="90" y="228" width="53" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{tripDate}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="36c8b801-3fdf-4464-99d7-4f07539d76f8" x="143" y="180" width="143" height="27"/>
<textElement textAlignment="Center"/>
<text><![CDATA[Místo jednání]]></text>
</staticText>
<textField>
<reportElement uuid="6e9e44fe-3022-4802-854e-607238cb21be" x="143" y="208" width="143" height="20"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{to}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="398372d7-7995-42fa-a53a-f50b0f8936db" x="286" y="179" width="143" height="27"/>
<textElement textAlignment="Center"/>
<text><![CDATA[Účel cesty]]></text>
</staticText>
<staticText>
<reportElement uuid="3dbc8b8d-7ac4-40d8-b43c-89e81d26f15c" x="429" y="180" width="143" height="26"/>
<textElement textAlignment="Center"/>
<text><![CDATA[Konec cesty (místo, datum)]]></text>
</staticText>
<textField isBlankWhenNull="true">
<reportElement uuid="3b52420d-1c84-4042-bc88-16f4f36a3af8" x="286" y="208" width="143" height="40"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{description}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="3e9b796b-fc9e-42e4-93d6-a966ce78c771" x="429" y="208" width="143" height="20"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{end}]]></textFieldExpression>
</textField>
<textField pattern="dd. MM. yyyy">
<reportElement uuid="6ae75bed-b03b-4857-b624-71daeb35513d" x="429" y="228" width="143" height="20"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{endDate}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="ad778808-c5cc-419c-b34f-fc84effc1958" x="186" y="7" width="181" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{ownedBy}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="deafc33f-99ed-483e-8682-57a18872941d" x="0" y="265" width="143" height="20"/>
<textElement/>
<text><![CDATA[Spolucestující:]]></text>
</staticText>
<staticText>
<reportElement uuid="ab2fbb7c-28d3-4e6b-beb9-93c6fc8745c8" x="0" y="307" width="348" height="20"/>
<textElement/>
<text><![CDATA[Určený dopravní prostředek (u vlastního vozidla druh a reg. značka):]]></text>
</staticText>
<textField>
<reportElement uuid="1a52f009-c560-443a-9b84-cd9502b6b0c5" x="348" y="307" width="60" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{vehicle.code}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="8355e20a-124b-4c63-ab9c-4d64be5b912e" x="0" y="327" width="572" height="40"/>
<textElement textAlignment="Center"/>
<text><![CDATA[A - autobus, V - vlak
AUV - auto vlastní, AUS - auto služební, AUC - auto cizí
L - letadlo, P - pěšky, T - taxi]]></text>
</staticText>
<staticText>
<reportElement uuid="94f07671-9d8f-4542-9afe-f1c0b8ae1a02" x="0" y="369" width="143" height="20"/>
<textElement/>
<text><![CDATA[Ubytování:]]></text>
</staticText>
<staticText>
<reportElement uuid="b1cd5f7d-48fc-4f1b-82e1-69f81026b5ac" x="0" y="398" width="143" height="20"/>
<textElement/>
<text><![CDATA[Poskytnutí zálohy ve výši:]]></text>
</staticText>
<line>
<reportElement uuid="57398205-845b-4633-89db-3b0c4b31f03c" x="301" y="418" width="271" height="1"/>
</line>
<staticText>
<reportElement uuid="e33b0435-12e0-4d9f-9d3f-44f54eed9505" x="301" y="423" width="271" height="20"/>
<textElement textAlignment="Center"/>
<text><![CDATA[Datum a podpis oprávněné osoby]]></text>
</staticText>
<staticText>
<reportElement uuid="cad8d17d-5fdc-41a8-a74d-54ea34e4cdad" x="0" y="449" width="100" height="20"/>
<textElement/>
<text><![CDATA[Povolená záloha]]></text>
</staticText>
<staticText>
<reportElement uuid="2b462c95-65b1-4295-ac47-7d2ac3e16f40" x="0" y="469" width="143" height="20"/>
<textElement/>
<text><![CDATA[Pokladní doklad číslo]]></text>
</staticText>
<staticText>
<reportElement uuid="4cfe5623-901b-4508-9161-920d90cd0405" x="301" y="449" width="100" height="20"/>
<textElement/>
<text><![CDATA[Vyplacená dne:]]></text>
</staticText>
<line>
<reportElement uuid="39f180e0-0300-4087-89b2-dbd9441d1e94" x="149" y="500" width="280" height="1"/>
</line>
<staticText>
<reportElement uuid="a7218a5e-4d69-41fe-a26b-a51dd240cfb1" x="149" y="508" width="280" height="20"/>
<textElement textAlignment="Center"/>
<text><![CDATA[Podpis pokladníka]]></text>
</staticText>
<line direction="BottomUp">
<reportElement uuid="0276901c-8949-4307-a4a6-efa1a9b83341" x="571" y="-79" width="1" height="607"/>
</line>
<line direction="BottomUp">
<reportElement uuid="01ad15ce-276d-4fb8-af37-d896fa7eb77a" x="-1" y="-79" width="1" height="607"/>
</line>
<line>
<reportElement uuid="31fec8f3-7de4-4c34-934e-dbc2ad813c49" x="-1" y="-80" width="573" height="1"/>
</line>
<line>
<reportElement uuid="11f1abd0-78a2-4cee-9553-c960a59a00d3" x="-1" y="528" width="573" height="1"/>
</line>
<line>
<reportElement uuid="00689195-f270-4b32-9878-74c6d5d353cd" x="-1" y="0" width="573" height="1"/>
</line>
<line>
<reportElement uuid="0d8ef0ad-db1e-4be9-8153-b3a885fb8ace" x="0" y="148" width="572" height="1"/>
</line>
<line>
<reportElement uuid="c9713d6e-9b2e-4ce6-8837-3fbbe320fa8b" x="143" y="178" width="1" height="75"/>
</line>
<line>
<reportElement uuid="4e1fb287-81be-477a-95c2-96691d638916" x="285" y="178" width="1" height="75"/>
</line>
<line>
<reportElement uuid="bc2f55db-f6e3-46eb-81cd-1b4161ceeffd" x="428" y="178" width="1" height="75"/>
</line>
<line>
<reportElement uuid="0e93a41e-d13e-4f12-83cb-70d69bb3c0fb" x="0" y="442" width="572" height="1"/>
</line>
<staticText>
<reportElement uuid="548c1550-c12d-42b3-a297-c9be96dbb2e8" x="144" y="76" width="31" height="20">
<printWhenExpression><![CDATA[$F{requireDownPayment}]]></printWhenExpression>
</reportElement>
<textElement/>
<text><![CDATA[Ano]]></text>
</staticText>
<staticText>
<reportElement uuid="e06aba6d-b74d-4ab1-9737-1134a6ac6519" x="144" y="76" width="32" height="20">
<printWhenExpression><![CDATA[$F{requireDownPayment} == null || $F{requireDownPayment} == false]]></printWhenExpression>
</reportElement>
<textElement/>
<text><![CDATA[Ne]]></text>
</staticText>
<textField pattern="###0.00;-###0.00" isBlankWhenNull="true">
<reportElement uuid="ac95738d-56c8-4ee2-8721-cad00e1b06e4" x="144" y="398" width="57" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{downPayment}]]></textFieldExpression>
</textField>
<image onErrorType="Blank">
<reportElement uuid="954e517f-5d23-4166-b776-7c31b4409ddd" x="378" y="69" width="183" height="50">
<printWhenExpression><![CDATA[$P{P_USER_SIGNATURE} != null]]></printWhenExpression>
</reportElement>
<imageExpression><![CDATA[$P{P_USER_SIGNATURE}]]></imageExpression>
</image>
<textField pattern="dd. MM. yyyy" isBlankWhenNull="true">
<reportElement uuid="97daa8a7-dab0-4104-babb-c3889faac21a" x="301" y="399" width="77" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$P{P_PREV_APPROVE_DATE}]]></textFieldExpression>
<anchorNameExpression><![CDATA["SIGN_1"]]></anchorNameExpression>
</textField>
<textField>
<reportElement uuid="16e5c4e2-a366-4eca-ad27-7db7fef6771c" x="186" y="27" width="375" height="20">
<printWhenExpression><![CDATA[$F{ownedBy.address} != null]]></printWhenExpression>
</reportElement>
<textElement/>
<textFieldExpression><![CDATA[$F{ownedBy.address}]]></textFieldExpression>
</textField>
<subreport>
<reportElement uuid="b8144a34-f2c4-4b5a-9f48-b74b5dc99e8c" x="143" y="265" width="428" height="20"/>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{passengers})]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "tripRequirementPassengers.jasper"]]></subreportExpression>
</subreport>
<textField isBlankWhenNull="true">
<reportElement uuid="f8e2f8b5-373d-46fd-9c61-5a6c1da44351" x="143" y="285" width="428" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{foreignPersons}]]></textFieldExpression>
</textField>
<genericElement>
<reportElement uuid="c1d18650-66b9-425c-acbe-7b4e952bfd16" x="378" y="369" width="183" height="48"/>
<genericElementType namespace="urn:sig:sig" name="signature"/>
<genericElementParameter name="index">
<valueExpression><![CDATA[1]]></valueExpression>
</genericElementParameter>
</genericElement>
</band>
</detail>
</jasperReport>
Binary file not shown.
Binary file not shown.
@@ -183,6 +183,10 @@
<property name="rootPath" value="${storage.root}"/>
</bean>
<bean id="signeDocStorage" class="info.bukova.isspst.storage.ReportFileStorageImpl">
<property name="rootPath" value="${storage.signedDocuments}"/>
</bean>
<!-- Session data -->
<bean id="sessionData" class="info.bukova.isspst.SessionData" scope="session">
<aop:scoped-proxy/>
@@ -273,6 +277,10 @@
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="signedDocumentDao" class="info.bukova.isspst.dao.jpa.SignedDocumentDaoJPA">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- Business logic -->
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/>
@@ -453,4 +461,9 @@
<property name="dao" ref="tripBillApprovalDao"/>
</bean>
<bean id="jnlpGenerator" class="info.bukova.isspst.signapi.JnlpGeneratorImpl"/>
<bean id="signedDocumentService" class="info.bukova.isspst.services.signeddocs.SignedDocumentServiceImpl">
<property name="dao" ref="signedDocumentDao"/>
</bean>
</beans>
@@ -1,2 +1,3 @@
storage.root=/home/pepa/tmp/isspst
storage.fulltextIndex=/home/pepa/tmp/isspst
storage.signedDocuments=/home/pepa/tmp/isspst/signedDoc
+6
View File
@@ -61,6 +61,12 @@
<menuseparator />
<menu label="${labels.Lists}">
<menupopup>
<menuitem
image="/img/adobe-016.png"
label="${labels.AgendaSignedDocuments}"
href="/lists/signeddocs/"
disabled="${not sec:isAllGranted('PERM_READ_SIGNEDDOCS')}" />
<menuseparator />
<menuitem
image="/img/palet-024.png"
label="${labels.AgendaMaterial}"
Binary file not shown.

After

Width:  |  Height:  |  Size: 803 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 790 B

+216
View File
@@ -0,0 +1,216 @@
<?page contentType="text/html;charset=UTF-8"?>
<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">
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<window
vflex="1"
border="normal"
apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.signeddocs.SignedDocsList')">
<caption
image="/img/adobe-032.png"
zclass="form-caption"
label="${labels.AgendaSignedDocuments}" />
<tabbox
vflex="1"
orient="top">
<tabs width="500px">
<tab label="${labels.ActualDocuments}" />
<!-- tab label="${labels.Archive}" /-->
</tabs>
<tabpanels>
<tabpanel>
<include src="toolbar.zul" />
<hlayout vflex="1">
<listbox
vflex="1"
hflex="60"
selectedItem="@bind(vm.dataBean)"
onSelect="@command('onChangeSelectSignedDocs', ctrl=self)"
model="@load(vm.dataList)">
<listhead menupopup="auto">
<listheader
hflex="7"
sort="czech(agendaName)"
label="${labels.AgendaName}" />
<listheader
hflex="4"
sort="czech(numser)"
label="${labels.number}" />
<listheader
hflex="20"
sort="czech(description)"
label="${labels.OrderFormDescription}" />
<listheader
hflex="5"
onCreate="self.sort(false)"
sort="auto(signDate)"
label="${labels.SigningDate}" />
</listhead>
<auxhead visible="@load(vm.filter)">
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vm.filterTemplate.agendaName)"
instant="true"
onChange="@command('doFilter')"
maxlength="@load(vm.lengthText)"
sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vm.filterTemplate.numser)"
instant="true"
onChange="@command('doFilter')"
maxlength="@load(vm.lengthText)"
sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vm.filterTemplate.description)"
instant="true"
onChange="@command('doFilter')"
maxlength="@load(vm.lengthDescription)"
sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<datebox
value="@bind(vm.filterTemplate.signDate)"
format="${labels.DateFormat}"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox"
width="100%" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
</auxhead>
<template name="model">
<listitem>
<listcell label="@load(each.agendaName)" />
<listcell label="@load(each.numser)" />
<listcell label="@load(each.description)" />
<listcell label="@load(each.signDate) @converter('formatedDate', format=labels.DateFormat)" />
</listitem>
</template>
</listbox>
<listbox
vflex="1"
hflex="40"
selectedItem="@bind(vm.signedDocumentItem)"
model="@load(vm.signedDocumentItems)">
<listhead menupopup="auto">
<listheader
hflex="2"
sort="czech(actualReportName)"
label="${labels.PrintReports}" />
<listheader
hflex="3"
sort="czech(fileName)"
label="${labels.FileName}" />
<listheader
hflex="1"/>
</listhead>
<template name="model">
<listitem>
<listcell label="@load(each.actualReportName)" />
<listcell label="@load(each.fileName)" />
<listcell>
<button label="Otevřít" onClick="@command('onOpen', item = each)" sclass="nicebutton"/>
</listcell>
</listitem>
</template>
</listbox>
</hlayout>
</tabpanel>
<tabpanel>
<!-- listbox
vflex="1"
selectedItem="@bind(vm.selectedOrderItem)"
model="@load(vm.orderItems)">
<listhead menupopup="auto">
<listheader
hflex="7"
sort="czech(code)"
label="${labels.RequirementItemCode}" />
<listheader
hflex="15"
sort="czech(name)"
label="${labels.RequirementItemName}" />
<listheader
hflex="20"
sort="czech(textItem)"
label="${labels.RequirementItemText}" />
<listheader
hflex="5"
sort="auto(quantity)"
align="right"
label="${labels.RequirementItemQuantity}" />
<listheader
hflex="5"
sort="auto(munit.name)"
label="${labels.RequirementItemMUnit}" />
<listheader
hflex="7"
align="right"
sort="auto(unitPrice)"
label="${labels.RequirementItemUnitPrice}" />
<listheader
hflex="7"
align="right"
sort="auto(total)"
label="${labels.RequirementItemTotal}" />
<listheader
hflex="15"
sort="czech(description)"
label="${labels.RequirementItemDescription}" />
<listheader
hflex="5"
sort="auto(reqItem.orderNum)"
label="${labels.OrderAbr}" />
</listhead>
<template name="model">
<listitem>
<listcell label="@load(each.code)" />
<listcell label="@load(each.name)" />
<listcell label="@load(each.textItem)" />
<listcell label="@load(each.quantity) @converter(vm.standardBigDecimalConverter)" />
<listcell label="@load(each.munit.name)" />
<listcell label="@load(each.unitPrice) @converter(vm.standardBigDecimalConverter)" />
<listcell label="@load(each.total) @converter(vm.standardBigDecimalConverter)" />
<listcell label="@load(each.description)" />
<listcell label="@load(each.reqItem.orderNum)" />
</listitem>
</template>
</listbox-->
</tabpanel>
</tabpanels>
</tabbox>
</window>
</zk>
@@ -0,0 +1,10 @@
<?page title="${labels.AgendaSignedDocuments}" contentType="text/html;charset=UTF-8"?>
<zk>
<zscript>
String gridZul = "grid.zul";
</zscript>
<include src="/app/template.zhtml"/>
</zk>
@@ -0,0 +1,7 @@
<?page title="toolbar" contentType="text/html;charset=UTF-8"?>
<zk>
<toolbar>
<toolbarbutton image="/img/funnel.png" tooltiptext="${labels.ToolbarRecFilter}" id="btnFilter" onClick="@command('filter')" />
<!-- toolbarbutton image="/img/print.png" tooltiptext="${labels.ToolbarPrint}" id="btnPrint" onClick="@command('onPrint')" /-->
</toolbar>
</zk>
+7 -2
View File
@@ -17,15 +17,20 @@
<label value="${labels.RequirementApproveDate}"/>
<datebox
value="@bind(vm.approveDate)"
format="${labels.DateFormat}" />
format="${labels.DateFormat}" disabled="@load(vm.signed and vm.signRequired)"/>
</hbox>
<separator bar="true" hflex="1"/>
<hbox>
<button image="/img/approve-016.png" label="${labels.Confirm}" onClick="@command('approve', window=approveWin)" sclass="nicebutton"/>
<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 and vm.signRequired)"/>
<button image="~./zul/img/misc/drag-disallow.png" label="${labels.ButtonStorno}" onClick="approveWin.detach()" sclass="nicebutton"/>
</hbox>
</vbox>
<timer onTimer="@command('onTimer')" running="@load(vm.timer)" repeats="true" delay="500"/>
<iframe name="signer" width="5px" height="5px"/>
</window>
</zk>
+272 -168
View File
@@ -1,172 +1,276 @@
<?page title="email" contentType="text/html;charset=UTF-8"?>
<zk xmlns="http://www.zkoss.org/2005/zul"
<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">
<tabbox>
<tabs>
<tab label="${labels.NewRequirement}"/>
<tab label="${labels.AuthRequirement}"/>
<tab label="${labels.ConfirmRequirement}"/>
<tab label="${labels.ReqTripPassengers}"/>
<tab label="${labels.ConfirmTripPassengers}"/>
</tabs>
<tabpanels>
<tabpanel>
<grid>
<columns>
<column hflex="min"/>
<column/>
</columns>
<rows>
<row>
<label value="${labels.MailSubject}" />
<textbox
value="@bind(vm.settings.newReqTemplate.subject)"
width="100%"
maxlength="@load(vm.lengthText)"
readonly="@load(not vm.canSave)" />
</row>
<row spans="2">
<vbox>
<ckeditor toolbar="Basic" value="@bind(vm.settings.newReqTemplate.text)" width="460px" height="180px" if="${vm.canSave}"/>
<html content="@load(vm.settings.newReqTemplate.text)" width="460px" height="180px" if="${not vm.canSave}"/>
<hbox>
<button label="${labels.InsertField}" popup="fieldsNew, position=after_start" disabled="@load(not vm.canSave)"/>
<button label="${labels.GlobalSettingsInsertUrl}" onClick="@command('insertUrl', message=vm.settings.newReqTemplate)" disabled="@load(not vm.canSave)"/>
</hbox>
</vbox>
</row>
</rows>
</grid>
</tabpanel>
<tabpanel>
<grid>
<columns>
<column hflex="min"/>
<column/>
</columns>
<rows>
<row>
<label value="${labels.MailSubject}" />
<textbox
value="@bind(vm.settings.authReqTemplate.subject)"
width="100%"
maxlength="@load(vm.lengthText)"
readonly="@load(not vm.canSave)" />
</row>
<row spans="2">
<vbox>
<ckeditor toolbar="Basic" value="@bind(vm.settings.authReqTemplate.text)" width="460px" height="180px" if="${vm.canSave}" />
<html content="@load(vm.settings.authReqTemplate.text)" width="460px" height="180px" if="${not vm.canSave}"/>
<hbox>
<button label="${labels.InsertField}" popup="fieldsAuth, position=after_start" disabled="@load(not vm.canSave)"/>
<button label="${labels.GlobalSettingsInsertUrl}" onClick="@command('insertUrl', message=vm.settings.authReqTemplate)" disabled="@load(not vm.canSave)"/>
</hbox>
</vbox>
</row>
</rows>
</grid>
</tabpanel>
<tabpanel>
<grid>
<columns>
<column hflex="min"/>
<column/>
</columns>
<rows>
<row>
<label value="${labels.MailSubject}" />
<textbox
value="@bind(vm.settings.confReqTemplate.subject)"
width="100%"
maxlength="@load(vm.lengthText)"
readonly="@load(not vm.canSave)" />
</row>
<row spans="2">
<vbox>
<ckeditor toolbar="Basic" value="@bind(vm.settings.confReqTemplate.text)" width="460px" height="180px" if="${vm.canSave}" />
<html content="@load(vm.settings.confReqTemplate.text)" width="460px" height="180px" if="${not vm.canSave}"/>
<button label="${labels.InsertField}" popup="fieldsConfirm, position=after_start" disabled="@load(not vm.canSave)"/>
</vbox>
</row>
</rows>
</grid>
</tabpanel>
<tabpanel>
<grid>
<columns>
<column hflex="min"/>
<column/>
</columns>
<rows>
<row>
<label value="${labels.MailSubject}" />
<textbox
value="@bind(vm.settings.reqPassenger.subject)"
width="100%"
maxlength="@load(vm.lengthText)"
readonly="@load(not vm.canSave)" />
</row>
<row spans="2">
<vbox>
<ckeditor toolbar="Basic" value="@bind(vm.settings.reqPassenger.text)" width="460px" height="180px" if="${vm.canSave}" />
<html content="@load(vm.settings.confReqTemplate.text)" width="460px" height="180px" if="${not vm.canSave}"/>
<button label="${labels.InsertField}" popup="fieldsPassenger, position=after_start" disabled="@load(not vm.canSave)"/>
</vbox>
</row>
</rows>
</grid>
</tabpanel>
<tabpanel>
<grid>
<columns>
<column hflex="min"/>
<column/>
</columns>
<rows>
<row>
<label value="${labels.MailSubject}" />
<textbox
value="@bind(vm.settings.confReqTripPassenger.subject)"
width="100%"
maxlength="@load(vm.lengthText)"
readonly="@load(not vm.canSave)" />
</row>
<row spans="2">
<vbox>
<ckeditor toolbar="Basic" value="@bind(vm.settings.confReqTripPassenger.text)" width="460px" height="180px" if="${vm.canSave}" />
<html content="@load(vm.settings.confReqTemplate.text)" width="460px" height="180px" if="${not vm.canSave}"/>
<button label="${labels.InsertField}" popup="fieldsConfirmPass, position=after_start" disabled="@load(not vm.canSave)"/>
</vbox>
</row>
</rows>
</grid>
</tabpanel>
</tabpanels>
</tabbox>
<menupopup id="fieldsNew" children="@load(vm.requirementFields)">
<template name="children">
<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.newReqTemplate)"/>
</template>
</menupopup>
<menupopup id="fieldsAuth" children="@load(vm.requirementFields)">
<template name="children">
<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.authReqTemplate)"/>
</template>
</menupopup>
<menupopup id="fieldsConfirm" children="@load(vm.requirementFields)">
<template name="children">
<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.confReqTemplate)"/>
</template>
</menupopup>
<menupopup id="fieldsConfirmPass" children="@load(vm.requirementFields)">
<template name="children">
<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.confReqTripPassenger)"/>
</template>
</menupopup>
<menupopup id="fieldsPassenger" children="@load(vm.requirementFields)">
<template name="children">
<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.reqPassenger)"/>
</template>
</menupopup>
<tabbox id="idTabBoxEmails">
<tabs>
<tab
id="idTabEmailsNewRequirement"
label="${labels.NewRequirement}" />
<tab
id="idTabEmailsAuthRequirement"
label="${labels.AuthRequirement}" />
<tab
id="idTabEmailsConfirmRequirement"
label="${labels.ConfirmRequirement}" />
<tab
id="idTabEmailsReqTripPassengers"
label="${labels.ReqTripPassengers}" />
<tab
id="idTabEmailsConfirmTripPassengers"
label="${labels.ConfirmTripPassengers}" />
</tabs>
<tabpanels>
<tabpanel>
<grid>
<columns>
<column hflex="min" />
<column />
</columns>
<rows>
<row>
<label value="${labels.MailSubject}" />
<textbox
id="idEmailNewReqTemplateSubject"
instant="true"
value="@bind(vm.settings.newReqTemplate.subject)"
width="100%"
maxlength="@load(vm.lengthText)"
readonly="@load(not vm.canSave)" />
</row>
<row spans="2">
<vbox>
<ckeditor
toolbar="Basic"
value="@bind(fx.newReqTemplate.text)"
width="460px"
height="180px"
if="${vm.canSave}" />
<html
id="idEmailNewReqTemplateText"
content="@load(vm.settings.newReqTemplate.text)"
width="460px"
height="180px"
if="${not vm.canSave}" />
<hbox>
<button
label="${labels.InsertField}"
popup="fieldsNew, position=after_start"
disabled="@load(not vm.canSave)" />
<button
label="${labels.GlobalSettingsInsertUrl}"
onClick="@command('insertUrl2Fx', form=fx, property='newReqTemplate.text')"
disabled="@load(not vm.canSave)" />
</hbox>
</vbox>
</row>
</rows>
</grid>
</tabpanel>
<tabpanel>
<grid>
<columns>
<column hflex="min" />
<column />
</columns>
<rows>
<row>
<label value="${labels.MailSubject}" />
<textbox
value="@bind(vm.settings.authReqTemplate.subject)"
width="100%"
maxlength="@load(vm.lengthText)"
readonly="@load(not vm.canSave)" />
</row>
<row spans="2">
<vbox>
<ckeditor
toolbar="Basic"
value="@bind(fx.authReqTemplate.text)"
width="460px"
height="180px"
if="${vm.canSave}" />
<html
id="idEmailAuthReqTemplateText"
content="@load(vm.settings.authReqTemplate.text)"
width="460px"
height="180px"
if="${not vm.canSave}" />
<hbox>
<button
label="${labels.InsertField}"
popup="fieldsAuth, position=after_start"
disabled="@load(not vm.canSave)" />
<button
label="${labels.GlobalSettingsInsertUrl}"
onClick="@command('insertUrl2Fx', form=fx, property='authReqTemplate.text')"
disabled="@load(not vm.canSave)" />
</hbox>
</vbox>
</row>
</rows>
</grid>
</tabpanel>
<tabpanel>
<grid>
<columns>
<column hflex="min" />
<column />
</columns>
<rows>
<row>
<label value="${labels.MailSubject}" />
<textbox
value="@bind(vm.settings.confReqTemplate.subject)"
width="100%"
maxlength="@load(vm.lengthText)"
readonly="@load(not vm.canSave)" />
</row>
<row spans="2">
<vbox>
<ckeditor
toolbar="Basic"
value="@bind(fx.confReqTemplate.text)"
width="460px"
height="180px"
if="${vm.canSave}" />
<html
id="idEmailConfReqTemplateText"
content="@load(vm.settings.confReqTemplate.text)"
width="460px"
height="180px"
if="${not vm.canSave}" />
<button
label="${labels.InsertField}"
popup="fieldsConfirm, position=after_start"
disabled="@load(not vm.canSave)" />
</vbox>
</row>
</rows>
</grid>
</tabpanel>
<tabpanel>
<grid>
<columns>
<column hflex="min" />
<column />
</columns>
<rows>
<row>
<label value="${labels.MailSubject}" />
<textbox
value="@bind(vm.settings.reqPassenger.subject)"
width="100%"
maxlength="@load(vm.lengthText)"
readonly="@load(not vm.canSave)" />
</row>
<row spans="2">
<vbox>
<ckeditor
toolbar="Basic"
value="@bind(fx.reqPassenger.text)"
width="460px"
height="180px"
if="${vm.canSave}" />
<html
id="idEmailReqPassengerTemplateText"
content="@load(vm.settings.reqPassenger.text)"
width="460px"
height="180px"
if="${not vm.canSave}" />
<button
label="${labels.InsertField}"
popup="fieldsPassenger, position=after_start"
disabled="@load(not vm.canSave)" />
</vbox>
</row>
</rows>
</grid>
</tabpanel>
<tabpanel>
<grid>
<columns>
<column hflex="min" />
<column />
</columns>
<rows>
<row>
<label value="${labels.MailSubject}" />
<textbox
value="@bind(vm.settings.confReqTripPassenger.subject)"
width="100%"
maxlength="@load(vm.lengthText)"
readonly="@load(not vm.canSave)" />
</row>
<row spans="2">
<vbox>
<ckeditor
toolbar="Basic"
value="@bind(fx.confReqTripPassenger.text)"
width="460px"
height="180px"
if="${vm.canSave}" />
<html
id="idEmailConfReqTripPassengerTemplateText"
content="@load(vm.settings.confReqTripPassenger.text)"
width="460px"
height="180px"
if="${not vm.canSave}" />
<button
label="${labels.InsertField}"
popup="fieldsConfirmPass, position=after_start"
disabled="@load(not vm.canSave)" />
</vbox>
</row>
</rows>
</grid>
</tabpanel>
</tabpanels>
</tabbox>
<menupopup
id="fieldsNew"
children="@load(vm.requirementFields)">
<template name="children">
<menuitem
label="@load(each) @converter(vm.locConverter)"
onClick="@command('insertField2Fx', form=fx, property='newReqTemplate.text', field=each)" />
</template>
</menupopup>
<menupopup
id="fieldsAuth"
children="@load(vm.requirementFields)">
<template name="children">
<menuitem
label="@load(each) @converter(vm.locConverter)"
onClick="@command('insertField2Fx', form=fx, property='authReqTemplate.text', field=each)" />
</template>
</menupopup>
<menupopup
id="fieldsConfirm"
children="@load(vm.requirementFields)">
<template name="children">
<menuitem
label="@load(each) @converter(vm.locConverter)"
onClick="@command('insertField2Fx', form=fx, property='confReqTemplate.text', field=each)" />
</template>
</menupopup>
<menupopup
id="fieldsConfirmPass"
children="@load(vm.requirementFields)">
<template name="children">
<menuitem
label="@load(each) @converter(vm.locConverter)"
onClick="@command('insertField2Fx', form=fx, property='confReqTripPassenger.text', field=each)" />
</template>
</menupopup>
<menupopup
id="fieldsPassenger"
children="@load(vm.requirementFields)">
<template name="children">
<menuitem
label="@load(each) @converter(vm.locConverter)"
onClick="@command('insertField2Fx', form=fx, property='reqPassenger.text', field=each)" />
</template>
</menupopup>
</zk>
+10 -3
View File
@@ -5,7 +5,9 @@
border="normal"
closable="true"
apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.settings.GlobalSettingsVM')"
viewModel="@id('vm') @init('info.bukova.isspst.ui.settings.GlobalSettingsVM', window=editWin)"
form="@id('fx') @init(vm.dataForm) @load(vm.settings) @save(vm.settings, before='save') @validator(vm.globalSettingValidator)"
validationMessages="@id('vmsg')"
width="750px"
height="600px"
binder="@init(queueName='email')">
@@ -14,11 +16,14 @@
zclass="form-caption"
label="${labels.GlobalSettings}" />
<tabbox
id="idTabBox"
orient="vertical"
vflex="1">
<tabs width="140px">
<tab label="${labels.Requirements}" />
<tab label="${labels.EMails}" />
<tab
label="${labels.EMails}"
id="idTabEmails" />
<tab label="${labels.ContactInfo }" />
<tab label="${labels.BankInfo}" />
<tab label="${labels.TravelOrders}" />
@@ -28,7 +33,9 @@
<include src="/settings/global/requirements.zul" />
</tabpanel>
<tabpanel>
<include src="/settings/global/email.zul" />
<include
id="idIncludedPageEmails"
src="/settings/global/email.zul" />
</tabpanel>
<tabpanel>
<include src="/settings/global/address.zul" />
+32 -10
View File
@@ -1,5 +1,7 @@
<?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"
viewModel="@id('vm') @init('info.bukova.isspst.ui.requirement.RequirementTypesVM')"
vflex="1">
@@ -63,45 +65,65 @@
<groupbox mold="3d" visible="@load(not empty vm.selected)">
<caption label="${labels.Workflow}"/>
<vbox>
<label value="${labels.ContextMenu}"/>
<listbox id="wgWorkflow" model="@load(vm.selected.workflow)" droppable="workgroup"
onDrop="@command('addRoleWg', event=event)"
selectedItem="@bind(vm.wgSelWorkflow)">
<listhead>
<listheader width="50px"/>
<listheader label="${labels.WorkgroupWorkflow}"/>
</listhead>
<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"
context="limitPopUpWg"
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>
</listbox>
<listbox id="centreWorkflow" model="@load(vm.selected.workflow)" droppable="centre"
onDrop="@command('addRoleCentre', event=event)"
selectedItem="@bind(vm.centreSelWorkflow)">
<listhead>
<listheader width="50px"/>
<listheader label="${labels.CentreWorkflow}"/>
</listhead>
<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"
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>
</listbox>
</vbox>
</groupbox>
<menupopup id="limitPopUp">
<menuitem label="${labels.OverLimit}" checkmark="true"
checked="@load(not empty vm.centreSelWorkflow.limit)"
onClick="@command('overLimit', workflow=centreWorkflow.selectedItem.value)"/>
checked="@load(not empty vm.centreSelWorkflow.limit)"
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 id="limitPopUpWg">
<menuitem label="${labels.OverLimit}" checkmark="true"
checked="@load(not empty vm.wgSelWorkflow.limit)"
onClick="@command('overLimit', workflow=wgWorkflow.selectedItem.value)"/>
checked="@load(not empty vm.wgSelWorkflow.limit)"
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>
</div>
</hbox>