FIX: validation date for invoice was compared in all entities. They should be compared only in the same entity.

This commit is contained in:
tnegre 2023-03-02 14:29:15 +01:00
parent 6f8b1108ca
commit ba230982db

View File

@ -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);