From 853969d90df3ba0e80f56645377d9f56d76a7c8f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Jul 2010 22:18:35 +0000 Subject: [PATCH] Fix: Avoid duplicate action when using back on browser --- htdocs/product/stock/product.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index ea29daeb466..cb67141af9c 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -62,12 +62,18 @@ if ($_POST["action"] == "correct_stock" && ! $_POST["cancel"]) $product = new Product($db); $result=$product->fetch($_GET["id"]); - $product->correct_stock($user, + $result=$product->correct_stock($user, $_POST["id_entrepot"], $_POST["nbpiece"], $_POST["mouvement"], $_POST["label"], 0); // We do not change value of stock for a correction + + if ($result > 0) + { + header("Location: product.php?id=".$product->id); + exit; + } } } @@ -111,6 +117,8 @@ if ($_POST["action"] == "transfert_stock" && ! $_POST["cancel"]) if ($result1 >= 0 && $result2 >= 0) { $db->commit(); + header("Location: product.php?id=".$product->id); + exit; } else { @@ -376,15 +384,15 @@ print "
\n"; if ($_GET["action"] == '' ) { - if ($user->rights->stock->mouvement->creer) + if ($user->rights->stock->creer) + { + print ''.$langs->trans("StockCorrection").''; + } + + if ($user->rights->stock->mouvement->creer) { print ''.$langs->trans("StockMovement").''; } - - if ($user->rights->stock->creer) - { - print ''.$langs->trans("StockCorrection").''; - } } print '
';