28 include_once DOL_DOCUMENT_ROOT.
'/core/boxes/modules_boxes.php';
29 include_once DOL_DOCUMENT_ROOT.
'/societe/class/client.class.php';
37 public $boxcode =
"lastprospects";
38 public $boximg =
"object_company";
39 public $boxlabel =
"BoxLastProspects";
40 public $depends = array(
"societe");
49 public $info_box_head = array();
50 public $info_box_contents = array();
66 if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $this->enabled = 0;
68 $this->hidden = !($user->rights->societe->lire && empty($user->socid));
79 global $user, $langs, $conf;
83 $thirdpartystatic =
new Client($this->
db);
85 $this->info_box_head = array(
'text' => $langs->trans(
"BoxTitleLastModifiedProspects", $max));
87 if ($user->rights->societe->lire)
89 $sql =
"SELECT s.rowid as socid, s.nom as name, s.name_alias";
90 $sql .=
", s.code_client, s.code_compta, s.client";
91 $sql .=
", s.logo, s.email, s.entity";
92 $sql .=
", s.fk_stcomm";
93 $sql .=
", s.datec, s.tms, s.status";
94 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
95 if (!$user->rights->societe->client->voir && !$user->socid) $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
96 $sql .=
" WHERE s.client IN (2, 3)";
97 $sql .=
" AND s.entity IN (".getEntity(
'societe').
")";
98 if (!$user->rights->societe->client->voir && !$user->socid) $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
99 if ($user->socid) $sql .=
" AND s.rowid = ".$user->socid;
100 $sql .=
" ORDER BY s.tms DESC";
101 $sql .= $this->
db->plimit($max, 0);
103 dol_syslog(get_class($this).
"::loadBox", LOG_DEBUG);
112 $objp = $this->
db->fetch_object(
$resql);
113 $datec = $this->
db->jdate($objp->datec);
114 $datem = $this->
db->jdate($objp->tms);
116 $thirdpartystatic->id = $objp->socid;
117 $thirdpartystatic->name = $objp->name;
118 $thirdpartystatic->name_alias = $objp->name_alias;
119 $thirdpartystatic->code_client = $objp->code_client;
120 $thirdpartystatic->code_compta = $objp->code_compta;
121 $thirdpartystatic->client = $objp->client;
122 $thirdpartystatic->logo = $objp->logo;
123 $thirdpartystatic->email = $objp->email;
124 $thirdpartystatic->entity = $objp->entity;
126 $this->info_box_contents[$line][] = array(
128 'text' => $thirdpartystatic->getNomUrl(1),
132 $this->info_box_contents[$line][] = array(
133 'td' =>
'class="right"',
137 $this->info_box_contents[$line][] = array(
138 'td' =>
'class="right" width="18"',
139 'text' => str_replace(
'img ',
'img height="14" ', $thirdpartystatic->LibProspCommStatut($objp->fk_stcomm, 3)),
142 $this->info_box_contents[$line][] = array(
143 'td' =>
'class="right" width="18"',
144 'text' => $thirdpartystatic->LibStatut($objp->status, 3),
151 $this->info_box_contents[$line][0] = array(
152 'td' =>
'class="center opacitymedium"',
153 'text'=> $langs->trans(
"NoRecordedProspects"),
159 $this->info_box_contents[0][0] = array(
162 'text' => ($this->
db->error().
' sql='.$sql),
166 $this->info_box_contents[0][0] = array(
167 'td' =>
'class="nohover opacitymedium left"',
168 'text' => $langs->trans(
"ReadPermissionNotAllowed")
181 public function showBox($head = null, $contents = null, $nooutput = 0)
183 return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
Class to manage customers or prospects.
__construct($db, $param= '')
Constructor.
$conf db
API class for accounts.
Class to manage the box to show last prospects.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
loadBox($max=5)
Load data into info_box_contents array to show array later.
showBox($head=null, $contents=null, $nooutput=0)
Method to show box.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.