2
0
forked from Wavyzz/dolibarr

NEW - See the documents of my subordinates (#28318)

* NEW - See the documents of my subordinates

* cop

* Rewriting

* up

* ok

* FIX - Restriction on sale representative

---------

Co-authored-by: Anthony Berton <anthony.berton@bb2a.fr>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
Anthony Berton
2024-03-07 22:47:29 +01:00
committed by GitHub
parent 3035a7bc7f
commit ff03f86a50
3 changed files with 39 additions and 7 deletions

View File

@@ -2346,7 +2346,12 @@ abstract class CommonObject
$sql .= " WHERE te.".$fieldid." > '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
}
if ($restrictiononfksoc == 1 && !$user->hasRight('societe', 'client', 'voir') && !$socid) {
$sql .= " AND sc.fk_user = ".((int) $user->id);
$sql .= " AND (sc.fk_user = ".((int) $user->id);
if (getDolGlobalInt('MAIN_SEE_SUBORDINATES')) {
$userschilds = $user->getAllChildIds();
$sql .= " OR sc.fk_user IN (".$this->db->sanitize(implode(',', $userschilds)).")";
}
$sql .= ')';
}
if ($restrictiononfksoc == 2 && !$user->hasRight('societe', 'client', 'voir') && !$socid) {
$sql .= " AND (sc.fk_user = ".((int) $user->id).' OR te.fk_soc IS NULL)';