Skip to content

Commit

Permalink
Merge pull request #32557 from Easya-Solutions/18_fix_join_soc_commer…
Browse files Browse the repository at this point in the history
…ciaux

fix join societe_commerciaux in societe list
  • Loading branch information
eldy authored Jan 15, 2025
2 parents 60ea952 + c218eaa commit f24f4e0
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 f24f4e0

Please sign in to comment.