Skip to content

Commit

Permalink
Fix: missing getEntity function
Browse files Browse the repository at this point in the history
  • Loading branch information
jfefe committed Apr 19, 2015
1 parent df9973f commit 0c7ae0d
Show file tree
Hide file tree
Showing 19 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion htdocs/accountancy/customer/card.php
Expand Up @@ -87,7 +87,7 @@
$sql .= " WHERE f.fk_statut > 0 AND l.rowid = " . $id;

if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity = '" . $conf->entity . "'";
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
}

dol_syslog("/accounting/customer/card.php sql=" . $sql, LOG_DEBUG);
Expand Down
6 changes: 3 additions & 3 deletions htdocs/accountancy/customer/index.php
Expand Up @@ -159,7 +159,7 @@
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";

if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity = '" . $conf->entity . "'";
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
}

$sql .= " GROUP BY fd.fk_code_ventilation";
Expand Down Expand Up @@ -234,7 +234,7 @@
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";

if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity = '" . $conf->entity . "'";
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
}

dol_syslog('htdocs/accountancy/customer/index.php:: $sql=' . $sql);
Expand Down Expand Up @@ -307,7 +307,7 @@
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";

if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity = '" . $conf->entity . "'";
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
}

dol_syslog('htdocs/accountancy/customer/index.php:: $sql=' . $sql);
Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/customer/lines.php
Expand Up @@ -124,7 +124,7 @@
}

if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity = '" . $conf->entity . "'";
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
}

$sql .= " ORDER BY l.rowid";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/customer/list.php
Expand Up @@ -132,7 +132,7 @@
$sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation <= 0";
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='')";
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity = '" . $conf->entity . "'";
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
}

$sql .= " ORDER BY l.rowid";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/journal/purchasesjournal.php
Expand Up @@ -96,7 +96,7 @@
$sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
$sql .= " WHERE f.fk_statut > 0 ";
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity = " . $conf->entity;
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
}
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
$sql .= " AND f.type IN (0,1,2)";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/journal/sellsjournal.php
Expand Up @@ -99,7 +99,7 @@
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
$sql .= " WHERE fd.fk_code_ventilation > 0 ";
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity = " . $conf->entity;
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
}
$sql .= " AND f.fk_statut > 0";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/supplier/card.php
Expand Up @@ -88,7 +88,7 @@
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = l.fk_facture_fourn ";
$sql .= " WHERE f.fk_statut > 0 AND l.rowid = " . $id;
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity = '" . $conf->entity . "'";
$sql .= " AND f.entity IN (" . getEntity("facture_fourn", 1) . ")";
}

$result = $db->query($sql);
Expand Down
4 changes: 2 additions & 2 deletions htdocs/accountancy/supplier/index.php
Expand Up @@ -144,7 +144,7 @@
$sql .= " AND ff.fk_statut > 0 ";

if (! empty($conf->multicompany->enabled)) {
$sql .= " AND ff.entity = '" . $conf->entity . "'";
$sql .= " AND ff.entity IN (" . getEntity("facture_fourn", 1) . ")";
}

$sql .= " GROUP BY ffd.fk_code_ventilation";
Expand Down Expand Up @@ -221,7 +221,7 @@
$sql .= " AND ff.fk_statut > 0 ";

if (! empty($conf->multicompany->enabled)) {
$sql .= " AND ff.entity = '" . $conf->entity . "'";
$sql .= " AND ff.entity IN (" . getEntity("facture_fourn", 1) . ")";
}

dol_syslog('/accountancy/supplier/index.php:: sql=' . $sql);
Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/supplier/lines.php
Expand Up @@ -121,7 +121,7 @@
$sql .= " AND aa.account_number like '%" . $_GET["search_account"] . "%'";
}
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity = '" . $conf->entity . "'";
$sql .= " AND f.entity IN (" . getEntity("facture_fourn", 1) . ")";
}

$sql .= " ORDER BY l.rowid";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/supplier/list.php
Expand Up @@ -135,7 +135,7 @@
$sql .= " AND (accsys.rowid='".$conf->global->CHARTOFACCOUNTS."' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_buy ='')";

if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity = '" . $conf->entity . "'";
$sql .= " AND f.entity IN (" . getEntity("facture_fourn", 1) . ")";
}

$sql .= " ORDER BY l.rowid";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/admin/tools/listevents.php
Expand Up @@ -123,7 +123,7 @@
$sql.= " u.login";
$sql.= " FROM ".MAIN_DB_PREFIX."events as e";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = e.fk_user";
$sql.= " WHERE e.entity = ".$conf->entity;
$sql.= " WHERE e.entity IN (".getEntity('actioncomm', 1).")";
if ($search_code) { $usefilter++; $sql.=" AND e.type LIKE '%".$db->escape($search_code)."%'"; }
if ($search_ip) { $usefilter++; $sql.=" AND e.ip LIKE '%".$db->escape($search_ip)."%'"; }
if ($search_user) { $usefilter++; $sql.=" AND u.login LIKE '%".$db->escape($search_user)."%'"; }
Expand Down
2 changes: 1 addition & 1 deletion htdocs/comm/card.php
Expand Up @@ -684,7 +684,7 @@
$sql.= ', s.rowid as socid';
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."expedition as e";
$sql.= " WHERE e.fk_soc = s.rowid AND s.rowid = ".$object->id;
$sql.= " AND e.entity = ".$conf->entity;
$sql.= " AND e.entity IN (".getEntity('expedition', 1).")";
$sql.= ' GROUP BY e.rowid';
$sql.= ', e.ref';
$sql.= ', e.date_creation';
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/lib/sendings.lib.php
Expand Up @@ -167,7 +167,7 @@ function show_list_sending_receive($origin,$origin_id,$filter='')
$sql.= ", ".MAIN_DB_PREFIX.$origin."det as obj";
//if ($conf->livraison_bon->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."livraison as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."livraisondet as ld ON ld.fk_livraison = l.rowid AND obj.rowid = ld.fk_origin_line";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid";
$sql.= " WHERE e.entity = ".$conf->entity;
$sql.= " WHERE e.entity IN (".getEntity('expedition', 1).")";
$sql.= " AND obj.fk_".$origin." = ".$origin_id;
$sql.= " AND obj.rowid = ed.fk_origin_line";
$sql.= " AND ed.fk_expedition = e.rowid";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/expedition/class/expedition.class.php
Expand Up @@ -438,7 +438,7 @@ function fetch($id, $ref='', $ref_ext='', $ref_int='')
$sql.= " FROM ".MAIN_DB_PREFIX."expedition as e";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = e.rowid AND el.targettype = '".$this->element."'";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON e.fk_incoterms = i.rowid';
$sql.= " WHERE e.entity = ".$conf->entity;
$sql.= " WHERE e.entity IN (".getEntity('expedition', 1).")";
if ($id) $sql.= " AND e.rowid=".$id;
if ($ref) $sql.= " AND e.ref='".$this->db->escape($ref)."'";
if ($ref_ext) $sql.= " AND e.ref_ext='".$this->db->escape($ref_ext)."'";
Expand Down
4 changes: 2 additions & 2 deletions htdocs/expedition/index.php
Expand Up @@ -75,7 +75,7 @@
$clause = " AND ";
}
$sql.= $clause." e.fk_statut = 0";
$sql.= " AND e.entity = ".$conf->entity;
$sql.= " AND e.entity IN (".getEntity('expedition', 1).")";
if ($socid) $sql.= " AND c.fk_soc = ".$socid;

$resql=$db->query($sql);
Expand Down Expand Up @@ -235,7 +235,7 @@
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid AND el.sourcetype IN ('commande') AND el.targettype = 'shipping'";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc";
$sql.= " WHERE e.entity = ".$conf->entity;
$sql.= " WHERE e.entity IN (".getEntity('expedition', 1).")";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND sc.fk_user = " .$user->id;
$sql.= " AND e.fk_statut = 1";
if ($socid) $sql.= " AND c.fk_soc = ".$socid;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/expedition/list.php
Expand Up @@ -82,7 +82,7 @@
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as ee ON e.rowid = ee.fk_source AND ee.sourcetype = 'shipping' AND ee.targettype = 'delivery'";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."livraison as l ON l.rowid = ee.fk_target";
$sql.= " WHERE e.entity = ".$conf->entity;
$sql.= " WHERE e.entity IN (".getEntity('expedition', 1).")";
if (!$user->rights->societe->client->voir && !$socid) // Internal user with no permission to see all
{
$sql.= " AND e.fk_soc = sc.fk_soc";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/product/class/html.formproduct.class.php
Expand Up @@ -72,7 +72,7 @@ function loadWarehouses($fk_product=0)
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps on ps.fk_entrepot = e.rowid";
$sql.= " AND ps.fk_product = '".$fk_product."'";
}
$sql.= " WHERE e.entity = ".$conf->entity;
$sql.= " WHERE e.entity IN (".getEntity('stock', 1).")";
$sql.= " AND e.statut = 1";
$sql.= " ORDER BY e.label";

Expand Down
2 changes: 1 addition & 1 deletion htdocs/product/class/product.class.php
Expand Up @@ -1900,7 +1900,7 @@ function load_stats_sending($socid=0,$filtrestatut='')
$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;
Expand Down
8 changes: 4 additions & 4 deletions htdocs/product/stock/replenish.php
Expand Up @@ -295,7 +295,7 @@
$sqlCommandesCli = "(SELECT ".$db->ifsql("SUM(cd.qty) IS NULL", "0", "SUM(cd.qty)")." as qty";
$sqlCommandesCli.= " FROM ".MAIN_DB_PREFIX."commandedet as cd";
$sqlCommandesCli.= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON (c.rowid = cd.fk_commande)";
$sqlCommandesCli.= " WHERE c.entity = ".$conf->entity;
$sqlCommandesCli.= " WHERE c.entity IN (".getEntity('order', 1).")";
$sqlCommandesCli.= " AND cd.fk_product = p.rowid";
$sqlCommandesCli.= " AND c.fk_statut IN (1,2))";

Expand All @@ -304,22 +304,22 @@
$sqlExpeditionsCli.= " LEFT JOIN ".MAIN_DB_PREFIX."expeditiondet as ed ON (ed.fk_expedition = e.rowid)";
$sqlExpeditionsCli.= " LEFT JOIN ".MAIN_DB_PREFIX."commandedet as cd ON (cd.rowid = ed.fk_origin_line)";
$sqlExpeditionsCli.= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON (c.rowid = cd.fk_commande)";
$sqlExpeditionsCli.= " WHERE e.entity = ".$conf->entity;
$sqlExpeditionsCli.= " WHERE e.entity IN (".getEntity('expedition', 1).")";
$sqlExpeditionsCli.= " AND cd.fk_product = p.rowid";
$sqlExpeditionsCli.= " AND c.fk_statut IN (1,2))";

$sqlCommandesFourn = "(SELECT ".$db->ifsql("SUM(cd.qty) IS NULL", "0", "SUM(cd.qty)")." as qty";
$sqlCommandesFourn.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd";
$sqlCommandesFourn.= ", ".MAIN_DB_PREFIX."commande_fournisseur as c";
$sqlCommandesFourn.= " WHERE c.rowid = cd.fk_commande";
$sqlCommandesFourn.= " AND c.entity = ".$conf->entity;
$sqlCommandesFourn.= " AND c.entity IN (".getEntity('commande_fournisseur', 1).")";
$sqlCommandesFourn.= " AND cd.fk_product = p.rowid";
$sqlCommandesFourn.= " AND c.fk_statut IN (3,4))";

$sqlReceptionFourn = "(SELECT ".$db->ifsql("SUM(fd.qty) IS NULL", "0", "SUM(fd.qty)")." as qty";
$sqlReceptionFourn.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf";
$sqlReceptionFourn.= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as fd ON (fd.fk_commande = cf.rowid)";
$sqlReceptionFourn.= " WHERE cf.entity = ".$conf->entity;
$sqlReceptionFourn.= " WHERE cf.entity IN (".getEntity('commande_fournisseur', 1).")";
$sqlReceptionFourn.= " AND fd.fk_product = p.rowid";
$sqlReceptionFourn.= " AND cf.fk_statut IN (3,4))";

Expand Down

0 comments on commit 0c7ae0d

Please sign in to comment.