Skip to content
Snippets Groups Projects
Commit 90a90e1a authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

FIX #6533 #6590

parent 61031f16
No related branches found
No related tags found
No related merge requests found
......@@ -565,19 +565,16 @@ if (empty($action))
if (!$user->rights->societe->client->voir) $sql .= ' sc.fk_soc, sc.fk_user,';
$sql.= ' SUM(f.amount)';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn AS p';
if (!$user->rights->societe->client->voir) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn AS pf ON p.rowid=pf.fk_paiementfourn';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn AS f ON f.rowid=pf.fk_facturefourn';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement AS c ON p.fk_paiement = c.id';
$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_account as ba ON b.fk_account = ba.rowid';
if (!$user->rights->societe->client->voir) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$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 ($socid)
{
$sql .= ' AND f.fk_soc = '.$socid;
}
if ($socid > 0) $sql .= ' AND f.fk_soc = '.$socid;
// Search criteria
if ($search_ref) $sql .= natural_search('p.rowid', $search_ref);
if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment