Skip to content

Commit

Permalink
FIX #6619 Template invoices list do not respect restricted thirdparty…
Browse files Browse the repository at this point in the history
… user rights
  • Loading branch information
marcosgdf committed Mar 30, 2017
1 parent 61031f1 commit 2448b9e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions htdocs/compta/facture/fiche-rec.php
Expand Up @@ -1384,8 +1384,14 @@
$sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre, f.total, f.tva as total_vat, f.total_ttc, f.frequency,";
$sql.= " f.date_last_gen, f.date_when";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
if (! $user->rights->societe->client->voir && ! $socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql.= " WHERE f.fk_soc = s.rowid";
$sql.= " AND f.entity = ".$conf->entity;
if (! $user->rights->societe->client->voir && ! $socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
}
if ($search_ref) $sql .= natural_search('f.titre', $search_ref);
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
if ($search_frequency) $sql .= natural_search('f.frequency', $search_frequency);
Expand Down

0 comments on commit 2448b9e

Please sign in to comment.