From 05b7c51e9d6265524f9d04ee92fb4b4fdfddca2d Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Mon, 17 Oct 2016 20:10:53 +0200
Subject: [PATCH] Fix count into loop and test on true

---
 htdocs/compta/facture/class/facture.class.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 68fb0f602db..fafb4ce51fe 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -2146,7 +2146,8 @@ class Facture extends CommonInvoice
                 if (!empty($conf->global->INVOICE_USE_SITUATION))
                 {
     				$final = True;
-    				while ($i < count($this->lines) && $final == True) {
+    				$nboflines = count($this->lines);
+    				while (($i < $nboflines) && $final) {
     					$final = ($this->lines[$i]->situation_percent == 100);
     					$i++;
     				}
-- 
GitLab