From f0c8b548f33d8f21232cd65e725ff0901867e548 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Dec 2017 14:24:31 +0100 Subject: [PATCH] Fix bugs reported by scrutinizer --- htdocs/api/class/api_setup.class.php | 5 +---- htdocs/install/upgrade2.php | 2 -- htdocs/product/stock/mouvement.php | 7 ++++--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index caba92f2947..27b909c2dad 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -628,7 +628,6 @@ class Setup extends DolibarrApi else { throw new RestException(500, $langs->trans('XmlNotFound') . ': ' . $xmlfile); - $error++; } } else @@ -646,13 +645,12 @@ class Setup extends DolibarrApi { $errormsg=$langs->trans('XmlNotFound') . ': ' . $xmlremote.' - '.$xmlarray['http_code'].' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg']; throw new RestException(500, $errormsg); - $error++; } } - if (! $error && $xml) + if ($xml) { $checksumconcat = array(); $file_list = array(); @@ -873,7 +871,6 @@ class Setup extends DolibarrApi else { throw new RestException(500, 'Error: Failed to found dolibarr_htdocs_dir into XML file '.$xmlfile); - $error++; } diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index eda1a4d26d5..430c6f46c94 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -3952,8 +3952,6 @@ function migrate_reset_blocked_log($db,$langs,$conf) $res = $b->create($user); if ($res<=0) { - $this->error = $b->error; - $this->errors = $b->errors; $error++; } } diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 046b3179506..e1daefd3e19 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -480,14 +480,15 @@ $sql.= $db->plimit($limit+1, $offset); $resql = $db->query($sql); if ($resql) { - if ($idproduct > 0) + $product = new Product($db); + $object = new Entrepot($db); + + if ($idproduct > 0) { - $product = new Product($db); $product->fetch($idproduct); } if ($id > 0) { - $object = new Entrepot($db); $result = $object->fetch($id); if ($result < 0) {