19 package org.turro.crm.zul.sale;
21 import java.util.Collection;
22 import java.util.List;
23 import org.turro.crm.db.CrmPU;
24 import org.turro.crm.entity.SaleProspect;
25 import org.turro.crm.entity.Vendor;
26 import org.turro.elephant.context.Application;
27 import org.turro.elephant.db.WhereClause;
28 import org.turro.jpa.Dao;
29 import org.turro.plugin.filter.IFilterValue;
30 import org.turro.vendor.VendorUtil;
31 import org.turro.zkoss.filter.Filter;
39 private boolean restrict =
false;
45 this.restrict = restrict;
52 return dao.getResultList(wc);
55 private WhereClause createCriteria(List<IFilterValue> values) {
57 wc.
addClause(
"select distinct salep from SaleProspect as salep");
58 wc.
addClause(
"left join salep.attendees attendee");
61 wc.
addClause(
"left join salep.vendorProspects vendorp");
62 wc.
addClause(
"where vendorp.vendor = :vendorlimp");
64 }
else if(!Application.getApplication().isInRole(
"sale-prospect:all")) {
65 Vendor vendor = VendorUtil.getCurrent();
66 wc.
addClause(
"left join salep.vendorProspects vendorp");
67 wc.
addClause(
"left join salep.customer.ownedBy vendoro");
68 wc.
addClause(
"where (vendorp.vendor = :vendorlimp");
69 wc.
addClause(
"or vendoro.vendor = :vendorlimo)");
75 for(IFilterValue v : values) {
78 wc.
addClause(
"order by salep.prospectDate");
Collection< SaleProspect > getObjectValues(List< IFilterValue > values)
SaleProspectFilter(boolean restrict)
void addClause(String clause)
void addNamedValue(String name, Object value)
static Vendor getCurrent()