|
@@ -1770,7 +1770,7 @@ class Product extends CommonObject
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
$sql.= " WHERE p.rowid = pd.fk_propal";
|
|
|
$sql.= " AND p.fk_soc = s.rowid";
|
|
|
- $sql.= " AND p.entity = ".$conf->entity;
|
|
|
+ $sql.= " AND p.entity IN (".getEntity('propal', 1).")";
|
|
|
$sql.= " AND pd.fk_product = ".$this->id;
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
|
//$sql.= " AND pr.fk_statut != 0";
|
|
@@ -1813,7 +1813,7 @@ class Product extends CommonObject
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
$sql.= " WHERE c.rowid = cd.fk_commande";
|
|
|
$sql.= " AND c.fk_soc = s.rowid";
|
|
|
- $sql.= " AND c.entity = ".$conf->entity;
|
|
|
+ $sql.= " AND c.entity IN (".getEntity('commande', 1).")";
|
|
|
$sql.= " AND cd.fk_product = ".$this->id;
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
|
if ($socid > 0) $sql.= " AND c.fk_soc = ".$socid;
|
|
@@ -1855,7 +1855,7 @@ class Product extends CommonObject
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
$sql.= " WHERE c.rowid = cd.fk_commande";
|
|
|
$sql.= " AND c.fk_soc = s.rowid";
|
|
|
- $sql.= " AND c.entity = ".$conf->entity;
|
|
|
+ $sql.= " AND c.entity IN (".getEntity('commande_fourniseur', 1).")";
|
|
|
$sql.= " AND cd.fk_product = ".$this->id;
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
|
if ($socid > 0) $sql.= " AND c.fk_soc = ".$socid;
|
|
@@ -1900,7 +1900,7 @@ class Product extends CommonObject
|
|
|
$sql.= " WHERE e.rowid = ed.fk_expedition";
|
|
|
$sql.= " AND c.rowid = cd.fk_commande";
|
|
|
$sql.= " AND e.fk_soc = s.rowid";
|
|
|
- $sql.= " AND e.entity = ".$conf->entity;
|
|
|
+ $sql.= " AND e.entity IN (".getEntity('expedition', 1).")";
|
|
|
$sql.= " AND ed.fk_origin_line = cd.rowid";
|
|
|
$sql.= " AND cd.fk_product = ".$this->id;
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND e.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
@@ -1943,7 +1943,7 @@ class Product extends CommonObject
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
$sql.= " WHERE cf.rowid = fd.fk_commande";
|
|
|
$sql.= " AND cf.fk_soc = s.rowid";
|
|
|
- $sql.= " AND cf.entity = ".$conf->entity;
|
|
|
+ $sql.= " AND cf.entity IN (".getEntity('commande_fournisseur', 1).")";
|
|
|
$sql.= " AND fd.fk_product = ".$this->id;
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND cf.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
|
if ($socid > 0) $sql.= " AND cf.fk_soc = ".$socid;
|
|
@@ -1985,7 +1985,7 @@ class Product extends CommonObject
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
$sql.= " WHERE c.rowid = cd.fk_contrat";
|
|
|
$sql.= " AND c.fk_soc = s.rowid";
|
|
|
- $sql.= " AND c.entity = ".$conf->entity;
|
|
|
+ $sql.= " AND c.entity IN (".getEntity('contrat', 1).")";
|
|
|
$sql.= " AND cd.fk_product = ".$this->id;
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
|
//$sql.= " AND c.statut != 0";
|
|
@@ -2027,7 +2027,7 @@ class Product extends CommonObject
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
$sql.= " WHERE f.rowid = fd.fk_facture";
|
|
|
$sql.= " AND f.fk_soc = s.rowid";
|
|
|
- $sql.= " AND f.entity = ".$conf->entity;
|
|
|
+ $sql.= " AND f.entity IN (".getEntity('facture', 1).")";
|
|
|
$sql.= " AND fd.fk_product = ".$this->id;
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
|
//$sql.= " AND f.fk_statut != 0";
|
|
@@ -2069,7 +2069,7 @@ class Product extends CommonObject
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
$sql.= " WHERE f.rowid = fd.fk_facture_fourn";
|
|
|
$sql.= " AND f.fk_soc = s.rowid";
|
|
|
- $sql.= " AND f.entity = ".$conf->entity;
|
|
|
+ $sql.= " AND f.entity IN (".getEntity('facture_fourn', 1).")";
|
|
|
$sql.= " AND fd.fk_product = ".$this->id;
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
|
//$sql.= " AND f.fk_statut != 0";
|
|
@@ -2167,7 +2167,7 @@ class Product extends CommonObject
|
|
|
$sql.= " WHERE f.rowid = d.fk_facture";
|
|
|
$sql.= " AND d.fk_product =".$this->id;
|
|
|
$sql.= " AND f.fk_soc = s.rowid";
|
|
|
- $sql.= " AND f.entity = ".$conf->entity;
|
|
|
+ $sql.= " AND f.entity IN (".getEntity('facture', 1).")";
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
|
if ($socid > 0) $sql.= " AND f.fk_soc = $socid";
|
|
|
$sql.= " GROUP BY date_format(f.datef,'%Y%m')";
|
|
@@ -2196,7 +2196,7 @@ class Product extends CommonObject
|
|
|
$sql.= " WHERE f.rowid = d.fk_facture_fourn";
|
|
|
$sql.= " AND d.fk_product =".$this->id;
|
|
|
$sql.= " AND f.fk_soc = s.rowid";
|
|
|
- $sql.= " AND f.entity = ".$conf->entity;
|
|
|
+ $sql.= " AND f.entity IN (".getEntity('facture_fourn', 1).")";
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
|
if ($socid > 0) $sql.= " AND f.fk_soc = $socid";
|
|
|
$sql.= " GROUP BY date_format(f.datef,'%Y%m')";
|
|
@@ -2225,7 +2225,7 @@ class Product extends CommonObject
|
|
|
$sql.= " WHERE p.rowid = d.fk_propal";
|
|
|
$sql.= " AND d.fk_product =".$this->id;
|
|
|
$sql.= " AND p.fk_soc = s.rowid";
|
|
|
- $sql.= " AND p.entity = ".$conf->entity;
|
|
|
+ $sql.= " AND p.entity IN (".getEntity('propal', 1).")";
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
|
if ($socid > 0) $sql.= " AND p.fk_soc = ".$socid;
|
|
|
$sql.= " GROUP BY date_format(p.datep,'%Y%m')";
|
|
@@ -2252,7 +2252,7 @@ class Product extends CommonObject
|
|
|
$sql.= " WHERE c.rowid = d.fk_commande";
|
|
|
$sql.= " AND d.fk_product =".$this->id;
|
|
|
$sql.= " AND c.fk_soc = s.rowid";
|
|
|
- $sql.= " AND c.entity = ".$conf->entity;
|
|
|
+ $sql.= " AND c.entity IN (".getEntity('commande', 1).")";
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
|
if ($socid > 0) $sql.= " AND c.fk_soc = ".$socid;
|
|
|
$sql.= " GROUP BY date_format(c.date_commande,'%Y%m')";
|
|
@@ -2279,7 +2279,7 @@ class Product extends CommonObject
|
|
|
$sql.= " WHERE c.rowid = d.fk_commande";
|
|
|
$sql.= " AND d.fk_product =".$this->id;
|
|
|
$sql.= " AND c.fk_soc = s.rowid";
|
|
|
- $sql.= " AND c.entity = ".$conf->entity;
|
|
|
+ $sql.= " AND c.entity IN (".getEntity('commande_fournisseur', 1).")";
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
|
if ($socid > 0) $sql.= " AND c.fk_soc = ".$socid;
|
|
|
$sql.= " GROUP BY date_format(c.date_commande,'%Y%m')";
|