From dfc38351ef0b1b3861e604bf5ad3a1281f6e36e7 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Mon, 1 Aug 2016 19:48:39 +0200
Subject: [PATCH] Fix $i not initialized
---
htdocs/commande/class/api_commande.class.php | 1 +
htdocs/compta/facture/class/api_invoice.class.php | 1 +
htdocs/product/class/api_product.class.php | 2 ++
htdocs/societe/class/api_contact.class.php | 4 +++-
htdocs/societe/class/api_thirdparty.class.php | 1 +
5 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/htdocs/commande/class/api_commande.class.php b/htdocs/commande/class/api_commande.class.php
index d6a2a3d0f82..3a029bc0d00 100644
--- a/htdocs/commande/class/api_commande.class.php
+++ b/htdocs/commande/class/api_commande.class.php
@@ -160,6 +160,7 @@ class CommandeApi extends DolibarrApi
if ($result)
{
+ $i=0;
$num = $db->num_rows($result);
while ($i < $num)
{
diff --git a/htdocs/compta/facture/class/api_invoice.class.php b/htdocs/compta/facture/class/api_invoice.class.php
index 60098a38b9f..c64b5db89fe 100644
--- a/htdocs/compta/facture/class/api_invoice.class.php
+++ b/htdocs/compta/facture/class/api_invoice.class.php
@@ -158,6 +158,7 @@ class InvoiceApi extends DolibarrApi
$result = $db->query($sql);
if ($result)
{
+ $i=0;
$num = $db->num_rows($result);
while ($i < $num)
{
diff --git a/htdocs/product/class/api_product.class.php b/htdocs/product/class/api_product.class.php
index ae4ed46d30e..bf022260965 100644
--- a/htdocs/product/class/api_product.class.php
+++ b/htdocs/product/class/api_product.class.php
@@ -147,6 +147,7 @@ class ProductApi extends DolibarrApi
$result = $db->query($sql);
if ($result)
{
+ $i=0;
$num = $db->num_rows($result);
while ($i < $num)
{
@@ -232,6 +233,7 @@ class ProductApi extends DolibarrApi
$result = $db->query($sql);
if ($result)
{
+ $i=0;
$num = $db->num_rows($result);
while ($i < $num)
{
diff --git a/htdocs/societe/class/api_contact.class.php b/htdocs/societe/class/api_contact.class.php
index 5144c000b4d..884653e044d 100644
--- a/htdocs/societe/class/api_contact.class.php
+++ b/htdocs/societe/class/api_contact.class.php
@@ -114,6 +114,7 @@ class ContactApi extends DolibarrApi
$socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : '';
}
+ $search_sale = 0;
// If the internal user must only see his customers, force searching by him
if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid)
$search_sale = DolibarrApiAccess::$user->id;
@@ -164,7 +165,8 @@ class ContactApi extends DolibarrApi
$result = $db->query($sql);
if ($result)
{
- $num = $db->num_rows($result);
+ $i = 0;
+ $num = $db->num_rows($result);
while ($i < $num)
{
$obj = $db->fetch_object($result);
diff --git a/htdocs/societe/class/api_thirdparty.class.php b/htdocs/societe/class/api_thirdparty.class.php
index 507d95639e6..42a2c2f0c22 100644
--- a/htdocs/societe/class/api_thirdparty.class.php
+++ b/htdocs/societe/class/api_thirdparty.class.php
@@ -211,6 +211,7 @@ class ThirdpartyApi extends DolibarrApi
$result = $db->query($sql);
if ($result)
{
+ $i = 0;
$num = $db->num_rows($result);
while ($i < $num)
{
--
GitLab