forked from Wavyzz/dolibarr
Fix warnings
This commit is contained in:
@@ -128,8 +128,8 @@ abstract class CommonObject
|
|||||||
public $table_element_line = '';
|
public $table_element_line = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int<0,1>|string Does this object support multicompany module ?
|
* @var int<0,1>|string|null Does this object support multicompany module ?
|
||||||
* 0=No test on entity, 1=Test with field entity in local table, 'field@table'=Test entity into the field@table (example 'fk_soc@societe')
|
* 0=No test on entity, 1=Test with field entity in local table, 'field@table'=Test entity into the field@table (example 'fk_soc@societe')
|
||||||
*/
|
*/
|
||||||
public $ismultientitymanaged;
|
public $ismultientitymanaged;
|
||||||
|
|
||||||
|
|||||||
@@ -628,7 +628,6 @@ function reWriteAllPermissions($file, $permissions, $key, $right, $objectname, $
|
|||||||
'@phan-var-force array<int,string[]> $permissions';
|
'@phan-var-force array<int,string[]> $permissions';
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
// prepare permissions array
|
// prepare permissions array
|
||||||
$count_perms = count($permissions);
|
|
||||||
foreach (array_keys($permissions) as $i) {
|
foreach (array_keys($permissions) as $i) {
|
||||||
$permissions[$i][0] = "\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1)";
|
$permissions[$i][0] = "\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1)";
|
||||||
$permissions[$i][1] = "\$this->rights[\$r][1] = '".$permissions[$i][1]."'";
|
$permissions[$i][1] = "\$this->rights[\$r][1] = '".$permissions[$i][1]."'";
|
||||||
|
|||||||
@@ -2469,22 +2469,23 @@ if ($dirins && $action == 'addright' && !empty($module) && empty($cancel) && $us
|
|||||||
}
|
}
|
||||||
setEventMessages($langs->trans('WarningModuleNeedRefresh', $langs->transnoentities($module)), null, 'warnings');
|
setEventMessages($langs->trans('WarningModuleNeedRefresh', $langs->transnoentities($module)), null, 'warnings');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
$moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
|
|
||||||
//rewriting all permissions after add a right
|
|
||||||
$rewrite = checkExistComment($moduledescriptorfile, 1);
|
|
||||||
if ($rewrite < 0) {
|
|
||||||
setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Permissions"), "mod".$module."class.php"), null, 'warnings');
|
|
||||||
} else {
|
|
||||||
reWriteAllPermissions($moduledescriptorfile, $permissions, $key, $rightToAdd, '', '', 1);
|
|
||||||
setEventMessages($langs->trans('PermissionAddedSuccesfuly'), null);
|
|
||||||
|
|
||||||
clearstatcache(true);
|
$moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
|
||||||
if (function_exists('opcache_invalidate')) {
|
// Rewriting all permissions section in the descriptor file
|
||||||
opcache_reset(); // remove the include cache hell !
|
$rewrite = checkExistComment($moduledescriptorfile, 1);
|
||||||
|
if ($rewrite < 0) {
|
||||||
|
setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Permissions"), "mod".$module."class.php"), null, 'warnings');
|
||||||
|
} else {
|
||||||
|
reWriteAllPermissions($moduledescriptorfile, $permissions, $key, $rightToAdd, '', '', 1);
|
||||||
|
setEventMessages($langs->trans('PermissionAddedSuccesfuly'), null);
|
||||||
|
|
||||||
|
clearstatcache(true);
|
||||||
|
if (function_exists('opcache_invalidate')) {
|
||||||
|
opcache_reset(); // remove the include cache hell !
|
||||||
|
}
|
||||||
|
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module);
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module);
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user