From 72ff353e9f48ccf01b7eb6ead491595258763b18 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 15 Apr 2017 16:22:15 +0200 Subject: [PATCH] Fix repair of product_stock --- htdocs/install/repair.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index ef5fccea80b..f0ab4fd5e78 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -545,7 +545,7 @@ if ($ok && GETPOST('clean_product_stock_batch')) while ($i < $num) { $obj=$db->fetch_object($resql); - print 'Product '.$obj->rowid.'-'.$obj->ref.' in warehose '.$obj->fk_entrepot.' -> '.$obj->psrowid.': '.$obj->reel.' (product_stock.reel) != '.$obj->reelbatch.' (sum product_batch)'; + print '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 if ($obj->reel != $obj->reelbatch) @@ -571,7 +571,7 @@ if ($ok && GETPOST('clean_product_stock_batch')) if ($methodtofix == 'updatestock') { // 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') { $error=0; @@ -579,7 +579,7 @@ if ($ok && GETPOST('clean_product_stock_batch')) $db->begin(); $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); if ($resql2) {