From ff35192b649099a3b3f53e13dc9c2dcbb4f66993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 28 Apr 2024 12:31:54 +0200 Subject: [PATCH] fix phan (#29513) * fix phan * Update donation.php * Update project.php * Update facture.class.php --- htdocs/compta/facture/class/facture.class.php | 3 +-- htdocs/don/admin/donation.php | 4 +++- htdocs/product/admin/product.php | 4 +++- htdocs/projet/admin/project.php | 4 +++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index e4708a0e8ce..71961c72d3c 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5372,8 +5372,7 @@ class Facture extends CommonInvoice $sql .= ' AND entity = '.($this->entity > 0 ? $this->entity : $conf->entity); $resql = $this->db->query($sql); - if ($resql && $this->db->num_rows($resql) > 0) { - $res = $this->db->fetch_array($resql); + if ($resql && $this->db->num_rows($resql) > 0 && $res = $this->db->fetch_array($resql)) { $last = $res['max(situation_counter)']; return ($last == $this->situation_counter); } else { diff --git a/htdocs/don/admin/donation.php b/htdocs/don/admin/donation.php index b88040c2ed7..9f7faf9b6ca 100644 --- a/htdocs/don/admin/donation.php +++ b/htdocs/don/admin/donation.php @@ -200,7 +200,9 @@ if ($resql) { $num_rows = $db->num_rows($resql); while ($i < $num_rows) { $array = $db->fetch_array($resql); - array_push($def, $array[0]); + if (is_array($array)) { + array_push($def, $array[0]); + } $i++; } } else { diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index a565fb86518..085b976f5ef 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -382,7 +382,9 @@ if ($resql) { $num_rows = $db->num_rows($resql); while ($i < $num_rows) { $array = $db->fetch_array($resql); - array_push($def, $array[0]); + if (is_array($array)) { + array_push($def, $array[0]); + } $i++; } } else { diff --git a/htdocs/projet/admin/project.php b/htdocs/projet/admin/project.php index 9e0da996d6e..f5fee2ef5a3 100644 --- a/htdocs/projet/admin/project.php +++ b/htdocs/projet/admin/project.php @@ -511,7 +511,9 @@ if ($resql) { $num_rows = $db->num_rows($resql); while ($i < $num_rows) { $array = $db->fetch_array($resql); - array_push($def, $array[0]); + if (is_array($array)) { + array_push($def, $array[0]); + } $i++; } } else {