* 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 * 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/fiche.php \ingroup stock \brief Page fiche entrepot \version $Revision$ */ require("./pre.inc.php"); $langs->load("products"); $mesg = ''; if ($_POST["action"] == 'add') { $entrepot = new Entrepot($db); $entrepot->ref = $_POST["ref"]; $entrepot->libelle = $_POST["libelle"]; $entrepot->description = $_POST["desc"]; $entrepot->statut = $_POST["statut"]; $id = $entrepot->create($user); Header("Location: fiche.php?id=$id"); } if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel")) { $entrepot = new Entrepot($db); if ($entrepot->fetch($_GET["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; } } else { $_GET["cancel"] = 're-edit'; $mesg = 'Fiche non mise à jour !' . "
" . $entrepot->mesg_error; } } llxHeader("","","Fiche entrepôt"); if ($_GET["cancel"] == $langs->trans("Cancel")) { $_GET["action"] = ''; } /* * Affichage fiche en mode création * */ if ($_GET["action"] == 'create') { print "
\n"; print ''; print ''."\n"; print_titre($langs->trans("NewWarehouse")); print ''; print ''; print '"; print ''; print ''; print '
'.$langs->trans("Label").'
'.$langs->trans("Description").''; print '
'.$langs->trans("Status").''; print '
 
'; print '
'; } else { 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 (($_GET["action"] == 'edit' || $_GET["action"] == 're-edit') && 1) { print_fiche_titre('Edition de la fiche entrepot', $mesg); print "
id\" method=\"post\">\n"; print ''; print ''; print ''; print '"; print ''; print "".''; print '
'.$langs->trans("Label").'
'.$langs->trans("Description").''; print '
'.$langs->trans("Status").''; print ''; print '
 '; print '
'; print '
'; } } else { dolibarr_print_error($db); } } /* ************************************************************************** */ /* */ /* Barre d'action */ /* */ /* ************************************************************************** */ print "
\n"; if ($_GET["action"] == '') { print "id\">".$langs->trans("Edit").""; } print "
"; $db->close(); llxFooter("Dernière modification $Date$ révision $Revision$"); ?>