Skip to content

Commit

Permalink
FIX key in getEntity for supplier proposals
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Apr 21, 2018
1 parent 98cb95c commit 394b988
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion htdocs/comm/index.php
Expand Up @@ -228,7 +228,7 @@
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE p.fk_statut = 0";
$sql.= " AND p.fk_soc = s.rowid";
$sql.= " AND p.entity IN (".getEntity('propal').")";
$sql.= " AND p.entity IN (".getEntity('supplier_proposal').")";
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;

Expand Down
2 changes: 1 addition & 1 deletion htdocs/product/class/product.class.php
Expand Up @@ -2767,7 +2767,7 @@ function get_nb_propalsupplier($socid, $mode, $filteronproducttype=-1, $year=0,
else $sql.=" AND d.fk_product > 0";
if ($filteronproducttype >= 0) $sql.= " AND prod.rowid = d.fk_product AND prod.fk_product_type =".$filteronproducttype;
$sql.= " AND p.fk_soc = s.rowid";
$sql.= " AND p.entity IN (".getEntity('propal').")";
$sql.= " AND p.entity IN (".getEntity('supplier_proposal').")";
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.=$morefilter;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/product/stats/supplier_proposal.php
Expand Up @@ -137,7 +137,7 @@
if (! $user->rights->societe->client->voir && ! $socid)
$sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
$sql .= " WHERE p.fk_soc = s.rowid";
$sql .= " AND p.entity IN (".getEntity('propal').")";
$sql .= " AND p.entity IN (".getEntity('supplier_proposal').")";
$sql .= " AND d.fk_supplier_proposal = p.rowid";
$sql .= " AND d.fk_product =" . $product->id;
if (! empty($search_month))
Expand Down
10 changes: 5 additions & 5 deletions htdocs/supplier_proposal/class/supplier_proposal.class.php
Expand Up @@ -2109,16 +2109,16 @@ function load_board($user,$mode)

$sql = "SELECT p.rowid, p.ref, p.datec as datec";
$sql.= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p";
if (!$user->rights->societe->client->voir && !$user->societe_id)
if (!$user->rights->societe->client->voir && !$user->socid)
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc";
$sql.= " WHERE sc.fk_user = " .$user->id;
$clause = " AND";
}
$sql.= $clause." p.entity = ".$conf->entity;
$sql.= $clause." p.entity IN (".getEntity('supplier_proposal').")";
if ($mode == 'opened') $sql.= " AND p.fk_statut = 1";
if ($mode == 'signed') $sql.= " AND p.fk_statut = 2";
if ($user->societe_id) $sql.= " AND p.fk_soc = ".$user->societe_id;
if ($user->socid) $sql.= " AND p.fk_soc = ".$user->socid;

$resql=$this->db->query($sql);
if ($resql)
Expand Down Expand Up @@ -2266,13 +2266,13 @@ function load_state_board()
$sql = "SELECT count(p.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid";
if (!$user->rights->societe->client->voir && !$user->societe_id)
if (!$user->rights->societe->client->voir && !$user->socid)
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql.= " WHERE sc.fk_user = " .$user->id;
$clause = "AND";
}
$sql.= " ".$clause." p.entity = ".$conf->entity;
$sql.= " ".$clause." p.entity IN (".getEntity('supplier_proposal').")";

$resql=$this->db->query($sql);
if ($resql)
Expand Down
4 changes: 2 additions & 2 deletions htdocs/supplier_proposal/index.php
Expand Up @@ -84,7 +84,7 @@
$sql.= ", ".MAIN_DB_PREFIX."supplier_proposal as p";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE p.fk_soc = s.rowid";
$sql.= " AND p.entity = ".$conf->entity;
$sql.= " AND p.entity IN (".getEntity('supplier_proposal').")";
if ($user->societe_id) $sql.=' AND p.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.= " AND p.fk_statut IN (0,1,2,3,4)";
Expand Down Expand Up @@ -303,7 +303,7 @@
$sql.= ", ".MAIN_DB_PREFIX."supplier_proposal as p";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE p.fk_soc = s.rowid";
$sql.= " AND p.entity = ".$conf->entity;
$sql.= " AND p.entity IN (".getEntity('supplier_proposal').")";
$sql.= " AND p.fk_statut = 1";
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;
Expand Down

0 comments on commit 394b988

Please sign in to comment.