diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 6ac507b2070..72c32911796 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -43,6 +43,7 @@ $cancel=GETPOST('cancel'); $id = GETPOST('id')?GETPOST('id'):GETPOST('ref'); $ref = GETPOST('ref'); $stocklimit = GETPOST('stocklimit'); +$desiredstock = GETPOST('desiredstock'); $cancel = GETPOST('cancel'); $fieldid = isset($_GET["ref"])?'ref':'rowid'; if ($user->societe_id) $socid=$user->societe_id; @@ -67,6 +68,19 @@ if ($action == 'setstocklimit') $action=''; } +// Set desired stock +if ($action == 'setdesiredstock') +{ + $product = new Product($db); + $result=$product->fetch($id); + $product->desiredstock=$desiredstock; + $result=$product->update($product->id,$user,1,0,1); + if ($result < 0) + setEventMessage($product->error, 'errors'); + $action=''; +} + + // Correct stock if ($action == "correct_stock" && ! $cancel) { @@ -247,6 +261,11 @@ if ($id > 0 || $ref) print '