From 3e17a4737f630c5e39b56df2239cc40c88c4239b Mon Sep 17 00:00:00 2001 From: tnegre Date: Thu, 2 Mar 2023 14:29:15 +0100 Subject: [PATCH] FIX: validation date for invoice was compared in all entities. They should be compared only in the same entity. --- htdocs/compta/facture/class/facture.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 265b5732f24..8c93bfb5459 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5768,6 +5768,7 @@ class Facture extends CommonInvoice $sql .= " FROM ".MAIN_DB_PREFIX."facture"; $sql .= " WHERE type = " . (int) $this->type ; $sql .= " AND date_valid IS NOT NULL"; + $sql .= " AND entity IN (".getEntity('invoice').")"; $sql .= " ORDER BY datef DESC LIMIT 1"; $result = $this->db->query($sql);