From ba230982dbd2c5cdbd1437ed62c288b4e5a6bea7 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 045048e7395..34e5377551e 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5712,6 +5712,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);