Josef Rokos 10 years ago
commit 9175a7911f

@ -0,0 +1,13 @@
package info.bukova.isspst;
public class BooleanUtils
{
public static boolean isEqualByBoolean(Boolean b1, Boolean b2)
{
boolean bool1 = ((b1 == null) ? false : b1.booleanValue());
boolean bool2 = ((b2 == null) ? false : b2.booleanValue());
boolean equals = (bool1 == bool2);
return equals;
}
}

@ -110,9 +110,6 @@ public class Order extends BaseData implements Cloneable
@Column(name = "DELIVERED")
private boolean delivered;
@Column(name = "INVOICED")
private boolean invoiced;
public Order()
{
this.items = new ArrayList<OrderItem>();
@ -225,16 +222,6 @@ public class Order extends BaseData implements Cloneable
this.delivered = delivered;
}
public boolean isInvoiced()
{
return invoiced;
}
public void setInvoiced(boolean invoiced)
{
this.invoiced = invoiced;
}
public boolean isOrdered()
{
return ordered;

@ -28,6 +28,9 @@ public class Requirement extends RequirementBase
@Column(name = "KIND")
private Long kind;
@Column(name = "PROJECT")
private Boolean project;
public Requirement()
{
this.setItems(new ArrayList<RequirementItem>());
@ -78,4 +81,39 @@ public class Requirement extends RequirementBase
{
this.kind = kind;
}
public Boolean getProject()
{
return project;
}
public void setProject(Boolean project)
{
this.project = project;
}
@Override
public boolean equals(Object obj)
{
if (obj != null)
{
if (obj instanceof Requirement)
{
Requirement item = (Requirement) obj;
int thisId = this.getId();
int itemId = item.getId();
boolean equalsId = (thisId == itemId);
if (equalsId && (thisId == 0))
{
return super.equals(obj);
}
return equalsId;
}
}
return false;
}
}

@ -45,7 +45,6 @@ public abstract class RequirementSubject implements OwnedDataModel {
@Column(name = "DESCRIPTION")
private String description;
@NotEmpty(message = "{MaterialFormCodeConstr}")
public String getCode() {
return code;
@ -140,7 +139,16 @@ public abstract class RequirementSubject implements OwnedDataModel {
{
RequirementSubject item = (RequirementSubject) obj;
return (this.getId() == item.getId());
int thisId = this.getId();
int itemId = item.getId();
boolean equalsId = (thisId == itemId);
if (equalsId && (thisId == 0))
{
return super.equals(obj);
}
return equalsId;
}
}

@ -1,5 +1,6 @@
package info.bukova.isspst.filters;
import info.bukova.isspst.BooleanUtils;
import info.bukova.isspst.DateTimeUtils;
import info.bukova.isspst.StringUtils;
import info.bukova.isspst.data.Requirement;
@ -46,7 +47,8 @@ public class RequirementFilter implements Filter<Requirement>
boolean foundDescription = StringUtils.isEqualForFilter(item.getDescription(), condition.getDescription());
boolean foundDeliveryDate = DateTimeUtils.isEqualByDateForFilter(item.getDeliveryDate(), condition.getDeliveryDate());
boolean foundUser = User.isEqualByUserForFilter(item.getOwnedBy(), condition.getOwnedBy());
return (foundNumser && foundReqDate && foundCenter && foundDescription && foundDeliveryDate && foundUser);
boolean foundProject = BooleanUtils.isEqualByBoolean(item.getProject(), condition.getProject());
return (foundNumser && foundReqDate && foundCenter && foundDescription && foundDeliveryDate && foundUser && foundProject);
}
@Factory

@ -34,8 +34,13 @@ public class ApprovedServiceImpl extends AbstractService<JoinedItem> implements
public List<JoinedItem> getAll()
{
List<Workgroup> wgList = workgroupService.getUserCentres(userService.getCurrent());
Query q = queryDao
.getQuery("select item from RequirementItem item left join item.requirement rq join rq.centre c where rq.kind is not null and rq.state = :state and c in (:wgList) and (item.orderNum Is Null or item.orderNum = '')");
Query q = queryDao.getQuery("select item "
+ "from RequirementItem item left join item.requirement rq join rq.centre c "
+ "where rq.kind is not null "
+ "and rq.state = :state "
+ "and (rq.project Is Null or rq.project = false) "
+ "and c in (:wgList) "
+ "and (item.orderNum Is Null or item.orderNum = '')");
q.setParameterList("wgList", wgList);
q.setParameter("state", RequirementState.APPROVED);
List<JoinedItem> items = new ArrayList<JoinedItem>();

@ -6,16 +6,22 @@ import org.zkoss.bind.BindContext;
import org.zkoss.bind.Converter;
import org.zkoss.zk.ui.Component;
public class BoolConverter implements Converter<String, Boolean, Component> {
public class BoolConverter implements Converter<String, Boolean, Component>
{
@Override
public Boolean coerceToBean(String str, Component component, BindContext cx) {
public Boolean coerceToBean(String str, Component component, BindContext cx)
{
return false;
}
@Override
public String coerceToUi(Boolean val, Component component, BindContext cx) {
public String coerceToUi(Boolean val, Component component, BindContext cx)
{
if (val == null)
{
val = new Boolean(false);
}
return StringUtils.localize(val.toString());
}
}

@ -17,10 +17,9 @@ public class ReqMaterialListMy extends ReqListMy
@WireVariable
protected RequirementService reqMaterialService;
@Init
public void init()
@Init(superclass = true)
public void initReqMaterialListMy()
{
super.init();
service = reqMaterialService;
formZul = "/main/orders/material/reqHeadForm.zul";
}

@ -17,10 +17,9 @@ public class ReqMaterialListMyAll extends ReqListMyAll
@WireVariable
protected RequirementService reqMaterialService;
@Init
public void init()
@Init(superclass = true)
public void initReqMaterialListMyAll()
{
super.init();
service = reqMaterialService;
formZul = "/main/orders/material/reqHeadForm.zul";
}

@ -17,10 +17,9 @@ public class ReqMaterialListMyCenters extends ReqListMyCenters
@WireVariable
protected RequirementService reqMaterialService;
@Init
public void init()
@Init(superclass = true)
public void initReqMaterialListMyCenters()
{
super.init();
service = reqMaterialService;
formZul = "/main/orders/material/reqHeadForm.zul";
}

@ -17,10 +17,9 @@ public class ReqMaterialListMyWorkgroups extends ReqListMyWorkgroups
@WireVariable
protected RequirementService reqMaterialService;
@Init
public void init()
@Init(superclass = true)
public void initReqMaterialListMyWorkgroups()
{
super.init();
service = reqMaterialService;
formZul = "/main/orders/material/reqHeadForm.zul";
}

@ -28,10 +28,9 @@ public class ReqListMy extends RequirementSubpage<Requirement>
return workgroupService.getCentres();
}
@Init
public void init()
@Init(superclass = true)
public void initReqListMy()
{
super.init();
service = requirementService;
dataClass = Requirement.class;
formZul = "/main/orders/requirements/reqForm.zul";

@ -30,10 +30,9 @@ public class ReqListMyAll extends RequirementSubpage<Requirement>
return workgroupService.getCentres();
}
@Init
public void init()
@Init(superclass = true)
public void initReqListMyAll()
{
super.init();
service = requirementService;
dataClass = Requirement.class;
formZul = "/main/orders/requirements/reqForm.zul";

@ -30,10 +30,9 @@ public class ReqListMyCenters extends RequirementSubpage<Requirement>
return workgroupService.getUserCentres(userService.getCurrent());
}
@Init
public void init()
@Init(superclass = true)
public void initReqListMyCenters()
{
super.init();
service = requirementService;
dataClass = Requirement.class;
formZul = "/main/orders/requirements/reqForm.zul";

@ -30,10 +30,9 @@ public class ReqListMyWorkgroups extends RequirementSubpage<Requirement>
return workgroupService.getCentres();
}
@Init
public void init()
@Init(superclass = true)
public void initReqListMyWorkgroups()
{
super.init();
service = requirementService;
dataClass = Requirement.class;
formZul = "/main/orders/requirements/reqForm.zul";

@ -17,10 +17,9 @@ public class ReqServicesListMy extends ReqListMy
@WireVariable
protected RequirementService reqServicesService;
@Init
public void init()
@Init(superclass = true)
public void initReqServicesListMy()
{
super.init();
service = reqServicesService;
formZul = "/main/orders/services/reqHeadForm.zul";
}

@ -17,10 +17,9 @@ public class ReqServicesListMyAll extends ReqListMyAll
@WireVariable
protected RequirementService reqServicesService;
@Init
public void init()
@Init(superclass = true)
public void initReqServicesListMyAll()
{
super.init();
service = reqServicesService;
formZul = "/main/orders/services/reqHeadForm.zul";
}

@ -17,10 +17,9 @@ public class ReqServicesListMyCenters extends ReqListMyCenters
@WireVariable
protected RequirementService reqServicesService;
@Init
public void init()
@Init(superclass = true)
public void initReqServicesListMyCenters()
{
super.init();
service = reqServicesService;
formZul = "/main/orders/services/reqHeadForm.zul";
}

@ -17,10 +17,9 @@ public class ReqServicesListMyWorkgroups extends ReqListMyWorkgroups
@WireVariable
protected RequirementService reqServicesService;
@Init
public void init()
@Init(superclass = true)
public void initReqServicesListMyWorkgroups()
{
super.init();
service = reqServicesService;
formZul = "/main/orders/services/reqHeadForm.zul";
}

@ -37,8 +37,8 @@ public class RequirementSubpage<T extends RequirementBase> extends ListViewModel
this.bigDecimalConverter = bigDecimalConverter;
}
@Init
public void init()
@Init(superclass = true)
public void initRequirementSubpage()
{
this.bigDecimalConverter = new BigDecimalConverter();
}

@ -311,6 +311,9 @@ AddItem=Přidat položku
SelectGroup=Vybrat skupinu...
RemoveItem=Smazat
StudentProject = Studentský projekt
StudentProjectAbr = St. projekt
Amount=Částka
Owner=Vlastník
CreateOrder=Vytvořit objednávku

@ -10,6 +10,14 @@
<column />
</columns>
<rows>
<row>
<cell sclass="row-title"></cell>
<cell>
<checkbox
label="${labels.StudentProject}"
checked="@bind(fx.project)" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.RequirementsFormNumberSerie} :</cell>
<cell>

@ -5,6 +5,10 @@
onAfterRender="@command('afterRender')"
selectedIndex="@bind(vm.selIndex)">
<listhead menupopup="auto">
<listheader
label="${labels.StudentProjectAbr}"
sort="auto(project)"
hflex="5" />
<listheader
label="${labels.RequirementsGridNumberSerie}"
sort="czech(numser)"
@ -34,6 +38,19 @@
<auxhead
sclass="category-center"
visible="@load(vm.filter)">
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<checkbox
label="${labels.StudentProjectAbr}"
checked="@bind(vm.filterTemplate.project)"
onClick="@command('doFilter')" />
</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">
@ -128,6 +145,7 @@
</auxhead>
<template name="model">
<listitem style="@load((each.state eq 'PARTIALLY') ? 'background-color: #fffb90' : ((each.state eq 'APPROVED') ? 'background-color: #afffb5' : ''))">
<listcell label="@load(each.project) @converter(vm.standardBoolConverter)" />
<listcell label="@load(each.numser)" />
<listcell label="@load(each.reqDate) @converter('formatedDate', format=labels.DateFormat)" />
<listcell label="@load(each.centre.fullName)" />

@ -7,6 +7,10 @@
onAfterRender="@command('afterRender')"
selectedIndex="@bind(vm.selIndex)">
<listhead menupopup="auto">
<listheader
label="${labels.StudentProjectAbr}"
sort="auto(project)"
hflex="5" />
<listheader
label="${labels.RequirementsGridNumberSerie}"
sort="czech(numser)"
@ -40,6 +44,19 @@
<auxhead
sclass="category-center"
visible="@load(vm.filter)">
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<checkbox
label="${labels.StudentProjectAbr}"
checked="@bind(vm.filterTemplate.project)"
onClick="@command('doFilter')" />
</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">
@ -155,6 +172,7 @@
</auxhead>
<template name="model">
<listitem style="@load((each.state eq 'PARTIALLY') ? 'background-color: #fffb90' : ((each.state eq 'APPROVED') ? 'background-color: #afffb5' : ''))">
<listcell label="@load(each.project) @converter(vm.standardBoolConverter)" />
<listcell label="@load(each.numser)" />
<listcell label="@load(each.reqDate) @converter('formatedDate', format=labels.DateFormat)" />
<listcell label="@load(each.centre.fullName)" />

@ -7,6 +7,10 @@
onAfterRender="@command('afterRender')"
selectedIndex="@bind(vm.selIndex)">
<listhead menupopup="auto">
<listheader
label="${labels.StudentProjectAbr}"
sort="auto(project)"
hflex="5" />
<listheader
label="${labels.RequirementsGridNumberSerie}"
sort="czech(numser)"
@ -40,6 +44,19 @@
<auxhead
sclass="category-center"
visible="@load(vm.filter)">
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<checkbox
label="${labels.StudentProjectAbr}"
checked="@bind(vm.filterTemplate.project)"
onClick="@command('doFilter')" />
</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">
@ -155,6 +172,7 @@
</auxhead>
<template name="model">
<listitem style="@load((each.state eq 'PARTIALLY') ? 'background-color: #fffb90' : ((each.state eq 'APPROVED') ? 'background-color: #afffb5' : ''))">
<listcell label="@load(each.project) @converter(vm.standardBoolConverter)" />
<listcell label="@load(each.numser)" />
<listcell label="@load(each.reqDate) @converter('formatedDate', format=labels.DateFormat)" />
<listcell label="@load(each.centre.fullName)" />

@ -7,6 +7,10 @@
onAfterRender="@command('afterRender')"
selectedIndex="@bind(vm.selIndex)">
<listhead menupopup="auto">
<listheader
label="${labels.StudentProjectAbr}"
sort="auto(project)"
hflex="5" />
<listheader
label="${labels.RequirementsGridNumberSerie}"
sort="czech(numser)"
@ -40,6 +44,19 @@
<auxhead
sclass="category-center"
visible="@load(vm.filter)">
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<checkbox
label="${labels.StudentProjectAbr}"
checked="@bind(vm.filterTemplate.project)"
onClick="@command('doFilter')" />
</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">
@ -155,6 +172,7 @@
</auxhead>
<template name="model">
<listitem style="@load((each.state eq 'PARTIALLY') ? 'background-color: #fffb90' : ((each.state eq 'APPROVED') ? 'background-color: #afffb5' : ''))">
<listcell label="@load(each.project) @converter(vm.standardBoolConverter)" />
<listcell label="@load(each.numser)" />
<listcell label="@load(each.reqDate) @converter('formatedDate', format=labels.DateFormat)" />
<listcell label="@load(each.centre.fullName)" />

Loading…
Cancel
Save