Skip to content

Commit

Permalink
Fix multicompany
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jan 20, 2017
1 parent fc4aa96 commit 1add34b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions htdocs/margin/agentMargins.php
Expand Up @@ -129,15 +129,15 @@
$sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ", ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE f.fk_soc = s.rowid";
$sql.= " AND f.entity = ".$conf->entity;
$sql.= ' AND f.entity IN ('.getEntity('facture', 1).')';
$sql.= " AND sc.fk_soc = f.fk_soc";
$sql.= " AND (d.product_type = 0 OR d.product_type = 1)";
if (! empty($conf->global->AGENT_CONTACT_TYPE))
$sql.= " AND ((e.fk_socpeople IS NULL AND sc.fk_user = u.rowid) OR (e.fk_socpeople IS NOT NULL AND e.fk_socpeople = u.rowid))";
else
$sql .= " AND sc.fk_user = u.rowid";
$sql.= " AND f.fk_statut > 0";
$sql.= " AND s.entity = ".$conf->entity;
$sql.= ' AND s.entity IN ('.getEntity('societe', 1).')';
$sql.= " AND d.fk_facture = f.rowid";
if ($agentid > 0) {
if (! empty($conf->global->AGENT_CONTACT_TYPE))
Expand Down
2 changes: 1 addition & 1 deletion htdocs/margin/customerMargins.php
Expand Up @@ -180,7 +180,7 @@
$sql.= ", ".MAIN_DB_PREFIX."facturedet as d";
$sql.= " WHERE f.fk_soc = s.rowid";
$sql.= " AND f.fk_statut > 0";
$sql.= " AND s.entity = ".$conf->entity;
$sql.= ' AND s.entity IN ('.getEntity('societe', 1).')';
$sql.= " AND d.fk_facture = f.rowid";
$sql.= " AND (d.product_type = 0 OR d.product_type = 1)";
if ($client)
Expand Down
4 changes: 2 additions & 2 deletions htdocs/margin/productMargins.php
Expand Up @@ -175,8 +175,8 @@
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
$sql.= ", ".MAIN_DB_PREFIX."facturedet as d";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = d.fk_product";
$sql.= " WHERE f.entity = ".$conf->entity;
$sql.= " AND f.fk_soc = s.rowid";
$sql.= " WHERE f.fk_soc = s.rowid";
$sql.= ' AND f.entity IN ('.getEntity('facture', 1).')';
$sql.= " AND f.fk_statut > 0";
$sql.= " AND d.fk_facture = f.rowid";
if ($id > 0)
Expand Down

0 comments on commit 1add34b

Please sign in to comment.