Skip to content
Snippets Groups Projects
Commit 72ff353e authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix repair of product_stock

parent 2e759d51
No related branches found
No related tags found
No related merge requests found
...@@ -545,7 +545,7 @@ if ($ok && GETPOST('clean_product_stock_batch')) ...@@ -545,7 +545,7 @@ if ($ok && GETPOST('clean_product_stock_batch'))
while ($i < $num) while ($i < $num)
{ {
$obj=$db->fetch_object($resql); $obj=$db->fetch_object($resql);
print '<tr><td>Product '.$obj->rowid.'-'.$obj->ref.' in warehose '.$obj->fk_entrepot.' -> '.$obj->psrowid.': '.$obj->reel.' (product_stock.reel) != '.$obj->reelbatch.' (sum product_batch)'; print '<tr><td>Product '.$obj->rowid.'-'.$obj->ref.' in warehose '.$obj->fk_entrepot.' -> '.$obj->psrowid.': '.$obj->reel.' (product_stock.reel) != '.($obj->reelbatch?$obj->reelbatch:'0').' (sum product_batch)';
// Fix // Fix
if ($obj->reel != $obj->reelbatch) if ($obj->reel != $obj->reelbatch)
...@@ -571,7 +571,7 @@ if ($ok && GETPOST('clean_product_stock_batch')) ...@@ -571,7 +571,7 @@ if ($ok && GETPOST('clean_product_stock_batch'))
if ($methodtofix == 'updatestock') if ($methodtofix == 'updatestock')
{ {
// Method 2 // Method 2
print ' -> Update qty of product_stock with qty = '.$obj->reelbatch.' for ps.rowid = '.$obj->psrowid; print ' -> Update qty of product_stock with qty = '.($obj->reelbatch?$obj->reelbatch:'0').' for ps.rowid = '.$obj->psrowid;
if (GETPOST('clean_product_stock_batch') == 'confirmed') if (GETPOST('clean_product_stock_batch') == 'confirmed')
{ {
$error=0; $error=0;
...@@ -579,7 +579,7 @@ if ($ok && GETPOST('clean_product_stock_batch')) ...@@ -579,7 +579,7 @@ if ($ok && GETPOST('clean_product_stock_batch'))
$db->begin(); $db->begin();
$sql2 ="UPDATE ".MAIN_DB_PREFIX."product_stock"; $sql2 ="UPDATE ".MAIN_DB_PREFIX."product_stock";
$sql2.=" SET reel = ".$obj->reelbatch." WHERE rowid = ".$obj->psrowid; $sql2.=" SET reel = ".($obj->reelbatch?$obj->reelbatch:'0')." WHERE rowid = ".$obj->psrowid;
$resql2=$db->query($sql2); $resql2=$db->query($sql2);
if ($resql2) if ($resql2)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment