mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-08 00:52:01 +01:00
Merge pull request #32557 from Easya-Solutions/18_fix_join_soc_commerciaux
fix join societe_commerciaux in societe list
This commit is contained in:
@@ -516,7 +516,7 @@ if ($search_sale == -2) {
|
||||
$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();
|
||||
@@ -527,9 +527,6 @@ $sql .= " WHERE s.entity IN (".getEntity('societe').")";
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user