Fix: missing entity filter
This commit is contained in:
parent
f16d204ca2
commit
4f458c01f4
@ -98,7 +98,8 @@ if ($user->rights->fournisseur->facture->lire)
|
|||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= ",".MAIN_DB_PREFIX."facture_fourn as f";
|
$sql.= ",".MAIN_DB_PREFIX."facture_fourn as f";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf ON f.rowid=pf.fk_facturefourn ";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf ON f.rowid=pf.fk_facturefourn ";
|
||||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||||
|
$sql.= " AND f.fk_soc = s.rowid";
|
||||||
$sql.= " AND f.paye = 0 AND f.fk_statut = 1";
|
$sql.= " AND f.paye = 0 AND f.fk_statut = 1";
|
||||||
if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->fournisseur->warning_delay)."'";
|
if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->fournisseur->warning_delay)."'";
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
|
|||||||
@ -72,7 +72,8 @@ if ($mode == 'search')
|
|||||||
if ($modesearch == 'soc')
|
if ($modesearch == 'soc')
|
||||||
{
|
{
|
||||||
$sql = "SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s ";
|
$sql = "SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s ";
|
||||||
$sql.= " WHERE s.nom like '%".$db->escape(strtolower($socname))."%'";
|
$sql.= " WHERE s.nom LIKE '%".$db->escape(strtolower($socname))."%'";
|
||||||
|
$sql.= " AND s.entity IN (".getEntity('societe', 1).")";
|
||||||
}
|
}
|
||||||
|
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
@ -106,7 +107,8 @@ $sql.= " fac.total_ht, fac.total_ttc, fac.paye as paye, fac.fk_statut as fk_stat
|
|||||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user ";
|
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."facture_fourn as fac";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as fac";
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= " WHERE fac.fk_soc = s.rowid";
|
$sql.= " WHERE fac.entity = ".$conf->entity;
|
||||||
|
$sql.= " AND fac.fk_soc = s.rowid";
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
if ($socid)
|
if ($socid)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
||||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
|
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -257,7 +258,8 @@ if ($action == 'create' || $action == 'add_paiement')
|
|||||||
$sql.= ', sum(pf.amount) as am';
|
$sql.= ', sum(pf.amount) as am';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid';
|
||||||
$sql .= ' WHERE f.fk_soc = '.$facture->socid;
|
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||||
|
$sql.= ' AND f.fk_soc = '.$facture->socid;
|
||||||
$sql.= ' AND f.paye = 0';
|
$sql.= ' AND f.paye = 0';
|
||||||
$sql.= ' AND f.fk_statut = 1'; // Statut=0 => non validee, Statut=2 => annulee
|
$sql.= ' AND f.fk_statut = 1'; // Statut=0 => non validee, Statut=2 => annulee
|
||||||
$sql.= ' GROUP BY f.rowid,f.facnumber,f.total_ttc,f.datef';
|
$sql.= ' GROUP BY f.rowid,f.facnumber,f.total_ttc,f.datef';
|
||||||
@ -370,7 +372,7 @@ if (! $_GET['action'] && ! $_POST['action'])
|
|||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON s.rowid = f.fk_soc';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON s.rowid = f.fk_soc';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid';
|
||||||
$sql.= ' WHERE 1=1';
|
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||||
if (!$user->rights->societe->client->voir) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
if (!$user->rights->societe->client->voir) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
if ($socid)
|
if ($socid)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user