*
* 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$
*
*/
require("./pre.inc.php");
$mesg = '';
llxHeader("","","Fiche entrepôt");
if ($HTTP_POST_VARS["action"] == 'add')
{
$entrepot = new Entrepot($db);
$entrepot->ref = $HTTP_POST_VARS["ref"];
$entrepot->libelle = $HTTP_POST_VARS["libelle"];
$entrepot->description = $HTTP_POST_VARS["desc"];
$entrepot->statut = $HTTP_POST_VARS["statut"];
$id = $entrepot->create($user);
$action = '';
}
if ($HTTP_POST_VARS["action"] == 'update' && $cancel <> 'Annuler')
{
$entrepot = new Entrepot($db);
if ($entrepot->fetch($id))
{
$entrepot->libelle = $HTTP_POST_VARS["libelle"];
$entrepot->description = $HTTP_POST_VARS["desc"];
$entrepot->statut = $HTTP_POST_VARS["statut"];
if ( $entrepot->update($id, $user))
{
$action = '';
$mesg = 'Fiche mise à jour';
}
else
{
$action = 're-edit';
$mesg = 'Fiche non mise à jour !' . " " . $entrepot->mesg_error;
}
}
else
{
$action = 're-edit';
$mesg = 'Fiche non mise à jour !' . " " . $entrepot->mesg_error;
}
}
if ($cancel == 'Annuler')
{
$action = '';
}
/*
* Affichage
*
*/
if ($_GET["action"] == 'create')
{
print "
';
}
else
{
if ($id)
{
if ($action <> 're-edit')
{
$entrepot = new Entrepot($db);
$result = $entrepot->fetch($id);
}
if ( $result )
{
if ($action <> 'edit' && $action <> 're-edit')
{
print_fiche_titre('Fiche entrepot', $mesg);
print '