New: getEntity function use true $shared value by default

This commit is contained in:
Regis Houssin
2017-05-30 18:50:54 +02:00
parent d9cdad6a77
commit 5c5663c5ae
237 changed files with 456 additions and 454 deletions

View File

@@ -1564,7 +1564,7 @@ class Commande extends CommonOrder
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON (c.fk_availability = ca.rowid)';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON (c.fk_input_reason = ca.rowid)';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid';
$sql.= " WHERE c.entity IN (".getEntity('commande', 1).")";
$sql.= " WHERE c.entity IN (".getEntity('commande').")";
if ($id) $sql.= " AND c.rowid=".$id;
if ($ref) $sql.= " AND c.ref='".$this->db->escape($ref)."'";
if ($ref_ext) $sql.= " AND c.ref_ext='".$this->db->escape($ref_ext)."'";
@@ -2369,7 +2369,7 @@ class Commande extends CommonOrder
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE c.entity IN (".getEntity('commande', 1).")";
$sql.= " WHERE c.entity IN (".getEntity('commande').")";
$sql.= " AND c.fk_soc = s.rowid";
if (! $user->rights->societe->client->voir && ! $socid) //restriction
{
@@ -3222,7 +3222,7 @@ class Commande extends CommonOrder
$sql.= " WHERE sc.fk_user = " .$user->id;
$clause = " AND";
}
$sql.= $clause." c.entity IN (".getEntity('commande', 1).")";
$sql.= $clause." c.entity IN (".getEntity('commande').")";
//$sql.= " AND c.fk_statut IN (1,2,3) AND c.facture = 0";
$sql.= " AND ((c.fk_statut IN (".self::STATUS_VALIDATED.",".self::STATUS_ACCEPTED.")) OR (c.fk_statut = ".self::STATUS_CLOSED." AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected
if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id;
@@ -3506,7 +3506,7 @@ class Commande extends CommonOrder
$prodids = array();
$sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."product";
$sql.= " WHERE entity IN (".getEntity('product', 1).")";
$sql.= " WHERE entity IN (".getEntity('product').")";
$resql = $this->db->query($sql);
if ($resql)
{
@@ -3598,7 +3598,7 @@ class Commande extends CommonOrder
$sql.= " WHERE sc.fk_user = " .$user->id;
$clause = "AND";
}
$sql.= " ".$clause." co.entity IN (".getEntity('commande', 1).")";
$sql.= " ".$clause." co.entity IN (".getEntity('commande').")";
$resql=$this->db->query($sql);
if ($resql)