diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a761b0606df..87b37aa4da4 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -128,8 +128,8 @@ abstract class CommonObject public $table_element_line = ''; /** - * @var int<0,1>|string 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') + * @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') */ public $ismultientitymanaged; diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 930e3cf9f35..dadbabf1b98 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -628,7 +628,6 @@ function reWriteAllPermissions($file, $permissions, $key, $right, $objectname, $ '@phan-var-force array $permissions'; if (!$error) { // prepare permissions array - $count_perms = count($permissions); foreach (array_keys($permissions) as $i) { $permissions[$i][0] = "\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1)"; $permissions[$i][1] = "\$this->rights[\$r][1] = '".$permissions[$i][1]."'"; diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index a260125d439..7cdd8e97eb0 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -2469,22 +2469,23 @@ if ($dirins && $action == 'addright' && !empty($module) && empty($cancel) && $us } 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); - if (function_exists('opcache_invalidate')) { - opcache_reset(); // remove the include cache hell ! + $moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php'; + // Rewriting all permissions section in the descriptor file + $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; } }