27 include_once DOL_DOCUMENT_ROOT.
'/core/boxes/modules_boxes.php';
 
   35   public $boxcode = 
"lastsuppliers";
 
   36   public $boximg = 
"object_company";
 
   37   public $boxlabel = 
"BoxLastSuppliers";
 
   38   public $depends = array(
"fournisseur");
 
   47   public $info_box_head = array();
 
   48   public $info_box_contents = array();
 
   63     $this->hidden = !($user->hasRight(
'societe', 
'read') && empty($user->socid));
 
   74     global $conf, $user, $langs, $hookmanager;
 
   75     $langs->load(
"boxes");
 
   79     include_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
 
   82     $this->info_box_head = array(
'text' => $langs->trans(
"BoxTitleLastModifiedSuppliers", $max));
 
   84     if ($user->hasRight(
'societe', 
'lire')) {
 
   85       $sql = 
"SELECT s.rowid as socid, s.nom as name, s.name_alias";
 
   86       $sql .= 
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
 
   87       $sql .= 
", s.logo, s.email, s.entity";
 
   88       $sql .= 
", s.datec, s.tms, s.status";
 
   89       $sql .= 
" FROM ".MAIN_DB_PREFIX.
"societe as s";
 
   90       if (empty($user->rights->societe->client->voir) && !$user->socid) {
 
   91         $sql .= 
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
 
   93       $sql .= 
" WHERE s.fournisseur = 1";
 
   94       $sql .= 
" AND s.entity IN (".getEntity(
'societe').
")";
 
   95       if (empty($user->rights->societe->client->voir) && !$user->socid) {
 
   96         $sql .= 
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
 
   99       $parameters = array(
'socid' => $user->socid, 
'boxcode' => $this->boxcode);
 
  100       $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $thirdpartystatic); 
 
  101       if (empty($reshook)) {
 
  102         if ($user->socid > 0) {
 
  103           $sql .= 
" AND s.rowid = ".((int) $user->socid);
 
  106       $sql .= $hookmanager->resPrint;
 
  107       $sql .= 
" ORDER BY s.tms DESC ";
 
  108       $sql .= $this->
db->plimit($max, 0);
 
  110       $result = $this->
db->query($sql);
 
  112         $num = $this->
db->num_rows($result);
 
  115         while ($line < $num) {
 
  116           $objp = $this->
db->fetch_object($result);
 
  117           $datec = $this->
db->jdate($objp->datec);
 
  118           $datem = $this->
db->jdate($objp->tms);
 
  120           $thirdpartystatic->id = $objp->socid;
 
  121           $thirdpartystatic->name = $objp->name;
 
  122           $thirdpartystatic->name_alias = $objp->name_alias;
 
  123           $thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
 
  124           $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
 
  125           $thirdpartystatic->fournisseur = $objp->fournisseur;
 
  126           $thirdpartystatic->logo = $objp->logo;
 
  127           $thirdpartystatic->email = $objp->email;
 
  128           $thirdpartystatic->entity = $objp->entity;
 
  130           $this->info_box_contents[$line][] = array(
 
  132             'text' => $thirdpartystatic->getNomUrl(1, 
'', 40),
 
  136           $this->info_box_contents[$line][] = array(
 
  141           $this->info_box_contents[$line][] = array(
 
  142             'td' => 
'class="right" width="18"',
 
  143             'text' => $thirdpartystatic->LibStatut($objp->status, 3),
 
  150           $langs->load(
"suppliers");
 
  151           $this->info_box_contents[$line][0] = array(
 
  152             'td' => 
'class="center opacitymedium"',
 
  153             'text'=>$langs->trans(
"NoRecordedSuppliers"),
 
  157         $this->
db->free($result);
 
  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 suppliers.
 
Class to manage the box to show last suppliers.
 
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.
 
__construct($db, $param)
Constructor.
 
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
 
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
 
$conf db
API class for accounts.