added the desired stock field to the Stock UI

This commit is contained in:
Cédric Salvador
2013-05-30 17:53:41 +02:00
parent aae8a62368
commit ea2d94451a

View File

@@ -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 '<tr><td>'.$form->editfieldkey("StockLimit",'stocklimit',$product->seuil_stock_alerte,$product,$user->rights->produit->creer).'</td><td colspan="2">';
print $form->editfieldval("StockLimit",'stocklimit',$product->seuil_stock_alerte,$product,$user->rights->produit->creer);
print '</td></tr>';
// Desired stock
print '<tr><td>'.$form->editfieldkey("DesiredStock",'desiredstock',$product->desiredstock,$product,$user->rights->produit->creer).'</td><td colspan="2">';
print $form->editfieldval("DesiredStock",'desiredstock',$product->desiredstock,$product,$user->rights->produit->creer);
print '</td></tr>';
// Real stock
$product->load_stock();