[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/includes/boxes/ -> box_fournisseurs.php (source)

   1  <?php
   2  /* Copyright (C) 2004-2005 Destailleur Laurent <eldy@users.sourceforge.net>
   3   *
   4   * This program is free software; you can redistribute it and/or modify
   5   * it under the terms of the GNU General Public License as published by
   6   * the Free Software Foundation; either version 2 of the License, or
   7   * (at your option) any later version.
   8   *
   9   * This program is distributed in the hope that it will be useful,
  10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12   * GNU General Public License for more details.
  13   *
  14   * You should have received a copy of the GNU General Public License
  15   * along with this program; if not, write to the Free Software
  16   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17   *
  18   * $Id: box_fournisseurs.php,v 1.10 2005/12/16 23:52:36 eldy Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/includes/boxes/box_fournisseurs.php,v $
  20   */
  21  
  22  /**
  23      \file       htdocs/includes/boxes/box_fournisseurs.php
  24      \ingroup    fournisseurs
  25      \brief      Module de génération de l'affichage de la box fournisseurs
  26  */
  27  
  28  include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php");
  29  
  30  
  31  class box_fournisseurs extends ModeleBoxes {
  32  
  33      var $boxcode="lastsuppliers";
  34      var $boximg="object_company";
  35      var $boxlabel;
  36      var $depends = array("fournisseur");
  37  
  38      var $info_box_head = array();
  39      var $info_box_contents = array();
  40  
  41      /**
  42       *      \brief      Constructeur de la classe
  43       */
  44      function box_fournisseurs()
  45      {
  46          global $langs;
  47          $langs->load("boxes");
  48  
  49          $this->boxlabel=$langs->trans("BoxLastSuppliers");
  50      }
  51  
  52      /**
  53       *      \brief      Charge les données en mémoire pour affichage ultérieur
  54       *      \param      $max        Nombre maximum d'enregistrements à charger
  55       */
  56      function loadBox($max=5)
  57      {
  58          global $user, $langs, $db;
  59          $langs->load("boxes");
  60  
  61          $this->info_box_head = array('text' => $langs->trans("BoxTitleLastSuppliers",$max));
  62  
  63          if ($user->rights->societe->lire)
  64          {
  65              $sql = "SELECT s.nom,s.idp";
  66              $sql .= " FROM ".MAIN_DB_PREFIX."societe as s WHERE s.fournisseur = 1";
  67              if ($user->societe_id > 0)
  68              {
  69                  $sql .= " AND s.idp = $user->societe_id";
  70              }
  71              $sql .= " ORDER BY s.datec DESC ";
  72              $sql .= $db->plimit($max, 0);
  73      
  74              $result = $db->query($sql);
  75      
  76              if ($result)
  77              {
  78                  $num = $db->num_rows();
  79      
  80                  $i = 0;
  81      
  82                  while ($i < $num)
  83                  {
  84                      $objp = $db->fetch_object($result);
  85      
  86                      $this->info_box_contents[$i][0] = array('align' => 'left',
  87                      'logo' => $this->boximg,
  88                      'text' => $objp->nom,
  89                      'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->idp);
  90      
  91                      $i++;
  92                  }
  93              }
  94              else {
  95                  dolibarr_print_error($db);
  96              }
  97          }
  98          else {
  99              $this->info_box_contents[0][0] = array('align' => 'left',
 100              'text' => $langs->trans("ReadPermissionNotAllowed"));
 101          }
 102  
 103      }
 104  
 105      function showBox()
 106      {
 107          parent::showBox($this->info_box_head, $this->info_box_contents);
 108      }
 109  
 110  }
 111  
 112  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics