This commit is contained in:
Laurent Destailleur 2021-06-10 16:31:28 +02:00
parent 548e11d3d9
commit 1950e50c89

View File

@ -4164,7 +4164,7 @@ class Facture extends CommonInvoice
$sql .= " AND fs.type = ".self::TYPE_SITUATION;
$sql .= " AND fs.fk_statut IN (".self::STATUS_VALIDATED.",".self::STATUS_CLOSED.")";
if ($socid > 0) {
$sql .= " AND f.fk_soc = ".((int) $socid);
$sql .= " AND fs.fk_soc = ".((int) $socid);
}
$sql .= " GROUP BY fs.situation_cycle_ref)"; // For each situation_cycle_ref, we take the higher rowid
$sql .= ")";