Josef Rokos 9 years ago
commit 970928bb4e

@ -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();
}
}

@ -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> {
SignedDocument getForEntity(DataModel entity);
@ -13,4 +15,6 @@ public interface SignedDocumentService extends Service<SignedDocument> {
void delFromApprove(SignedDocument document);
void deleteForEntity(DataModel entity);
public List<SignedDocument> getActualList();
public List<SignedDocument> getArchiveList();
}

@ -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<SignedDocument> implements SignedDocumentService {
@Autowired
@ -96,5 +102,28 @@ public class SignedDocumentServiceImpl extends AbstractOwnedService<SignedDocume
}
}
private Date getTresholdDate() {
Date date = DateTimeUtils.getDateDelta(DateTimeUtils.getCurrDate(), Calendar.YEAR, -1);
return date;
}
@SuppressWarnings("unchecked")
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_READ')")
public List<SignedDocument> 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<SignedDocument> getArchiveList() {
Query q = dao.getQuery("from SignedDocument where signDate < :refDate");
q.setParameter("refDate", this.getTresholdDate());
return q.list();
}
}

@ -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<SignedDocument> getListFromService() {
try {
return signedDocumentService.getActualList();
}
catch (AccessDeniedException e) {
// BindUtils.postGlobalCommand(null, null, "disableCentre", null);
// e.printStackTrace();
return new ArrayList<SignedDocument>();
}
}
}

@ -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<SignedDocument> getListFromService() {
try {
return signedDocumentService.getArchiveList();
}
catch (AccessDeniedException e) {
// BindUtils.postGlobalCommand(null, null, "disableCentre", null);
// e.printStackTrace();
return new ArrayList<SignedDocument>();
}
}
}

@ -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;
}
}
}
}

@ -357,8 +357,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
@ -425,3 +425,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.

@ -1,216 +1,129 @@
<?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>
<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>

@ -0,0 +1,13 @@
<zk>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<window
vflex="1"
border="none"
apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.signeddocs.SignedDocsActualList')">
<include src="/lists/signeddocs/toolbar.zul" />
<include
vflex="1"
src="/lists/signeddocs/grid.zul" />
</window>
</zk>

@ -0,0 +1,13 @@
<zk>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<window
vflex="1"
border="none"
apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.signeddocs.SignedDocsArchiveList')">
<include src="/lists/signeddocs/toolbar.zul" />
<include
vflex="1"
src="/lists/signeddocs/grid.zul" />
</window>
</zk>

@ -2,7 +2,7 @@
<zk>
<zscript>
String gridZul = "grid.zul";
String gridZul = "setup.zul";
</zscript>
<include src="/app/template.zhtml"/>

@ -0,0 +1,19 @@
<?page contentType="text/html;charset=UTF-8"?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<zk>
<zscript>
String gridActual = "/lists/signeddocs/headListActual.zul";
String gridArchive = "/lists/signeddocs/headListArchive.zul";
</zscript>
<window
vflex="1"
border="normal">
<caption
src="/img/adobe-032.png"
zclass="form-caption"
label="${labels.AgendaSignedDocuments}" />
<include
vflex="1"
src="/lists/signeddocs/tabPanels.zul" />
</window>
</zk>

@ -0,0 +1,17 @@
<tabbox
apply="org.zkoss.bind.BindComposer"
orient="top"
vflex="1">
<tabs>
<tab label="${labels.ActualDocuments}" />
<tab label="${labels.Archive}" />
</tabs>
<tabpanels>
<tabpanel>
<include src="${gridActual}" />
</tabpanel>
<tabpanel>
<include src="${gridArchive}" />
</tabpanel>
</tabpanels>
</tabbox>

@ -81,7 +81,7 @@
<cell sclass="row-title">${labels.RequirementsFormDescription} :</cell>
<cell>
<textbox
id="description"
id="idDescription"
width="400px"
rows="5"
maxlength="@load(vm.lengthDescription)"

Loading…
Cancel
Save