25 include_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
33 public $next_prev_filter =
"te.client in (1,2,3)";
35 public $cacheprospectstatus = array();
48 $this->fournisseur = 0;
60 global $user, $hookmanager;
62 $this->nb = array(
"prospects" => 0,
"customers" => 0);
65 $sql =
"SELECT count(s.rowid) as nb, s.client";
66 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
67 if (empty($user->rights->societe->client->voir) && !$user->socid) {
68 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON s.rowid = sc.fk_soc";
69 $sql .=
" WHERE sc.fk_user = ".((int) $user->id);
72 $sql .=
" ".$clause.
" s.client IN (1,2,3)";
73 $sql .=
' AND s.entity IN ('.getEntity($this->element).
')';
75 if (is_object($hookmanager)) {
76 $parameters = array();
77 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $this);
78 $sql .= $hookmanager->resPrint;
80 $sql .=
" GROUP BY s.client";
84 while ($obj = $this->
db->fetch_object(
$resql)) {
85 if ($obj->client == 1 || $obj->client == 3) {
86 $this->nb[
"customers"] += $obj->nb;
88 if ($obj->client == 2 || $obj->client == 3) {
89 $this->nb[
"prospects"] += $obj->nb;
96 $this->error = $this->
db->lasterror();
111 $sql =
"SELECT id, code, libelle as label, picto FROM ".MAIN_DB_PREFIX.
"c_stcomm";
113 $sql .=
" WHERE active = ".((int) $active);
119 $obj = $this->
db->fetch_object(
$resql);
120 $this->cacheprospectstatus[$obj->id] = array(
'id'=>$obj->id,
'code'=>$obj->code,
'label'=>($langs->trans(
"ST_".strtoupper($obj->code)) ==
"ST_".strtoupper($obj->code)) ? $obj->label : $langs->trans(
"ST_".strtoupper($obj->code)),
'picto'=>$obj->picto);
Class to manage customers or prospects.
load_state_board()
Load indicators into this->nb for board.
loadCacheOfProspStatus($active=1)
Load array of prospect status.
__construct($db)
Constructor.
Class to manage third parties objects (customers, suppliers, prospects...)
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
$conf db
API class for accounts.