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, ckDone;
22 private String saleActionValue =
"*";
37 wc.
addClause(
"select distinct saleAction");
38 wc.
addClause(
"from SaleAction as saleAction");
41 if(Strings.isEmpty(saleActionValue) || (ckOthers && !app.
isInRole(
"sale-prospect:all"))) {
43 wc.
addClause(
"order by saleAction.actionDate");
47 if(byParticipant ==
null) {
53 }, (saleActionValue ==
null ?
"" : saleActionValue.replaceAll(
"\\*",
"%")));
55 if(!(ckOthers && app.
isInRole(
"sale-prospect:all"))) {
59 "select co from CustomerOwner as co where co.vendor.idContact = :idOwner " +
60 "and co.customer = saleAction.vendorProspect.saleProspect.customer"
67 "select vp from VendorProspect as vp where vp.vendor.idContact = :idVendor " +
68 "and vp.saleProspect = saleAction.vendorProspect.saleProspect"
76 wc.
addClause(
"and saleAction.done = FALSE");
79 if(saleProspect !=
null) {
80 wc.
addClause(
"and saleAction.vendorProspect.saleProspect = :saleProspect");
84 wc.
addClause(
"order by saleAction.actionDate");
94 this.byParticipant = byParticipant;
102 this.ckDone = ckDone;
110 this.ckOthers = ckOthers;
114 return saleActionValue;
118 this.saleActionValue = saleActionValue;
126 this.saleProspect = saleProspect;
static IContact getIContact()
void setSaleActionValue(String saleActionValue)
void setCkOthers(boolean ckOthers)
java.util.List getSaleActionList()
WhereClause createCriteria()
void setCkDone(boolean ckDone)
void setByParticipant(IContact byParticipant)
String getSaleActionValue()
IContact getByParticipant()
void setSaleProspect(SaleProspect saleProspect)
SaleProspect getSaleProspect()
boolean isInRole(String role)
static Application getApplication()
static WhereClause getWhereClause(String[] fields, String value)
void addClause(String clause)
void addNamedValue(String name, Object value)