Fix: bug #14671 overview: echappement simple cote libelle produit

This commit is contained in:
Laurent Destailleur 2005-09-30 22:49:27 +00:00
parent 4d87fbc521
commit a715f4583f

View File

@ -59,36 +59,36 @@ if ($_GET["action"] == 'fastappro')
// Action ajout d'un produit ou service // Action ajout d'un produit ou service
if ($_POST["action"] == 'add' && $user->rights->produit->creer) if ($_POST["action"] == 'add' && $user->rights->produit->creer)
{ {
$product = new Product($db); $product = new Product($db);
$product->ref = $_POST["ref"]; $product->ref = stripslashes($_POST["ref"]);
$product->libelle = $_POST["libelle"]; $product->libelle = stripslashes($_POST["libelle"]);
$product->price = $_POST["price"]; $product->price = stripslashes($_POST["price"]);
$product->tva_tx = $_POST["tva_tx"]; $product->tva_tx = $_POST["tva_tx"];
$product->type = $_POST["type"]; $product->type = $_POST["type"];
$product->envente = $_POST["statut"]; $product->envente = $_POST["statut"];
$product->description = $_POST["desc"]; $product->description = stripslashes($_POST["desc"]);
$product->note = $_POST["note"]; $product->note = stripslashes($_POST["note"]);
$product->duration_value = $_POST["duration_value"]; $product->duration_value = $_POST["duration_value"];
$product->duration_unit = $_POST["duration_unit"]; $product->duration_unit = $_POST["duration_unit"];
$product->seuil_stock_alerte = $_POST["seuil_stock_alerte"]; $product->seuil_stock_alerte = $_POST["seuil_stock_alerte"];
$e_product = $product; $e_product = $product;
$id = $product->create($user); $id = $product->create($user);
if ($id > 0) if ($id > 0)
{ {
Header("Location: fiche.php?id=$id"); Header("Location: fiche.php?id=$id");
} }
else else
{ {
if ($id == -3) if ($id == -3)
{ {
$_error = 1; $_error = 1;
$_GET["action"] = "create"; $_GET["action"] = "create";
$_GET["type"] = $_POST["type"]; $_GET["type"] = $_POST["type"];
} }
} }
} }
@ -97,40 +97,40 @@ if ($_POST["action"] == 'update' &&
$_POST["cancel"] <> $langs->trans("Cancel") && $_POST["cancel"] <> $langs->trans("Cancel") &&
$user->rights->produit->creer) $user->rights->produit->creer)
{ {
$product = new Product($db); $product = new Product($db);
if ($product->fetch($_POST["id"])) if ($product->fetch($_POST["id"]))
{ {
$product->ref = $_POST["ref"]; $product->ref = stripslashes($_POST["ref"]);
$product->libelle = $_POST["libelle"]; $product->libelle = stripslashes($_POST["libelle"]);
$product->price = $_POST["price"]; $product->price = stripslashes($_POST["price"]);
$product->tva_tx = $_POST["tva_tx"]; $product->tva_tx = $_POST["tva_tx"];
$product->description = $_POST["desc"]; $product->description = stripslashes($_POST["desc"]);
$product->note = $_POST["note"]; $product->note = stripslashes($_POST["note"]);
$product->envente = $_POST["statut"]; $product->envente = $_POST["statut"];
$product->seuil_stock_alerte = $_POST["seuil_stock_alerte"]; $product->seuil_stock_alerte = $_POST["seuil_stock_alerte"];
$product->duration_value = $_POST["duration_value"]; $product->duration_value = $_POST["duration_value"];
$product->duration_unit = $_POST["duration_unit"]; $product->duration_unit = $_POST["duration_unit"];
if ($product->check()) if ($product->check())
{ {
if ($product->update($product->id, $user) > 0) if ($product->update($product->id, $user) > 0)
{ {
$_GET["action"] = ''; $_GET["action"] = '';
$_GET["id"] = $_POST["id"]; $_GET["id"] = $_POST["id"];
} }
else else
{ {
$_GET["action"] = 're-edit'; $_GET["action"] = 're-edit';
$_GET["id"] = $_POST["id"]; $_GET["id"] = $_POST["id"];
$mesg = $product->mesg_error; $mesg = $product->mesg_error;
} }
} }
else else
{ {
$_GET["action"] = 're-edit'; $_GET["action"] = 're-edit';
$_GET["id"] = $_POST["id"]; $_GET["id"] = $_POST["id"];
$mesg = $langs->trans("ErrorProductBadRefOrLabel"); $mesg = $langs->trans("ErrorProductBadRefOrLabel");
} }
} }
} }