Skip to content

Commit

Permalink
fix join societe_commerciaux in societe list
Browse files Browse the repository at this point in the history
  • Loading branch information
uvaldenaire-opendsi committed Jan 7, 2025
1 parent eb4e059 commit c218eaa
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions htdocs/societe/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
//elseif ($search_sale || (empty($user->rights->societe->client->voir) && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->societe->client->readallthirdparties_advance)) && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
} elseif (!empty($search_sale) && $search_sale != '-1' || (empty($user->rights->societe->client->voir) && !$socid)) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux AS sc ON s.rowid = sc.fk_soc";
}
// Add table from hooks
$parameters = array();
Expand All @@ -527,9 +527,6 @@
if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($search_sale && $search_sale != '-1' && $search_sale != '-2') {
$sql .= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
}
if (empty($user->rights->fournisseur->lire)) {
$sql .= " AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible
}
Expand Down

0 comments on commit c218eaa

Please sign in to comment.