[ 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/product/stock/ -> liste.php (source)

   1  <?php
   2  /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2004-2005 Laurent Destailleur  <eldy@users.sourceforge.net>
   4   *
   5   * This program is free software; you can redistribute it and/or modify
   6   * it under the terms of the GNU General Public License as published by
   7   * the Free Software Foundation; either version 2 of the License, or
   8   * (at your option) any later version.
   9   *
  10   * This program is distributed in the hope that it will be useful,
  11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13   * GNU General Public License for more details.
  14   *
  15   * You should have received a copy of the GNU General Public License
  16   * along with this program; if not, write to the Free Software
  17   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18   *
  19   * $Id: liste.php,v 1.11 2005/08/31 21:29:03 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/product/stock/liste.php,v $
  21   */
  22  
  23  /**
  24          \file       htdocs/product/stock/liste.php
  25          \ingroup    stock
  26          \brief      Page liste des stocks
  27          \version    $Revision: 1.11 $
  28  */
  29  
  30  require ("./pre.inc.php");
  31  require_once ("./entrepot.class.php");
  32  
  33  $user->getrights('stocks');
  34  $langs->load("stocks");
  35  
  36  if (!$user->rights->stock->lire)
  37    accessforbidden();
  38  
  39  $sref=isset($_GET["sref"])?$_GET["sref"]:$_POST["sref"];
  40  $snom=isset($_GET["snom"])?$_GET["snom"]:$_POST["snom"];
  41  $sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"];
  42  
  43  $sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
  44  $sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
  45  if (! $sortfield) $sortfield="e.label";
  46  if (! $sortorder) $sortorder="ASC";
  47  $page = $_GET["page"];
  48  if ($page < 0) $page = 0;
  49  $limit = $conf->liste_limit;
  50  $offset = $limit * $page;
  51  
  52    
  53  $sql  = "SELECT e.rowid as ref, e.label, e.statut, e.lieu, e.address, e.cp, e.ville, e.fk_pays";
  54  $sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e";
  55  $sql .= " WHERE 1=1";
  56  if ($sref)
  57  {
  58      $sql .= " AND e.ref like '%".$sref."%'";
  59  }
  60  if ($sall)
  61  {
  62      $sql .= " AND (e.label like '%".$sall."%' OR e.description like '%".$sall."%' OR e.lieu like '%".$sall."%' OR e.address like '%".$sall."%' OR e.ville like '%".$sall."%')";
  63  }
  64  $sql .= " ORDER BY $sortfield $sortorder";
  65  $sql .= $db->plimit($limit + 1 ,$offset);
  66  
  67  $result = $db->query($sql) ;
  68  if ($result)
  69  {
  70    $num = $db->num_rows($result);
  71  
  72    $i = 0;
  73    
  74    llxHeader("","",$langs->trans("ListOfWarehouses"));
  75  
  76    print_barre_liste($langs->trans("ListOfWarehouses"), $page, "liste.php", "", $sortfield, $sortorder,'',$num);
  77  
  78    print '<table class="noborder" width="100%">';
  79  
  80    print "<tr class=\"liste_titre\">";
  81    print_liste_field_titre($langs->trans("Ref"),"liste.php", "e.label","","","",$sortfield);
  82    print_liste_field_titre($langs->trans("Status"),"liste.php", "e.statut","","","",$sortfield);
  83    print_liste_field_titre($langs->trans("LocationSummary"),"liste.php", "e.lieu","","","",$sortfield);
  84    print "</tr>\n";
  85    
  86    if ($num) {
  87        $entrepot=new Entrepot($db);
  88      
  89        $var=True;
  90        while ($i < min($num,$limit))
  91          {
  92            $objp = $db->fetch_object($result);
  93            $var=!$var;
  94            print "<tr $bc[$var]>";
  95            print '<td><a href="fiche.php?id='.$objp->ref.'">'.img_object($langs->trans("ShowWarehouse"),'stock').' '.$objp->label.'</a></td>';
  96            print '<td>'.$entrepot->LibStatut($objp->statut).'</td>';
  97            print '<td>'.$objp->lieu.'</td>';
  98            print "</tr>\n";
  99            $i++;
 100          }
 101      }
 102      
 103    $db->free($result);
 104  
 105    print "</table>";
 106  
 107  }
 108  else
 109  {
 110    dolibarr_print_error($db);
 111  }
 112  
 113  
 114  $db->close();
 115  
 116  llxFooter('$Date: 2005/08/31 21:29:03 $ - $Revision: 1.11 $');
 117  ?>


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