1 package org.turro.crm.search;
3 import org.turro.auth.Authentication;
4 import org.turro.crm.db.CrmPU;
5 import org.turro.crm.entity.SaleProspect;
6 import org.turro.elephant.context.Application;
7 import org.turro.elephant.db.SQLHelper;
8 import org.turro.elephant.db.WhereClause;
9 import org.turro.jpa.Dao;
10 import org.turro.plugin.contacts.IContact;
11 import org.zkoss.lang.Strings;
21 private boolean ckOthers;
22 private String saleProspectValue =
"*";
36 wc.
addClause(
"select distinct saleProspect from SaleProspect as saleProspect");
39 if(Strings.isEmpty(saleProspectValue) || (ckOthers && !app.
isInRole(
"sale-prospect:all"))) {
40 wc.
addClause(
"order by saleProspect.prospectDate");
44 if(byParticipant ==
null) {
49 "saleProspect.description"
50 }, (saleProspectValue ==
null ?
"" : saleProspectValue.replaceAll(
"\\*",
"%")));
52 if(!(ckOthers && app.
isInRole(
"sale-prospect:all"))) {
56 "select co from CustomerOwner as co where co.vendor.idContact = :idOwner " +
57 "and co.customer = saleProspect.customer"
64 "select vp from VendorProspect as vp where vp.vendor.idContact = :idVendor " +
65 "and vp.saleProspect = saleProspect"
72 wc.
addClause(
"order by saleProspect.prospectDate");
82 this.byParticipant = byParticipant;
90 this.ckOthers = ckOthers;
94 return saleProspectValue;
98 this.saleProspectValue = saleProspectValue;
static IContact getIContact()
String getSaleProspectValue()
void setCkOthers(boolean ckOthers)
java.util.List< SaleProspect > getSaleProspectList()
WhereClause createCriteria()
void setByParticipant(IContact byParticipant)
IContact getByParticipant()
void setSaleProspectValue(String saleProspectValue)
boolean isInRole(String role)
static Application getApplication()
static WhereClause getWhereClause(String[] fields, String value)
void addClause(String clause)
void addNamedValue(String name, Object value)