Do požadavků materiálu i servisu přidán checkbox "Studentský projekt".

Pokud je nastaven, položky požadavků nevstupují do schválených položek
požadavků.

closes #166
Verze_1.0
František Přibyl 10 years ago
parent f1ca2d11c8
commit a1c400aa27

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

@ -28,6 +28,9 @@ public class Requirement extends RequirementBase
@Column(name = "KIND") @Column(name = "KIND")
private Long kind; private Long kind;
@Column(name = "PROJECT")
private Boolean project;
public Requirement() public Requirement()
{ {
this.setItems(new ArrayList<RequirementItem>()); this.setItems(new ArrayList<RequirementItem>());
@ -78,4 +81,39 @@ public class Requirement extends RequirementBase
{ {
this.kind = kind; 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") @Column(name = "DESCRIPTION")
private String description; private String description;
@NotEmpty(message = "{MaterialFormCodeConstr}") @NotEmpty(message = "{MaterialFormCodeConstr}")
public String getCode() { public String getCode() {
return code; return code;
@ -140,7 +139,16 @@ public abstract class RequirementSubject implements OwnedDataModel {
{ {
RequirementSubject item = (RequirementSubject) obj; 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; package info.bukova.isspst.filters;
import info.bukova.isspst.BooleanUtils;
import info.bukova.isspst.DateTimeUtils; import info.bukova.isspst.DateTimeUtils;
import info.bukova.isspst.StringUtils; import info.bukova.isspst.StringUtils;
import info.bukova.isspst.data.Requirement; 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 foundDescription = StringUtils.isEqualForFilter(item.getDescription(), condition.getDescription());
boolean foundDeliveryDate = DateTimeUtils.isEqualByDateForFilter(item.getDeliveryDate(), condition.getDeliveryDate()); boolean foundDeliveryDate = DateTimeUtils.isEqualByDateForFilter(item.getDeliveryDate(), condition.getDeliveryDate());
boolean foundUser = User.isEqualByUserForFilter(item.getOwnedBy(), condition.getOwnedBy()); 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 @Factory

@ -34,8 +34,13 @@ public class ApprovedServiceImpl extends AbstractService<JoinedItem> implements
public List<JoinedItem> getAll() public List<JoinedItem> getAll()
{ {
List<Workgroup> wgList = workgroupService.getUserCentres(userService.getCurrent()); List<Workgroup> wgList = workgroupService.getUserCentres(userService.getCurrent());
Query q = queryDao Query q = queryDao.getQuery("select item "
.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 = '')"); + "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.setParameterList("wgList", wgList);
q.setParameter("state", RequirementState.APPROVED); q.setParameter("state", RequirementState.APPROVED);
List<JoinedItem> items = new ArrayList<JoinedItem>(); List<JoinedItem> items = new ArrayList<JoinedItem>();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save