diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index dd98284194d..3b0e03faef6 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -52,10 +52,24 @@ if ($_POST["action"] == 'add' && $user->rights->produit->creer) $product->duration_value = $_POST["duration_value"]; $product->duration_unit = $_POST["duration_unit"]; $product->seuil_stock_alerte = $_POST["seuil_stock_alerte"]; + + $e_product = $product; $id = $product->create($user); - Header("Location: fiche.php?id=$id"); + if ($id > 0) + { + Header("Location: fiche.php?id=$id"); + } + else + { + if ($id == -3) + { + $_error = 1; + $_GET["action"] = "create"; + $_GET["type"] = $_POST["type"]; + } + } } if ($_POST["action"] == 'update' && @@ -206,21 +220,32 @@ llxHeader("","","Fiche produit"); */ if ($_GET["action"] == 'create') { + $html = new Form($db); $nbligne=0; - + $product = new Product($db); + if ($_error == 1) + { + $product = $e_product; + } - print "