diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php
index 5267d6245c8..bc5b34ec909 100644
--- a/htdocs/product/fiche.php
+++ b/htdocs/product/fiche.php
@@ -51,6 +51,7 @@ if ($_POST["action"] == 'add' && $user->rights->produit->creer)
$product->seuil_stock_alerte = $_POST["seuil_stock_alerte"];
$id = $product->create($user);
+
Header("Location: fiche.php?id=$id");
}
@@ -59,7 +60,7 @@ if ($_POST["action"] == 'update' &&
( $user->rights->produit->modifier || $user->rights->produit->creer))
{
$product = new Product($db);
- if ($product->fetch($_GET["id"]))
+ if ($product->fetch($_POST["id"]))
{
$product->ref = $_POST["ref"];
@@ -73,26 +74,28 @@ if ($_POST["action"] == 'update' &&
$product->duration_unit = $_POST["duration_unit"];
if ($product->check())
- {
- if ($product->update($_GET["id"], $user))
- {
- $action = '';
- $mesg = 'Fiche mise à jour';
- }
- else
- {
- $action = 're-edit';
- $mesg = 'Fiche non mise à jour !' . "
" . $product->mesg_error;
- }
- }
+ {
+ if ($product->update($product->id, $user))
+ {
+ $_GET["action"] = '';
+ $mesg = 'Fiche mise à jour';
+ }
+ else
+ {
+ $_GET["action"] = 're-edit';
+ $mesg = 'Fiche non mise à jour !' . "
" . $product->mesg_error;
+ }
+ }
else
- {
- $action = 're-edit';
- $mesg = 'Fiche non mise à jour !' . "
" . $product->mesg_error;
- }
+ {
+ $_GET["action"] = 're-edit';
+ $mesg = 'Fiche non mise à jour !' . "
" . $product->mesg_error;
+ }
}
+ Header("Location: fiche.php?id=".$product->id);
}
+
if ($_POST["action"] == 'addinpropal')
{
$propal = New Propal($db);
@@ -108,14 +111,14 @@ if ($_POST["action"] == 'addinpropal')
$mesg = ucfirst($types[$type]) . ' ajouté à la proposition ';
$mesg .= ''.$propal->ref.'';
}
- $action = '';
+ $_GET["action"] = '';
}
if ($_POST["action"] == 'addinfacture' &&
( $user->rights->facture->modifier || $user->rights->facture->creer))
{
$product = new Product($db);
- $result = $product->fetch($id);
+ $result = $product->fetch($_GET["id"]);
$facture = New Facture($db);
@@ -124,7 +127,7 @@ if ($_POST["action"] == 'addinfacture' &&
addslashes($product->libelle),
$product->price,
$_POST["qty"],
- $product->tva_tx, $id);
+ $product->tva_tx, $product->id);
$action = '';
$mesg = 'Produit ajouté à la facture ';
@@ -133,6 +136,7 @@ if ($_POST["action"] == 'addinfacture' &&
if ($_POST["action"] == 'add_fourn' && $_POST["cancel"] <> 'Annuler')
{
+
$product = new Product($db);
if( $product->fetch($_GET["id"]) )
{
@@ -164,30 +168,36 @@ if ($_GET["action"] == 'remove_fourn')
}
}
+
if ($_POST["action"] == 'update_price' &&
$_POST["cancel"] <> 'Annuler' &&
( $user->rights->produit->modifier || $user->rights->produit->creer))
{
$product = new Product($db);
- $result = $product->fetch($_GET["id"]);
- $product->price = $_POST["price"];
- if ( $product->update_price($_GET["id"], $user) > 0 )
+ $result = $product->fetch($_GET["id"]);
+
+ $product->price = ereg_replace(" ","",$_POST["price"]);
+
+
+ if ( $product->update_price($product->id, $user) > 0 )
+
{
- $action = '';
+ $_GET["action"] = '';
$mesg = 'Fiche mise à jour';
}
else
{
- $action = 'edit_price';
+ $_GET["action"] = 'edit_price';
$mesg = 'Fiche non mise à jour !' . "
" . $product->mesg_error;
}
}
-if ($cancel == 'Annuler')
+if ($_POST["cancel"] == 'Annuler')
{
$action = '';
+ Header("Location: fiche.php?id=".$_POST["id"]);
}
@@ -204,7 +214,8 @@ if ($_GET["action"] == 'create')
{
$nbligne=0;
- print '