From df056980b5bbcaeb45ee28e818956f9fc273984c Mon Sep 17 00:00:00 2001 From: atm-greg Date: Tue, 19 Jun 2018 10:46:07 +0200 Subject: [PATCH] fix bad result on fetch ProductStockEntrepot --- htdocs/product/stock/product.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index bc4d6daaaa4..c0dccaa2181 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -85,6 +85,9 @@ if ($id > 0 || ! empty($ref)) $result = $object->fetch($id, $ref); } + +if(empty($id) && !empty($object->id)) $id = $object->id; + $modulepart='product'; // Get object canvas (By default, this is not defined, so standard usage of dolibarr) @@ -130,7 +133,7 @@ if ($action == 'addlimitstockwarehouse' && !empty($user->rights->produit->creer) if($maj_ok) { $pse = new ProductStockEntrepot($db); - if($pse->fetch('', GETPOST('id'), GETPOST('fk_entrepot')) > 0) { + if($pse->fetch('', $id, GETPOST('fk_entrepot')) > 0) { // Update $pse->seuil_stock_alerte = $seuil_stock_alerte; @@ -141,7 +144,7 @@ if ($action == 'addlimitstockwarehouse' && !empty($user->rights->produit->creer) // Create $pse->fk_entrepot = GETPOST('fk_entrepot'); - $pse->fk_product = GETPOST('id'); + $pse->fk_product = $id; $pse->seuil_stock_alerte = GETPOST('seuil_stock_alerte'); $pse->desiredstock = GETPOST('desiredstock'); if($pse->create($user) > 0) setEventMessage($langs->trans('ProductStockWarehouseCreated')); @@ -150,7 +153,7 @@ if ($action == 'addlimitstockwarehouse' && !empty($user->rights->produit->creer) } - header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id')); + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; } @@ -951,7 +954,7 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) if (!empty($user->rights->produit->creer)){ print '
'; print ''; - print ''; + print ''; } print ''; if (!empty($user->rights->produit->creer)){ @@ -968,7 +971,7 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) } $pse = new ProductStockEntrepot($db); - $lines = $pse->fetchAll(GETPOST('id')); + $lines = $pse->fetchAll($id); if (!empty($lines)) { @@ -981,7 +984,7 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) print ''; print ''; if (!empty($user->rights->produit->creer)){ - print ''; + print ''; } print ''; }
'.$line['seuil_stock_alerte'].''.$line['desiredstock'].''.img_delete().''.img_delete().'