FIX Check "$search_sale" only if it's an internal user

This commit is contained in:
Regis Houssin 2024-12-02 12:10:39 +01:00
parent 2beb6e1e34
commit 3e3f9c755d
5 changed files with 10 additions and 5 deletions

View File

@ -286,7 +286,8 @@ foreach ($object->fields as $key => $val) {
}
}*/
if (!$user->hasRight('societe', 'client', 'voir')) {
// Check only if it's an internal user
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$search_sale = $user->id;
}

View File

@ -304,7 +304,8 @@ $object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
if (!$user->hasRight('societe', 'client', 'voir')) {
// Check only if it's an internal user
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$search_sale = $user->id;
}

View File

@ -217,7 +217,8 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
$error = 0;
if (!$user->hasRight('societe', 'client', 'voir')) {
// Check only if it's an internal user
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$search_sale = $user->id;
}

View File

@ -226,7 +226,8 @@ if ((!$user->hasRight("fournisseur", "facture", "lire") && !getDolGlobalString('
accessforbidden();
}
if (!$user->hasRight('societe', 'client', 'voir')) {
// Check only if it' an internal user
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$search_sale = $user->id;
}

View File

@ -198,7 +198,8 @@ $object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
if (!$user->hasRight('societe', 'client', 'voir')) {
// Check only if it's an internal user
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$search_sale = $user->id;
}