diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index cc3eedcc72d..cf196ab3a3c 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);