diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 23de3918028..a189bf23d64 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -39,88 +39,97 @@ if ($_POST["action"] == "create_stock") $product->create_stock($_POST["id_entrepot"], $_POST["nbpiece"]); } -if ($_POST["action"] == "correct_stock") +if ($_POST["action"] == "correct_stock" && $_POST["cancel"] <> "Annuler") { - $product = new Product($db); - $product->id = $_GET["id"]; - $product->correct_stock($user, - $_POST["id_entrepot"], - $_POST["nbpiece"], - $_POST["mouvement"]); + if (is_numeric($_POST["nbpiece"])) + { + + $product = new Product($db); + $product->id = $_GET["id"]; + $product->correct_stock($user, + $_POST["id_entrepot"], + $_POST["nbpiece"], + $_POST["mouvement"]); + } } - -if ($cancel == 'Annuler') -{ - $action = ''; -} /* * * */ if ($_GET["id"]) { - if ($action <> 're-edit') - { - $product = new Product($db); - $result = $product->fetch($_GET["id"]); - } + + $product = new Product($db); - if ( $result ) - { - if ($action <> 'edit' && $action <> 're-edit') + if ( $product->fetch($_GET["id"])) + { + $head[0][0] = DOL_URL_ROOT."/product/fiche.php?id=".$product->id; + $head[0][1] = 'Fiche'; + + $head[1][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id; + $head[1][1] = 'Prix'; + $h = 2; + + $head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$product->id; + $head[$h][1] = 'Stock'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id; + $head[$h][1] = 'Statistiques'; + + dolibarr_fiche_head($head, 2, 'Fiche '.$types[$product->type].' : '.$product->ref); + + print($mesg); + + print_fiche_titre('Fiche stock : '.$product->ref, $mesg); + + print ''; + print ""; + print ''; + print ''; + print ""; + print ''; + print ''; + print ''; + print ''; + print "
Référence'.$product->ref.''; + if ($product->envente) { - - print_fiche_titre('Fiche stock : '.$product->ref, $mesg); - - print ''; - print ""; - print ''; - print ''; - print ""; - print ''; - print ''; - print ''; - - print ''; - - print "
Référence'.$product->ref.''; - if ($product->envente) - { - print "En vente"; - } - else - { - print "Cet article n'est pas en vente"; - } - print '
Libellé$product->libelleStatistiques
Prix de vente'.price($product->price).''; - print 'Fournisseurs [Ajouter]'; - - $sql = "SELECT s.nom, s.idp"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."product_fournisseur as pf"; - $sql .=" WHERE pf.fk_soc = s.idp AND pf.fk_product =$product->id"; - $sql .= " ORDER BY lower(s.nom)"; - - if ( $db->query($sql) ) - { - $num = $db->num_rows(); - $i = 0; - print ''; - $var=True; - while ($i < $num) - { - $objp = $db->fetch_object( $i); - $var=!$var; - print ""; - print ''; - $i++; - } - print '
'.$objp->nom.'
'; - $db->free(); - } - - print '
Stock seuil'.$product->seuil_stock_alerte.'
"; + print "En vente"; } + else + { + print "Cet article n'est pas en vente"; + } + print '
Libellé$product->libelleStatistiques
Prix de vente'.price($product->price).''; + print 'Fournisseurs [Ajouter]'; + + $sql = "SELECT s.nom, s.idp"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."product_fournisseur as pf"; + $sql .=" WHERE pf.fk_soc = s.idp AND pf.fk_product =$product->id"; + $sql .= " ORDER BY lower(s.nom)"; + + if ( $db->query($sql) ) + { + $num = $db->num_rows(); + $i = 0; + print ''; + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print ''; + $i++; + } + print '
'.$objp->nom.'
'; + $db->free(); + } + + print '
Stock seuil'.$product->seuil_stock_alerte.'
"; + /* * Contenu des stocks * @@ -148,6 +157,7 @@ if ($_GET["id"]) } + print ''; /* * Correction du stock * @@ -235,7 +245,10 @@ else print "
\n"; -print 'Correction stock'; +if ($_GET["action"] <> 'correction') +{ + print 'Correction stock'; +} print '
'; $db->close();