diff --git a/htdocs/fourn/product/fiche.php b/htdocs/fourn/product/fiche.php index 868caa421f4..9e194576b39 100644 --- a/htdocs/fourn/product/fiche.php +++ b/htdocs/fourn/product/fiche.php @@ -18,7 +18,6 @@ * * $Id$ * $Source$ - * */ /** @@ -60,36 +59,36 @@ if ($_GET["action"] == 'fastappro') // Action ajout d'un produit ou service if ($_POST["action"] == 'add' && $user->rights->produit->creer) { - $product = new Product($db); + $product = new Product($db); - $product->ref = $_POST["ref"]; - $product->libelle = $_POST["libelle"]; - $product->price = $_POST["price"]; - $product->catid = $_POST["catid"]; - $product->tva_tx = $_POST["tva_tx"]; - $product->type = $_POST["type"]; - $product->envente = $_POST["statut"]; - $product->description = $_POST["desc"]; - $product->duration_value = $_POST["duration_value"]; - $product->duration_unit = $_POST["duration_unit"]; - $product->seuil_stock_alerte = $_POST["seuil_stock_alerte"]; - - $e_product = $product; + $product->ref = $_POST["ref"]; + $product->libelle = $_POST["libelle"]; + $product->price = $_POST["price"]; + $product->catid = $_POST["catid"]; + $product->tva_tx = $_POST["tva_tx"]; + $product->type = $_POST["type"]; + $product->envente = $_POST["statut"]; + $product->description = $_POST["desc"]; + $product->duration_value = $_POST["duration_value"]; + $product->duration_unit = $_POST["duration_unit"]; + $product->seuil_stock_alerte = $_POST["seuil_stock_alerte"]; - $id = $product->create($user); + $e_product = $product; - if ($id > 0) + $id = $product->create($user); + if ($id > 0) { - Header("Location: fiche.php?id=$id"); + Header("Location: fiche.php?id=$id"); } - else + else { - if ($id == -3) - { - $_error = 1; - $_GET["action"] = "create"; - $_GET["type"] = $_POST["type"]; - } + if ($id == -3) + { + $mesg='
'.$product->error.'
'; + $_error = 1; + $_GET["action"] = "create"; + $_GET["type"] = $_POST["type"]; + } } } @@ -199,6 +198,7 @@ if ($_POST["cancel"] == $langs->trans("Cancel")) Header("Location: fiche.php?id=".$_POST["id"]); } + // Le produit n'est pas encore chargé a ce stade llxHeader("","",$langs->trans("CardProduct0")); @@ -227,6 +227,8 @@ if ($_GET["action"] == 'create' && $user->rights->produit->creer) print ''; + if ($mesg) print $mesg; + if ($conf->categorie->enabled) { print ''; } - print ''; + print ''; print '
'.$langs->trans("Categorie"); @@ -272,7 +274,7 @@ if ($_GET["action"] == 'create' && $user->rights->produit->creer) print '
 
 
'; print ''; } @@ -334,8 +336,8 @@ else dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref); - - print($mesg); + if ($mesg) print($mesg); + print ''; if ($conf->categorie->enabled) diff --git a/htdocs/fourn/product/pre.inc.php b/htdocs/fourn/product/pre.inc.php index 7809f649ace..a92b5559133 100644 --- a/htdocs/fourn/product/pre.inc.php +++ b/htdocs/fourn/product/pre.inc.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Laurent Destailleur + * 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 @@ -18,97 +18,98 @@ * * $Id$ * $Source$ - * */ -/*! - \file htdocs/product/pre.inc.php - \ingroup product,service - \brief Fichier gestionnaire du menu gauche des produits et services - \version $Revision$ +/** + \file htdocs/fourn/product/pre.inc.php + \ingroup product,service + \brief Fichier gestionnaire du menu gauche des produits et services fournisseurs + \version $Revision$ */ require("../../main.inc.php"); -require_once DOL_DOCUMENT_ROOT."/fourn/fournisseur.class.php"; -require_once DOL_DOCUMENT_ROOT."/categories/categorie.class.php"; +require_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.class.php"); +require_once(DOL_DOCUMENT_ROOT."/categories/categorie.class.php"); $langs->load("suppliers"); $langs->load("products"); $user->getrights("produit"); + function llxHeader($head = "", $title="", $help_url='',$addons='') { - global $db, $user, $conf, $langs; + global $db, $user, $conf, $langs; - - top_menu($head, $title); - $menu = new Menu(); + top_menu($head, $title); - if (is_array($addons)) + $menu = new Menu(); + + if (is_array($addons)) { - //$menu->add($url, $libelle); - $menu->add($addons[0][0], $addons[0][1]); + //$menu->add($url, $libelle); + $menu->add($addons[0][0], $addons[0][1]); } - if ($conf->produit->enabled) - { - $menu->add(DOL_URL_ROOT."/fourn/product/", $langs->trans("Products")); - $menu->add_submenu(DOL_URL_ROOT."/fourn/product/liste.php?type=0", $langs->trans("List")); - - if ($user->societe_id == 0 && $user->rights->produit->creer) - { - if ($conf->categorie->enabled) - { - $menu->add_submenu(DOL_URL_ROOT."/fourn/product/fiche.php?action=create&type=0&catid=".$_REQUEST['catid'], $langs->trans("NewProduct")); - } - else - { - $menu->add_submenu(DOL_URL_ROOT."/fourn/product/fiche.php?action=create&type=0", $langs->trans("NewProduct")); - } - } - } - - if ($conf->categorie->enabled) - { - $menu->add(DOL_URL_ROOT."/categories/", $langs->trans("Categories")); - } - - $menu->add('liste.php','Top'); - - if (isset($_REQUEST['catid'])) + if ($conf->produit->enabled) { - $catid = $_REQUEST['catid']; + $menu->add(DOL_URL_ROOT."/fourn/product/", $langs->trans("Products")); + $menu->add_submenu(DOL_URL_ROOT."/fourn/product/liste.php?type=0", $langs->trans("List")); - $c = new Categorie ($db, $catid); - - $menu->add('liste.php?catid='.$c->id, $c->label); - - $cats = $c->get_filles(); - - if (sizeof ($cats) > 0) - { - foreach ($cats as $cat) - { - $menu->add_submenu('liste.php?catid='.$cat->id, $cat->label); - } - } - } - else - { - $c = new Categorie ($db); - $cats = $c->get_main_categories(); - - if (sizeof ($cats) > 0) - { - foreach ($cats as $cat) - { - $menu->add_submenu('liste.php?catid='.$cat->id, $cat->label); - } - } + if ($user->societe_id == 0 && $user->rights->produit->creer) + { + if ($conf->categorie->enabled) + { + $menu->add_submenu(DOL_URL_ROOT."/fourn/product/fiche.php?action=create&type=0&catid=".$_REQUEST['catid'], $langs->trans("NewProduct")); + } + else + { + $menu->add_submenu(DOL_URL_ROOT."/fourn/product/fiche.php?action=create&type=0", $langs->trans("NewProduct")); + } + } } - left_menu($menu->liste, $help_url); + if ($conf->categorie->enabled) + { + $menu->add(DOL_URL_ROOT."/categories/", $langs->trans("Categories")); + } + + $menu->add('liste.php','Top'); + + if (isset($_REQUEST['catid']) && $_REQUEST['catid'] != '') + { + $catid = $_REQUEST['catid']; + + $c = new Categorie ($db, $catid); + + $menu->add('liste.php?catid='.$c->id, $c->label); + + $cats = $c->get_filles(); + + if (sizeof ($cats) > 0) + { + foreach ($cats as $cat) + { + $menu->add_submenu('liste.php?catid='.$cat->id, $cat->label); + } + } + } + else + { + $c = new Categorie ($db); + $cats = $c->get_main_categories(); + + if (sizeof ($cats) > 0) + { + foreach ($cats as $cat) + { + $menu->add_submenu('liste.php?catid='.$cat->id, $cat->label); + } + } + } + + left_menu($menu->liste, $help_url); } + ?>