diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 754f94e9d0b..2ab0d5ef492 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -9,5 +9,10 @@ Stocks=Stocks Movement=Movement Movements=Movements CorrectStock=Correct stock +ListOfWarehouses=List of warehouses ListOfStockMovements=List of stock movements -ErrorWarehouseLabelRequired=Warehouse label is required \ No newline at end of file +ErrorWarehouseLabelRequired=Warehouse label is required +StocksArea=Stocks area +Location=Lieu +LocationSummary=Short name location +NumberOfProducts=Total number of products \ No newline at end of file diff --git a/htdocs/langs/fr_FR/stocks.lang b/htdocs/langs/fr_FR/stocks.lang index 84192223327..2bfab8dc2c5 100644 --- a/htdocs/langs/fr_FR/stocks.lang +++ b/htdocs/langs/fr_FR/stocks.lang @@ -9,5 +9,10 @@ Stocks=Stocks Movement=Mouvement Movements=Mouvements CorrectStock=Corriger stock +ListOfWarehouses=Liste des entrepôts ListOfStockMovements=Liste des mouvements de stock -ErrorWarehouseLabelRequired=Le libellé de l'entrepôt est obligatoire \ No newline at end of file +ErrorWarehouseLabelRequired=Le libellé de l'entrepôt est obligatoire +StocksArea=Espace stocks +Location=Lieu +LocationSummary=Nom court du lieu +NumberOfProducts=Nombre total de produits \ No newline at end of file diff --git a/htdocs/product/stock/entrepot.class.php b/htdocs/product/stock/entrepot.class.php index a09b111028a..a4a3b2631d1 100644 --- a/htdocs/product/stock/entrepot.class.php +++ b/htdocs/product/stock/entrepot.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Laurent Destailleur +/* Copyright (C) 2003 Rodolphe Quiedeville + * Copyright (C) 2004-2005 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,7 +21,8 @@ * */ -/** \file htdocs/product/stock/entrepot.class.php +/** + \file htdocs/product/stock/entrepot.class.php \ingroup stock \brief Fichier de la classe de gestion des entrepots \version $Revision$ @@ -34,12 +35,18 @@ class Entrepot { - var $db ; - - var $id ; + var $db; + var $error; + + var $id; var $libelle; var $description; var $statut; + var $lieu; + var $address; + var $cp; + var $ville; + var $pays_id; /* * \brief Constructeur de l'objet entrepot @@ -62,23 +69,24 @@ class Entrepot { // Si libelle non defini, erreur if ($this->libelle == '') { - $this->mesg_error = "Libellé obligatoire"; + $this->error = "Libellé obligatoire"; return 0; } - if ($this->db->begin()) - { + $this->db->begin(); + $sql = "INSERT INTO ".MAIN_DB_PREFIX."entrepot (datec, fk_user_author)"; $sql .= " VALUES (now(),".$user->id.")"; - if ($this->db->query($sql) ) + $result=$this->db->query($sql); + if ($result) { $id = $this->db->last_insert_id(MAIN_DB_PREFIX."entrepot"); if ($id > 0) { $this->id = $id; - if ( $this->update($id, $user) ) + if ( $this->update($id, $user) > 0) { $this->db->commit(); return $id; @@ -86,16 +94,21 @@ class Entrepot else { $this->db->rollback(); + return -3; } - - + } + else { + $this->error="Failed to get insert id"; + return -2; } } else { + $this->error="Failed to insert warehouse"; + $this->db->rollback(); return -1; } - } + } /* @@ -105,13 +118,25 @@ class Entrepot */ function update($id, $user) { - if (strlen(trim($this->libelle))) - { + $this->libelle=trim($this->libelle); + $this->description=trim($this->description); + + $this->lieu=trim($this->lieu); + $this->address=trim($this->address); + $this->cp=trim($this->cp); + $this->ville=trim($this->ville); + $this->pays_id=trim($this->pays_id); + $sql = "UPDATE ".MAIN_DB_PREFIX."entrepot "; - $sql .= " SET label = '" . trim($this->libelle) ."'"; - $sql .= ",description = '" . trim($this->description) ."'"; + $sql .= " SET label = '" . $this->libelle ."'"; + $sql .= ",description = '" . $this->description ."'"; $sql .= ",statut = " . $this->statut ; - + $sql .= ",description = '" . $this->description ."'"; + $sql .= ",lieu = '" . $this->lieu ."'"; + $sql .= ",address = '" . $this->address ."'"; + $sql .= ",cp = '" . $this->cp ."'"; + $sql .= ",ville = '" . $this->ville ."'"; + $sql .= ",fk_pays = " . $this->pays_id?$this->pays_id:'0' ; $sql .= " WHERE rowid = " . $id; if ( $this->db->query($sql) ) @@ -120,15 +145,11 @@ class Entrepot } else { + $this->error=$this->db->error()." sql=$sql";; return -1; } } - else - { - $this->mesg_error = "Vous devez indiquer une référence"; - return 0; - } - } + /** * \brief Recupéeration de la base d'un entrepot @@ -136,30 +157,84 @@ class Entrepot */ function fetch ($id) { - $sql = "SELECT rowid, label, description, statut"; - $sql .= " FROM ".MAIN_DB_PREFIX."entrepot WHERE rowid = $id"; + $sql = "SELECT rowid, label, description, statut, lieu, address, cp, ville, fk_pays"; + $sql .= " FROM ".MAIN_DB_PREFIX."entrepot"; + $sql .= " WHERE rowid = $id"; + + $result = $this->db->query($sql); + if ($result) + { + $obj=$this->db->fetch_object($result); + + $this->id = $obj->rowid; + $this->ref = $obj->rowid; + $this->libelle = $obj->label; + $this->description = $obj->description; + $this->statut = $obj->statut; + $this->lieu = $obj->lieu; + $this->address = $obj->address; + $this->cp = $obj->cp; + $this->ville = $obj->ville; + $this->pays_id = $obj->pays_id; + + $this->db->free($result); + return 1; + } + else + { + $this->error=$this->db->error(); + return -1; + } + } - $result = $this->db->query($sql) ; - if ( $result ) + /* + * \brief Charge les informations d'ordre info dans l'objet entrepot + * \param id id de l'entrepot a charger + */ + function info($id) + { + $sql = "SELECT e.rowid, ".$this->db->pdate("datec")." as datec,"; + $sql .= " ".$this->db->pdate("tms")." as datem,"; + $sql .= " fk_user_author"; + $sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e"; + $sql .= " WHERE e.rowid = ".$id; + + $result=$this->db->query($sql); + if ($result) { - $result = $this->db->fetch_array(); + if ($this->db->num_rows($result)) + { + $obj = $this->db->fetch_object($result); - $this->id = $result["rowid"]; - $this->ref = $result["ref"]; - $this->libelle = stripslashes($result["label"]); - $this->description = stripslashes($result["description"]); - $this->statut = $result["statut"]; + $this->id = $obj->rowid; + + if ($obj->fk_user_author) { + $cuser = new User($this->db, $obj->fk_user_author); + $cuser->fetch(); + $this->user_creation = $cuser; + } + + if ($obj->fk_user_valid) { + $vuser = new User($this->db, $obj->fk_user_valid); + $vuser->fetch(); + $this->user_validation = $vuser; + } + + $this->date_creation = $obj->datec; + $this->date_modification = $obj->datem; + + } + + $this->db->free($result); - $this->db->free(); - return 1; } else { - print $this->db->error(); - return -1; + dolibarr_print_error($this->db); } - } + } + /** * \brief Renvoie la liste des entrepôts ouverts diff --git a/htdocs/product/stock/fiche.php b/htdocs/product/stock/fiche.php index f1bf15e6d7e..60e005d4aec 100644 --- a/htdocs/product/stock/fiche.php +++ b/htdocs/product/stock/fiche.php @@ -37,50 +37,69 @@ $langs->load("stocks"); $mesg = ''; - +// Ajout entrepot if ($_POST["action"] == 'add') { $entrepot = new Entrepot($db); - + $entrepot->ref = trim($_POST["ref"]); $entrepot->libelle = trim($_POST["libelle"]); $entrepot->description = trim($_POST["desc"]); - $entrepot->statut = $_POST["statut"]; - + $entrepot->statut = trim($_POST["statut"]); + $entrepot->lieu = trim($_POST["lieu"]); + $entrepot->address = trim($_POST["address"]); + $entrepot->cp = trim($_POST["cp"]); + $entrepot->ville = trim($_POST["ville"]); + $entrepot->pays_id = trim($_POST["pays_id"]); + if ($entrepot->libelle) { $id = $entrepot->create($user); - Header("Location: fiche.php?id=$id"); + if ($id > 0) { + Header("Location: fiche.php?id=$id"); + } + + $_GET["action"] = 'create'; + $mesg="
".$entrepot->error."
"; } else { - $mesg="
".$langs->trans("ErrorWarehouseLabelRequired")."
"; + $mesg="
".$langs->trans("ErrorWarehouseLabelRequired")."
"; $_GET["action"]="create"; // Force retour sur page création } } +// Modification entrepot if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel")) { - $entrepot = new Entrepot($db); - if ($entrepot->fetch($_GET["id"])) + $entrepot = new Entrepot($db); + if ($entrepot->fetch($_POST["id"])) { - $entrepot->libelle = $_POST["libelle"]; - $entrepot->description = $_POST["desc"]; - $entrepot->statut = $_POST["statut"]; - - if ( $entrepot->update($_GET["id"], $user)) - { - $_GET["cancel"] = ''; - $mesg = 'Fiche mise à jour'; - } - else - { - $_GET["cancel"] = 're-edit'; - $mesg = 'Fiche non mise à jour !' . "
" . $entrepot->mesg_error; - } + $entrepot->libelle = trim($_POST["libelle"]); + $entrepot->description = trim($_POST["desc"]); + $entrepot->statut = trim($_POST["statut"]); + $entrepot->lieu = trim($_POST["lieu"]); + $entrepot->address = trim($_POST["address"]); + $entrepot->cp = trim($_POST["cp"]); + $entrepot->ville = trim($_POST["ville"]); + $entrepot->pays_id = trim($_POST["pays_id"]); + + if ( $entrepot->update($_POST["id"], $user) > 0) + { + $_GET["action"] = ''; + $_GET["id"] = $_POST["id"]; + //$mesg = '
Fiche mise à jour
'; + } + else + { + $_GET["action"] = 'edit'; + $_GET["id"] = $_POST["id"]; + $mesg = '
Fiche non mise à jour !' . "
" . $entrepot->error.'
'; + } } - else + else { - $_GET["cancel"] = 're-edit'; - $mesg = 'Fiche non mise à jour !' . "
" . $entrepot->mesg_error; + $_GET["action"] = 'edit'; + $_GET["id"] = $_POST["id"]; + $mesg = '
Fiche non mise à jour !' . "
" . $entrepot->error.'
'; } } @@ -88,114 +107,169 @@ if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel")) llxHeader("","",$langs->trans("WarehouseCard")); +$form=new Form($db); -if ($_GET["cancel"] == $langs->trans("Cancel")) + +if ($_POST["cancel"] == $langs->trans("Cancel")) { - $_GET["action"] = ''; + $_GET["action"] = ''; + $_GET["id"] = $_POST["id"]; } /* - * Affichage fiche en mode création - * - */ +* Affichage fiche en mode création +* +*/ if ($_GET["action"] == 'create') { - print "
\n"; - print ''; - print ''."\n"; - print_titre($langs->trans("NewWarehouse")); - - if ($mesg) { - print $mesg; - } - - print ''; - print ''; - print '"; - print ''; - print ''; - print '
'.$langs->trans("Label").'
'.$langs->trans("Description").''; - print '
'.$langs->trans("Status").''; - print '
 
'; - print '
'; + print "
\n"; + print ''; + print ''."\n"; + print_titre($langs->trans("NewWarehouse")); + + if ($mesg) { + print $mesg; + } + + print ''; + print ''; + print '"; + print ''; + print ''; + print '
'.$langs->trans("Label").'
'.$langs->trans("Description").''; + print '
'.$langs->trans("Status").''; + print '
 
'; + print '
'; } else { - if ($_GET["id"]) + if ($_GET["id"]) { - if ($_GET["action"] <> 're-edit') - { - $entrepot = new Entrepot($db); - $result = $entrepot->fetch($_GET["id"]); - } - if ( $result ) - { - if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') - { - print_fiche_titre('Fiche entrepot', $mesg); - - print ''; - print ''; - print ''; - print ''; - print '"; - print "
'.$langs->trans("Label").''.$entrepot->libelle.'
'.$langs->trans("Description").''.nl2br($entrepot->description).'
'.$langs->trans("Status").''.$entrepot->statuts[$entrepot->statut].'
Nb de produits'; - print $entrepot->nb_products(); - print "
"; - } - } + if ($mesg) { + print $mesg; + } - - if (($_GET["action"] == 'edit' || $_GET["action"] == 're-edit') && 1) - { - print_fiche_titre('Edition de la fiche entrepot', $mesg); + $entrepot = new Entrepot($db); + $result = $entrepot->fetch($_GET["id"]); + if (! $result) + { + dolibarr_print_error($db); + } - print "
id\" method=\"post\">\n"; - print ''; - - print ''; - print ''; - print '"; - print ''; + /* + * Affichage fiche + */ + if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') + { - print "".''; - print '
'.$langs->trans("Label").'
'.$langs->trans("Description").''; - print '
'.$langs->trans("Status").''; - print ''; - print '
 '; - print '
'; - print '
'; - } - } - else - { - dolibarr_print_error($db); + /* + * Affichage onglets + */ + $h = 0; + + $head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche.php?id='.$entrepot->id; + $head[$h][1] = $langs->trans("WarehouseCard"); + $hselected=$h; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$entrepot->id; + $head[$h][1] = $langs->trans("Info"); + $h++; + + dolibarr_fiche_head($head, $hselected, $langs->trans("Warehouse").': '.$entrepot->id); + + print ''; + print ''; + print ''; + print ''; + + print ''; + + print ''; + + print ''; + print ''; + + print ''; + + print '"; + print "
'.$langs->trans("Label").''.$entrepot->libelle.'
'.$langs->trans("Description").''.nl2br($entrepot->description).'
'.$langs->trans("Status").''.$entrepot->statuts[$entrepot->statut].'
'.$langs->trans("LocationSummary").''.$entrepot->lieu.'
'.$langs->trans('Address').''; + print $entrepot->address; + print '
'.$langs->trans('Zip').''.$entrepot->cp.''.$langs->trans('Town').''.$entrepot->ville.'
'.$langs->trans('Country').''; + $entrepot->pays; + print '
'.$langs->trans("NumberOfProducts").''; + print $entrepot->nb_products(); + print "
"; + + print "
\n"; + + } + + + /* + * Edition fiche + */ + if (($_GET["action"] == 'edit' || $_GET["action"] == 're-edit') && 1) + { + print_fiche_titre('Edition de la fiche entrepot', $mesg); + + print '
'; + print ''; + print ''; + + print ''; + print ''; + print '"; + print ''; + + print ''; + + print ''; + + print ''; + print ''; + + print ''; + + print ''; + print '
'.$langs->trans("Label").'
'.$langs->trans("Description").''; + print '
'.$langs->trans("Status").''; + print ''; + print '
'.$langs->trans("LocationSummary").'
'.$langs->trans('Address').'
'.$langs->trans('Zip').''.$langs->trans('Town').'
'.$langs->trans('Country').''; + $form->select_pays($entrepot->pays_id,$entrepot->pays_code); + print '
 '; + print '
'; + print '
'; + + } } } /* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ +/* */ +/* Barre d'action */ +/* */ /* ************************************************************************** */ -print "
\n"; +print "
\n"; if ($_GET["action"] == '') { - print "id\">".$langs->trans("Edit").""; + print "id\">".$langs->trans("Edit").""; } print "
"; diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php index 0c2180064c4..409362a0039 100644 --- a/htdocs/product/stock/index.php +++ b/htdocs/product/stock/index.php @@ -31,19 +31,37 @@ require_once("./pre.inc.php"); require_once("./entrepot.class.php"); -/* - * - * - */ +$user->getrights("stocks"); +$langs->load("stocks"); + +if (!$user->rights->stock->lire) + accessforbidden(); + llxHeader("","",$langs->trans("Stocks")); -print_titre($langs->trans("Stocks")); +print_titre($langs->trans("StocksArea")); print '
'; + print ''; print '
'; + +/* + * Zone recherche entrepot + */ +print '
'; +print ''; +print ""; +print ''; +print "'; +print "
'.$langs->trans("Search").'
"; +print $langs->trans("Ref").' :

"; + + + + $sql = "SELECT e.label, e.rowid, e.statut FROM ".MAIN_DB_PREFIX."entrepot as e"; $sql .= " ORDER BY e.statut DESC "; $sql .= $db->plimit(15 ,0); @@ -51,37 +69,36 @@ $result = $db->query($sql) ; if ($result) { - $num = $db->num_rows($result); + $num = $db->num_rows($result); - $i = 0; - - if ($num > 0) + $i = 0; + + print ''; + print ''; + + if ($num) { - $entrepot=new Entrepot($db); - - print '
'.$langs->trans("Warehouses").'
'; + $entrepot=new Entrepot($db); - print ''; - - $var=True; - while ($i < $num) - { - $objp = $db->fetch_object($result); - $var=!$var; - print ""; - print "\n"; - print ''; - print "\n"; - $i++; - } - $db->free($result); + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object($result); + $var=!$var; + print ""; + print "\n"; + print ''; + print "\n"; + $i++; + } + $db->free($result); - print "
'.$langs->trans("Warehouses").'
rowid\">".img_object($langs->trans("ShowStock"),"stock")." ".$objp->label."'.$entrepot->LibStatut($objp->statut).'
rowid\">".img_object($langs->trans("ShowStock"),"stock")." ".$objp->label."'.$entrepot->LibStatut($objp->statut).'
"; } + print "
"; } else { - dolibarr_print_error($db); + dolibarr_print_error($db); } print ''; diff --git a/htdocs/product/stock/info.php b/htdocs/product/stock/info.php new file mode 100644 index 00000000000..3f0313e91ff --- /dev/null +++ b/htdocs/product/stock/info.php @@ -0,0 +1,73 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +/** + \file htdocs/product/stock/info.php + \ingroup facture + \brief Page des informations d'un entrepot + \version $Revision$ +*/ + +require("./pre.inc.php"); + +$langs->load("stocks"); + +llxHeader(); + + +/* + * Visualisation de la fiche + * + */ + +$entrepot = new Entrepot($db); +$entrepot->fetch($_GET["id"]); +$entrepot->info($_GET["id"]); + + +/* + * Affichage onglets + */ +$h = 0; + +$head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche.php?id='.$entrepot->id; +$head[$h][1] = $langs->trans("WarehouseCard"); +$h++; + +$head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$entrepot->id; +$head[$h][1] = $langs->trans("Info"); +$hselected=$h; +$h++; + +dolibarr_fiche_head($head, $hselected, $langs->trans("Warehouse").': '.$entrepot->id); + + +print '
'; +dolibarr_print_object_info($entrepot); +print '
'; + +print "
"; + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/product/stock/liste.php b/htdocs/product/stock/liste.php index 9f2289e0673..0e1e6fe80bd 100644 --- a/htdocs/product/stock/liste.php +++ b/htdocs/product/stock/liste.php @@ -21,77 +21,34 @@ * */ -/** \file htdocs/product/stock/liste.php +/** + \file htdocs/product/stock/liste.php \ingroup stock \brief Page liste des stocks \version $Revision$ */ require("./pre.inc.php"); -$user->getrights('produit'); +require_once("./entrepot.class.php"); -if (!$user->rights->produit->lire) +$user->getrights('stocks'); +$langs->load("stocks"); + +if (!$user->rights->stock->lire) accessforbidden(); -if ($action == 'update') -{ - $sql = "UPDATE llx_product SET description='$desc' where rowid = $rowid"; - $db->query($sql); -} - -/* - * - * - */ - -if ($page < 0) { - $page = 0 ; } +if ($page < 0) $page = 0; $limit = $conf->liste_limit; $offset = $limit * $page ; -if ($sortfield == "") { - $sortfield="p.tms"; } - -if ($sortorder == "") -{ - $sortorder="DESC"; -} +if (! $sortfield) $sortfield="e.label"; +if (! $sortorder) $sortorder="ASC"; + -$sql = "SELECT p.rowid, p.label, p.price, p.ref FROM llx_product as p"; - -if ($_POST["sall"]) -{ - $sql .= " WHERE lower(p.ref) like '%".strtolower($sall)."%'"; - $sql .= " OR lower(p.label) like '%".strtolower($sall)."%'"; -} -else -{ - if (strlen($type) == 0) - { - $type = 0; - } - - $sql .= " WHERE p.fk_product_type = $type"; - if ($sref) - { - $sql .= " AND lower(p.ref) like '%".strtolower($sref)."%'"; - } - if ($snom) - { - $sql .= " AND lower(p.label) like '%".strtolower($snom)."%'"; - } - if (isset($envente) && strlen($envente) > 0) - { - $sql .= " AND p.envente = $envente"; - } - else - { - $sql .= " AND p.envente = 1"; - } -} - -$sql .= " ORDER BY $sortfield $sortorder "; +$sql = "SELECT e.rowid as ref, e.label, e.statut, e.lieu, e.address, e.cp, e.ville, e.fk_pays"; +$sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e"; +$sql .= " ORDER BY $sortfield $sortorder"; $sql .= $db->plimit($limit + 1 ,$offset); $result = $db->query($sql) ; @@ -101,57 +58,37 @@ if ($result) $i = 0; - if ($num == 1 && (isset($sall) or isset($snom) or isset($sref))) - { - $objp = $db->fetch_object($result); - Header("Location: fiche.php?id=$objp->rowid"); - } - - if ($ref || $snom || $sall) - { - llxHeader("","","Recherche Produit/Service"); + llxHeader("","",$langs->trans("ListOfWarehouses")); - print_barre_liste("Recherche d'un produit ou service", $page, "liste.php", "&sref=$sref&snom=$snom&envente=$envente", $sortfield, $sortorder,'',$num); - } - else - { - $texte = "Liste des ".$types[$type]."s"; - llxHeader("","",$texte); - if (isset($envente) && $envente == 0) - { - $texte .= " hors vente"; - } - print_barre_liste($texte, $page, "liste.php", "&sref=$sref&snom=$snom", $sortfield, $sortorder,'',$num); - } + print_barre_liste($langs->trans("ListOfWarehouses"), $page, "liste.php", "", $sortfield, $sortorder,'',$num); print ''; print ""; - print_liste_field_titre($langs->trans("Ref"),"liste.php", "p.ref","&envente=$envente&type=$type"); - print_liste_field_titre($langs->trans("Label"),"liste.php", "p.label","&envente=$envente&type=$type"); - print ""; + print_liste_field_titre($langs->trans("Ref"),"liste.php", "e.ref",""); + print_liste_field_titre($langs->trans("Label"),"liste.php", "e.label",""); + print_liste_field_titre($langs->trans("Status"),"liste.php", "e.statut",""); + print_liste_field_titre($langs->trans("LocationSummary"),"liste.php", "e.lieu",""); print "\n"; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - - $var=True; - while ($i < min($num,$limit)) - { - $objp = $db->fetch_object($result); - $var=!$var; - print ""; - print "\n"; - print "\n"; - print ''; - print "\n"; - $i++; + if ($num) { + $entrepot=new Entrepot($db); + + $var=True; + while ($i < min($num,$limit)) + { + $objp = $db->fetch_object($result); + $var=!$var; + print ""; + print ''; + print ''; + print ''; + print ''; + print "\n"; + $i++; + } } + $db->free($result); print "
Prix de vente
 
  
rowid\">$objp->ref$objp->label'.price($objp->price).'
'.img_object($langs->trans("ShowWarehouse"),'stock').' '.$objp->ref.''.$objp->label.''.$entrepot->LibStatut($objp->statut).''.$entrepot->lieu.'
"; diff --git a/htdocs/product/stock/pre.inc.php b/htdocs/product/stock/pre.inc.php index 16edb940882..d013439be43 100644 --- a/htdocs/product/stock/pre.inc.php +++ b/htdocs/product/stock/pre.inc.php @@ -41,6 +41,7 @@ function llxHeader($head = "", $urlp = "", $title="") $menu->add(DOL_URL_ROOT."/product/stock/", $langs->trans("Stock")); $menu->add_submenu(DOL_URL_ROOT."/product/stock/fiche.php?action=create", $langs->trans("NewWarehouse")); + $menu->add_submenu(DOL_URL_ROOT."/product/stock/liste.php", $langs->trans("List")); $menu->add(DOL_URL_ROOT."/product/stock/mouvement.php", $langs->trans("Movements"));