|
@@ -107,7 +107,7 @@ $sql.= ", ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c";
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
$sql.= " WHERE cd.fk_contrat = c.rowid AND c.fk_soc = s.rowid";
|
|
|
$sql.= " AND (cd.statut != 4 OR (cd.statut = 4 AND (cd.date_fin_validite is null or cd.date_fin_validite >= '".$db->idate($now)."')))";
|
|
|
-$sql.= " AND c.entity IN (".getEntity('contract', false).")";
|
|
|
+$sql.= " AND c.entity IN (".getEntity('contract', 0).")";
|
|
|
if ($user->societe_id) $sql.=' AND c.fk_soc = '.$user->societe_id;
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
|
$sql.= " GROUP BY cd.statut";
|
|
@@ -144,7 +144,7 @@ $sql.= ", ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c";
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
$sql.= " WHERE cd.fk_contrat = c.rowid AND c.fk_soc = s.rowid";
|
|
|
$sql.= " AND (cd.statut = 4 AND cd.date_fin_validite < '".$db->idate($now)."')";
|
|
|
-$sql.= " AND c.entity IN (".getEntity('contract', false).")";
|
|
|
+$sql.= " AND c.entity IN (".getEntity('contract', 0).")";
|
|
|
if ($user->societe_id) $sql.=' AND c.fk_soc = '.$user->societe_id;
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
|
$sql.= " GROUP BY cd.statut";
|
|
@@ -230,7 +230,7 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe as s";
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
$sql.= " WHERE s.rowid = c.fk_soc";
|
|
|
- $sql.= " AND c.entity IN (".getEntity('contract', false).")";
|
|
|
+ $sql.= " AND c.entity IN (".getEntity('contract', 0).")";
|
|
|
$sql.= " AND c.statut = 0";
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
|
if ($socid) $sql.= " AND c.fk_soc = ".$socid;
|
|
@@ -302,7 +302,7 @@ if (!$user->rights->societe->client->voir && !$socid) $sql.= " ".MAIN_DB_PREFIX.
|
|
|
$sql.= " ".MAIN_DB_PREFIX."contrat as c";
|
|
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat";
|
|
|
$sql.= " WHERE c.fk_soc = s.rowid";
|
|
|
-$sql.= " AND c.entity IN (".getEntity('contract', false).")";
|
|
|
+$sql.= " AND c.entity IN (".getEntity('contract', 0).")";
|
|
|
$sql.= " AND c.statut > 0";
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
|
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
|
@@ -372,7 +372,7 @@ $sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
$sql.= ", ".MAIN_DB_PREFIX."contratdet as cd";
|
|
|
$sql.= ") LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
|
|
-$sql.= " WHERE c.entity IN (".getEntity('contract', false).")";
|
|
|
+$sql.= " WHERE c.entity IN (".getEntity('contract', 0).")";
|
|
|
$sql.= " AND cd.fk_contrat = c.rowid";
|
|
|
$sql.= " AND c.fk_soc = s.rowid";
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
@@ -450,7 +450,7 @@ $sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
$sql.= ", ".MAIN_DB_PREFIX."contratdet as cd";
|
|
|
$sql.= " ) LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
|
|
-$sql.= " WHERE c.entity IN (".getEntity('contract', false).")";
|
|
|
+$sql.= " WHERE c.entity IN (".getEntity('contract', 0).")";
|
|
|
$sql.= " AND c.statut = 1";
|
|
|
$sql.= " AND cd.statut = 0";
|
|
|
$sql.= " AND cd.fk_contrat = c.rowid";
|
|
@@ -529,7 +529,7 @@ $sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
$sql.= ", ".MAIN_DB_PREFIX."contratdet as cd";
|
|
|
$sql.= " ) LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
|
|
-$sql.= " WHERE c.entity IN (".getEntity('contract', false).")";
|
|
|
+$sql.= " WHERE c.entity IN (".getEntity('contract', 0).")";
|
|
|
$sql.= " AND c.statut = 1";
|
|
|
$sql.= " AND cd.statut = 4";
|
|
|
$sql.= " AND cd.date_fin_validite < '".$db->idate($now)."'";
|