FIX test on hasRight for product module

This commit is contained in:
Laurent Destailleur 2022-09-08 12:29:33 +02:00
parent 25fcc201e1
commit 1e0ce2f90a

View File

@ -711,7 +711,7 @@ class User extends CommonObject
'member' => 'adherent', // We must check $user->rights->adherent... 'member' => 'adherent', // We must check $user->rights->adherent...
'mo' => 'mrp', 'mo' => 'mrp',
'order' => 'commande', 'order' => 'commande',
//'product' => 'produit', // We must check $user->rights->produit... 'produit' => 'product',
'project' => 'projet', 'project' => 'projet',
'propale' => 'propal', 'propale' => 'propal',
'shipping' => 'expedition', 'shipping' => 'expedition',
@ -748,8 +748,9 @@ class User extends CommonObject
$permlevel1 = $tmp[0]; $permlevel1 = $tmp[0];
} }
//var_dump($module); // In $conf->modules, we have 'accounting', 'product', 'facture', ...
//var_dump($this->rights->$module); // In $user->rights, we have 'accounting', 'produit', 'facture', ...
//if ($a) { var_dump($module); var_dump($this->rights->$rightsPath); var_dump($conf->modules); }
if (!in_array($module, $conf->modules)) { if (!in_array($module, $conf->modules)) {
return 0; return 0;
} }
@ -764,7 +765,7 @@ class User extends CommonObject
if ($permlevel1 == 'recruitmentcandidature') { if ($permlevel1 == 'recruitmentcandidature') {
$permlevel1 = 'recruitmentjobposition'; $permlevel1 = 'recruitmentjobposition';
} }
//var_dump($module.' '.$permlevel1.' '.$permlevel2. ' '. $rightsPath);
//var_dump($this->rights); //var_dump($this->rights);
if (empty($rightsPath) || empty($this->rights) || empty($this->rights->$rightsPath) || empty($permlevel1)) { if (empty($rightsPath) || empty($this->rights) || empty($this->rights->$rightsPath) || empty($permlevel1)) {
return 0; return 0;