Close #15307 Encours dpassé with eldy suggestions

This commit is contained in:
lmarcouiller 2020-11-30 16:50:12 +01:00
parent cee1b3cee4
commit ff30021d35

View File

@ -103,6 +103,8 @@ class box_customers_outstanding_bill_reached extends ModeleBoxes
$sql .= " AND s.entity IN (".getEntity('societe').")";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = $user->socid";
$sql .= " AND s.outstanding_limit > 0";
$sql .= " AND s.rowid IN (SELECT fk_soc from ".MAIN_DB_PREFIX."facture as f WHERE f.fk_statut = 1 and f.fk_soc = s.rowid)";
$sql .= " ORDER BY s.tms DESC";
$sql .= $this->db->plimit($max, 0);