From 572b2fdec7efaa8bb6d7c92ad0a2c5808ee5ec86 Mon Sep 17 00:00:00 2001
From: Alexis Algoud <alexis@atm-consulting.fr>
Date: Tue, 12 Jul 2016 15:01:43 +0200
Subject: [PATCH] FIX dasboard wrong for late invoice

---
 htdocs/compta/facture/class/facture.class.php | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 27432d7c399..33d6e23c6b3 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -3212,7 +3212,7 @@ class Facture extends CommonInvoice
 
 		$clause = " WHERE";
 
-		$sql = "SELECT f.rowid, f.date_lim_reglement as datefin";
+		$sql = "SELECT f.rowid, f.date_lim_reglement as datefin,f.fk_statut";
 		$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
 		if (!$user->rights->societe->client->voir && !$user->societe_id)
 		{
@@ -3242,6 +3242,7 @@ class Facture extends CommonInvoice
 			while ($obj=$this->db->fetch_object($resql))
 			{
 				$generic_facture->date_lim_reglement = $this->db->jdate($obj->datefin);
+				$generic_facture->statut = $obj->fk_statut;
 
 				$response->nbtodo++;
 
@@ -3249,7 +3250,7 @@ class Facture extends CommonInvoice
 					$response->nbtodolate++;
 				}
 			}
-
+	
 			return $response;
 		}
 		else
@@ -3727,7 +3728,7 @@ class Facture extends CommonInvoice
 		global $conf;
 
 		$now = dol_now();
-
+		
 		// Paid invoices have status STATUS_CLOSED
 		if ($this->statut != Facture::STATUS_VALIDATED) return false;
 		
-- 
GitLab