From 095089d020595f6b8c20ca9661ba6d85e144f7d0 Mon Sep 17 00:00:00 2001 From: Franta Pribyl Date: Mon, 5 Oct 2015 08:32:42 +0200 Subject: [PATCH 1/3] =?UTF-8?q?U=20po=C5=BEadavk=C5=AF=20na=20n=C3=A1kup?= =?UTF-8?q?=20je=20nyn=C3=AD=20pole=20Popis=20povinn=C3=A9.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes #248 --- .../validators/RequirementFormValidator.java | 23 +++++++++++++++---- .../WEB-INF/locales/zk-label.properties | 3 +++ .../main/orders/requirements/reqForm.zul | 2 +- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/main/java/info/bukova/isspst/validators/RequirementFormValidator.java b/src/main/java/info/bukova/isspst/validators/RequirementFormValidator.java index 57e7dd55..df3532d2 100644 --- a/src/main/java/info/bukova/isspst/validators/RequirementFormValidator.java +++ b/src/main/java/info/bukova/isspst/validators/RequirementFormValidator.java @@ -22,12 +22,25 @@ public class RequirementFormValidator extends BaseValidator public void validate(ValidationContext ctx) { Property propertyCentre = ctx.getProperties("centre")[0]; - Workgroup workgroup = (Workgroup) propertyCentre.getValue(); - if (workgroup == null) - { - this.errorMsg(ctx, StringUtils.localize("RequirementCenterIsEmpty"), "idReqCenter"); - return; + if (propertyCentre != null) { + Workgroup workgroup = (Workgroup) propertyCentre.getValue(); + + if (workgroup == null) { + this.errorMsg(ctx, StringUtils.localize("RequirementCenterIsEmpty"), "idReqCenter"); + return; + } + } + + Property propertyDescription = ctx.getProperties("description")[0]; + + if (propertyDescription != null) { + String description = (String) propertyDescription.getValue(); + + if (StringUtils.isNullOrTrimmedEmpty(description)) { + this.errorMsg(ctx, StringUtils.localize("ErrMaterialOrServiceDescription"), "idDescription"); + return; + } } } } diff --git a/src/main/webapp/WEB-INF/locales/zk-label.properties b/src/main/webapp/WEB-INF/locales/zk-label.properties index d1af6cac..2e8d811e 100644 --- a/src/main/webapp/WEB-INF/locales/zk-label.properties +++ b/src/main/webapp/WEB-INF/locales/zk-label.properties @@ -419,3 +419,6 @@ 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 + +ErrMaterialOrServiceDescription=Zadejte popis požadavku. + diff --git a/src/main/webapp/main/orders/requirements/reqForm.zul b/src/main/webapp/main/orders/requirements/reqForm.zul index 3030c077..a28bc640 100644 --- a/src/main/webapp/main/orders/requirements/reqForm.zul +++ b/src/main/webapp/main/orders/requirements/reqForm.zul @@ -81,7 +81,7 @@ ${labels.RequirementsFormDescription} : Date: Mon, 5 Oct 2015 08:57:26 +0200 Subject: [PATCH 2/3] =?UTF-8?q?Popisek=20zm=C4=9Bn=C4=9Bn=20na=20"Zajist?= =?UTF-8?q?=C3=ADm=20s=C3=A1m",=20p=C5=99=C3=ADpadn=C4=9B=20ve=20sloupci?= =?UTF-8?q?=20na=20"Zaj.=20s=C3=A1m"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes #247 --- src/main/webapp/WEB-INF/locales/zk-label.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/WEB-INF/locales/zk-label.properties b/src/main/webapp/WEB-INF/locales/zk-label.properties index 2e8d811e..7dc994d5 100644 --- a/src/main/webapp/WEB-INF/locales/zk-label.properties +++ b/src/main/webapp/WEB-INF/locales/zk-label.properties @@ -351,8 +351,8 @@ SelectGroup=Vybrat skupinu... RemoveItem=Smazat Confirm=Potvrdit -StudentProject = Studentský projekt -StudentProjectAbr = St. projekt +StudentProject = Zajistím sám +StudentProjectAbr = Zaj. sám Amount=Částka Owner=Vlastník From cc374a3bf1a4efd3e3811b2cf93d0e9eaea53e93 Mon Sep 17 00:00:00 2001 From: Franta Pribyl Date: Mon, 5 Oct 2015 13:09:20 +0200 Subject: [PATCH 3/3] =?UTF-8?q?Podepsan=C3=A9=20dokumenty=20se=20nyn=C3=AD?= =?UTF-8?q?=20zobrazuj=C3=AD=20ve=20dvou=20z=C3=A1lo=C5=BEk=C3=A1ch=20-=20?= =?UTF-8?q?Aktu=C3=A1ln=C3=AD=20dokumenty=20a=20Archiv.=20V=20Archivu=20se?= =?UTF-8?q?=20zobrazuj=C3=AD=20dokumenty=20star=C5=A1=C3=AD=20ne=C5=BE=20r?= =?UTF-8?q?ok.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes #225 --- .../info/bukova/isspst/DateTimeUtils.java | 28 ++ .../signeddocs/SignedDocumentService.java | 4 + .../signeddocs/SignedDocumentServiceImpl.java | 35 +- .../ui/signeddocs/SignedDocsActualList.java | 29 ++ .../ui/signeddocs/SignedDocsArchiveList.java | 30 ++ src/main/webapp/lists/signeddocs/grid.zul | 345 +++++++----------- .../lists/signeddocs/headListActual.zul | 13 + .../lists/signeddocs/headListArchive.zul | 13 + src/main/webapp/lists/signeddocs/index.zul | 2 +- src/main/webapp/lists/signeddocs/setup.zul | 19 + .../webapp/lists/signeddocs/tabPanels.zul | 17 + 11 files changed, 315 insertions(+), 220 deletions(-) create mode 100644 src/main/java/info/bukova/isspst/ui/signeddocs/SignedDocsActualList.java create mode 100644 src/main/java/info/bukova/isspst/ui/signeddocs/SignedDocsArchiveList.java create mode 100644 src/main/webapp/lists/signeddocs/headListActual.zul create mode 100644 src/main/webapp/lists/signeddocs/headListArchive.zul create mode 100644 src/main/webapp/lists/signeddocs/setup.zul create mode 100644 src/main/webapp/lists/signeddocs/tabPanels.zul diff --git a/src/main/java/info/bukova/isspst/DateTimeUtils.java b/src/main/java/info/bukova/isspst/DateTimeUtils.java index 884c5bf7..eb57b0b9 100644 --- a/src/main/java/info/bukova/isspst/DateTimeUtils.java +++ b/src/main/java/info/bukova/isspst/DateTimeUtils.java @@ -2,6 +2,7 @@ package info.bukova.isspst; import java.util.Calendar; import java.util.Date; +import java.util.GregorianCalendar; import org.apache.commons.lang.time.DateUtils; @@ -54,4 +55,31 @@ public class DateTimeUtils { return DateTimeUtils.getDate(DateTimeUtils.getCurrDateTime()); } + + public static Calendar getCalendarDelta(Date value, int calendarType, int delta) { + if (value == null) { + value = DateTimeUtils.getCurrDate(); + } + + Calendar calendar = new GregorianCalendar(); + calendar.setTime(value); + int deltaValue = calendar.get(calendarType); + calendar.set(calendarType, deltaValue + delta); + return calendar; + } + + public static Calendar getCalendar(Date value) { + if (value == null) { + value = DateTimeUtils.getCurrDate(); + } + + Calendar calendar = new GregorianCalendar(); + calendar.setTime(value); + return calendar; + } + + public static Date getDateDelta(Date value, int calendarType, int delta) { + Calendar calendar = DateTimeUtils.getCalendarDelta(value, calendarType, delta); + return calendar.getTime(); + } } diff --git a/src/main/java/info/bukova/isspst/services/signeddocs/SignedDocumentService.java b/src/main/java/info/bukova/isspst/services/signeddocs/SignedDocumentService.java index e01e2146..fc992b08 100644 --- a/src/main/java/info/bukova/isspst/services/signeddocs/SignedDocumentService.java +++ b/src/main/java/info/bukova/isspst/services/signeddocs/SignedDocumentService.java @@ -5,6 +5,8 @@ import info.bukova.isspst.data.SignedDocument; import info.bukova.isspst.data.SignedDocumentItem; import info.bukova.isspst.services.Service; +import java.util.List; + public interface SignedDocumentService extends Service { SignedDocument getForEntity(DataModel entity); @@ -13,4 +15,6 @@ public interface SignedDocumentService extends Service { void delFromApprove(SignedDocument document); void deleteForEntity(DataModel entity); + public List getActualList(); + public List getArchiveList(); } diff --git a/src/main/java/info/bukova/isspst/services/signeddocs/SignedDocumentServiceImpl.java b/src/main/java/info/bukova/isspst/services/signeddocs/SignedDocumentServiceImpl.java index e4053e82..22803b2d 100644 --- a/src/main/java/info/bukova/isspst/services/signeddocs/SignedDocumentServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/signeddocs/SignedDocumentServiceImpl.java @@ -1,5 +1,6 @@ package info.bukova.isspst.services.signeddocs; +import info.bukova.isspst.DateTimeUtils; import info.bukova.isspst.Module; import info.bukova.isspst.ModuleUtils; import info.bukova.isspst.data.DataModel; @@ -7,15 +8,20 @@ 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 java.util.Calendar; +import java.util.Date; +import java.util.List; + +import javax.servlet.ServletContext; + import org.hibernate.Hibernate; import org.hibernate.Query; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.transaction.annotation.Transactional; -import javax.servlet.ServletContext; - public class SignedDocumentServiceImpl extends AbstractOwnedService implements SignedDocumentService { @Autowired @@ -96,5 +102,28 @@ public class SignedDocumentServiceImpl extends AbstractOwnedService getActualList() { + Query q = dao.getQuery("from SignedDocument where signDate >= :refDate"); + q.setParameter("refDate", this.getTresholdDate()); + return q.list(); + } + + @SuppressWarnings("unchecked") + @Override + @Transactional + @PreAuthorize("hasPermission(this, 'PERM_READ')") + public List getArchiveList() { + Query q = dao.getQuery("from SignedDocument where signDate < :refDate"); + q.setParameter("refDate", this.getTresholdDate()); + return q.list(); + } } diff --git a/src/main/java/info/bukova/isspst/ui/signeddocs/SignedDocsActualList.java b/src/main/java/info/bukova/isspst/ui/signeddocs/SignedDocsActualList.java new file mode 100644 index 00000000..d2ec51bb --- /dev/null +++ b/src/main/java/info/bukova/isspst/ui/signeddocs/SignedDocsActualList.java @@ -0,0 +1,29 @@ +package info.bukova.isspst.ui.signeddocs; + +import info.bukova.isspst.data.SignedDocument; + +import java.util.ArrayList; +import java.util.List; + +import org.springframework.security.access.AccessDeniedException; +import org.zkoss.bind.annotation.Init; + +public class SignedDocsActualList extends SignedDocsList { + + @Init(superclass = true) + public void SignedDocsActualListInit() { + + } + + @Override + protected List getListFromService() { + try { + return signedDocumentService.getActualList(); + } + catch (AccessDeniedException e) { + // BindUtils.postGlobalCommand(null, null, "disableCentre", null); + // e.printStackTrace(); + return new ArrayList(); + } + } +} diff --git a/src/main/java/info/bukova/isspst/ui/signeddocs/SignedDocsArchiveList.java b/src/main/java/info/bukova/isspst/ui/signeddocs/SignedDocsArchiveList.java new file mode 100644 index 00000000..17bb174d --- /dev/null +++ b/src/main/java/info/bukova/isspst/ui/signeddocs/SignedDocsArchiveList.java @@ -0,0 +1,30 @@ +package info.bukova.isspst.ui.signeddocs; + +import info.bukova.isspst.data.SignedDocument; + +import java.util.ArrayList; +import java.util.List; + +import org.springframework.security.access.AccessDeniedException; +import org.zkoss.bind.annotation.Init; + +public class SignedDocsArchiveList extends SignedDocsList { + + @Init(superclass = true) + public void SignedDocsArchiveListInit() { + + } + + @Override + protected List getListFromService() { + try { + return signedDocumentService.getArchiveList(); + } + catch (AccessDeniedException e) { + // BindUtils.postGlobalCommand(null, null, "disableCentre", null); + // e.printStackTrace(); + return new ArrayList(); + } + } + +} diff --git a/src/main/webapp/lists/signeddocs/grid.zul b/src/main/webapp/lists/signeddocs/grid.zul index e361df43..52aa0453 100644 --- a/src/main/webapp/lists/signeddocs/grid.zul +++ b/src/main/webapp/lists/signeddocs/grid.zul @@ -1,216 +1,129 @@ - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
-
- -
-
-
- -
-
- -
-
- -
-
-
- -
-
- -
-
- -
-
-
- -
-
- -
-
- -
-
-
-
- -
- - - - - - - - -
-
- - - -
-
-
-
\ No newline at end of file + + + + + + + + + + + +
+
+ +
+
+ +
+
+
+ +
+
+ +
+
+ +
+
+
+ +
+
+ +
+
+ +
+
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+ + + + + + + + +
diff --git a/src/main/webapp/lists/signeddocs/headListActual.zul b/src/main/webapp/lists/signeddocs/headListActual.zul new file mode 100644 index 00000000..c3173790 --- /dev/null +++ b/src/main/webapp/lists/signeddocs/headListActual.zul @@ -0,0 +1,13 @@ + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/lists/signeddocs/headListArchive.zul b/src/main/webapp/lists/signeddocs/headListArchive.zul new file mode 100644 index 00000000..e29b3ad8 --- /dev/null +++ b/src/main/webapp/lists/signeddocs/headListArchive.zul @@ -0,0 +1,13 @@ + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/lists/signeddocs/index.zul b/src/main/webapp/lists/signeddocs/index.zul index 044bc7f7..9304094c 100644 --- a/src/main/webapp/lists/signeddocs/index.zul +++ b/src/main/webapp/lists/signeddocs/index.zul @@ -2,7 +2,7 @@ - String gridZul = "grid.zul"; + String gridZul = "setup.zul"; diff --git a/src/main/webapp/lists/signeddocs/setup.zul b/src/main/webapp/lists/signeddocs/setup.zul new file mode 100644 index 00000000..2432fd12 --- /dev/null +++ b/src/main/webapp/lists/signeddocs/setup.zul @@ -0,0 +1,19 @@ + + + + + String gridActual = "/lists/signeddocs/headListActual.zul"; + String gridArchive = "/lists/signeddocs/headListArchive.zul"; + + + + + + \ No newline at end of file diff --git a/src/main/webapp/lists/signeddocs/tabPanels.zul b/src/main/webapp/lists/signeddocs/tabPanels.zul new file mode 100644 index 00000000..5a74b669 --- /dev/null +++ b/src/main/webapp/lists/signeddocs/tabPanels.zul @@ -0,0 +1,17 @@ + + + + + + + + + + + + + +