diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index 96928adfdff..1c18264618d 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -432,7 +432,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" box while (($file = readdir($handle)) !== false) { $reg = array(); if (is_readable($newdir.'/'.$file) && preg_match('/^(.+)\.php/', $file, $reg)) { - if (preg_match('/\.back$/', $file)) { + if (preg_match('/\.back$/', $file) || preg_match('/^(.+)\.disabled\.php/', $file)) { continue; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 887d14fd36a..e0f3fb0a4bb 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1788,7 +1788,9 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di if (empty($conf->use_javascript_ajax)) { $out .= ' href="'.DOL_URL_ROOT.$url.'" target="_blank"'; } elseif ($jsonopen) { - $out .= ' onclick="javascript:'.$jsonopen.'"'; + $out .= ' href="#" onclick="javascript:'.$jsonopen.'"'; + } else { + $out .= ' href="#"'; } $out .= '>'.$buttonstring.''; diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index dbb4e53f94b..edcb5923af0 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -174,3 +174,6 @@ MenuDeletedSuccessfuly=Menu has been successfully deleted MenuAddedSuccessfuly=Menu has been successfully added MenuUpdatedSuccessfuly=Menu has been successfully updated ApiObjectDeleted=API for object %s has been successfully deleted +CRUDRead=Read +CRUDCreateWrite=Create or Update +FailedToAddCodeIntoDescriptor=Failed to add code into descriptor. Check that the string comment "%s" is still present into the file. \ No newline at end of file diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 16464caa03a..263c951f413 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -924,19 +924,17 @@ if ($dirins && $action == 'addlanguage' && !empty($module)) { } -// remove/delete File +// Remove/delete File if ($dirins && $action == 'confirm_removefile' && !empty($module)) { $objectname = $tabobj; $relativefilename = dol_sanitizePathName(GETPOST('file', 'restricthtml')); - $file_api = $dirins."/".$relativefilename; - //check if have more than one object + // Scan dir class to detect all classes of module $module and save them into $objects[] $dirins = $listofmodules[strtolower($module)]['moduledescriptorrootpath']; $destdir = $dirins.'/'.strtolower($module); $listofobject = dol_dir_list($destdir.'/class', 'files', 0, '\.class\.php$'); $objects = array(); - foreach ($listofobject as $fileobj) { if (preg_match('/^api_/', $fileobj['name'])) { continue; @@ -952,115 +950,57 @@ if ($dirins && $action == 'confirm_removefile' && !empty($module)) { } } - $existObj = 0; - $file = file_get_contents($file_api); - $objs = array(); - if (str_contains($file, $objectname)) { - $existObj++; - } - if ($existObj && count($objects) > 1) { - $begin = '/*CRUD FOR '.strtoupper($objectname).'*/'; - $end = '/*END CRUD FOR '.strtoupper($objectname).'*/'; - $varcomentedDel = "\t * @var ".$objectname." \$".strtolower($objectname)." {@type ".$objectname."}"; - $propsDel .= "\tpublic \$".strtolower($objectname).";"; - $constructObjDel .= "\t\t\$this->".strtolower($objectname)."= new ".$objectname."(\$this->db);"; - $content = file($file_api); - // for delete property and the initialization from the construct - foreach ($content as $lineNumber => &$lineContent) { - if (strpos($lineContent, $varcomentedDel) !== false) { - $lineContent = ''; + // Now we delete the file + if ($relativefilename) { + $dirnametodelete = dirname($relativefilename); + $filetodelete = $dirins.'/'.$relativefilename; + $dirtodelete = $dirins.'/'.$dirnametodelete; + + $result = dol_delete_file($filetodelete); + if (!$result) { + setEventMessages($langs->trans("ErrorFailToDeleteFile", basename($filetodelete)), null, 'errors'); + } else { + // If we delete a .sql file, we delete also the other .sql file + if (preg_match('/\.sql$/', $relativefilename)) { + if (preg_match('/\.key\.sql$/', $relativefilename)) { + $relativefilename = preg_replace('/\.key\.sql$/', '.sql', $relativefilename); + $filetodelete = $dirins.'/'.$relativefilename; + $result = dol_delete_file($filetodelete); + } elseif (preg_match('/\.sql$/', $relativefilename)) { + $relativefilename = preg_replace('/\.sql$/', '.key.sql', $relativefilename); + $filetodelete = $dirins.'/'.$relativefilename; + $result = dol_delete_file($filetodelete); + } } - if (strpos($lineContent, $propsDel) !== false) { - $lineContent = ''; + + if (dol_is_dir_empty($dirtodelete)) { + dol_delete_dir($dirtodelete); } - if (strpos($lineContent, $constructObjDel) !== false) { - $lineContent = ''; + + // Update descriptor file to comment file + if (in_array($tab, array('css', 'js'))) { + $srcfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php'; + $arrayreplacement = array('/^\s*\''.preg_quote('/'.$relativefilename, '/').'\',*/m'=>' // \'/'.$relativefilename.'\','); + dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1); } - } - $allContent = implode("", $content); - file_put_contents($file_api, $allContent); - // for delete methods of object - $handle = fopen($file_api, "r"); - $i = 1; - $lines = array(); - while (($line = fgets($handle)) !== false) { - //search line begin - if (strpos($line, $begin) !== false) { - $start_line = $i; - // Copy lines until the end on array - while (($line = fgets($handle)) !== false) { - if (strpos($line, $end) !== false) { - $end_line = $i; - break; - } - $lines[] = $line; - $i++; - } - break; + + if (preg_match('/_extrafields/', $relativefilename)) { + // Now we update the object file to set $isextrafieldmanaged to 0 + $srcfile = $dirins.'/'.strtolower($module).'/class/'.strtolower($objectname).'.class.php'; + $arrayreplacement = array('/\$isextrafieldmanaged = 1;/' => '$isextrafieldmanaged = 0;'); + dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1); } - $i++; - } - $allContent = implode("", $lines); - //var_dump($allContent);exit; - $check = dolReplaceInFile($file_api, array($allContent => '')); - if ($check) { - dolReplaceInFile($file_api, array($begin => '', $end => '')); - setEventMessages($langs->trans("ApiObjectDeleted", $langs->transnoentities($objectname)), null); - } - fclose($handle); - } - if (count($objects) == 1 && $existObj) { - if ($relativefilename) { - $dirnametodelete = dirname($relativefilename); - $filetodelete = $dirins.'/'.$relativefilename; - $dirtodelete = $dirins.'/'.$dirnametodelete; - $result = dol_delete_file($filetodelete); - if (!$result) { - setEventMessages($langs->trans("ErrorFailToDeleteFile", basename($filetodelete)), null, 'errors'); - } else { - // If we delete a .sql file, we delete also the other .sql file - if (preg_match('/\.sql$/', $relativefilename)) { - if (preg_match('/\.key\.sql$/', $relativefilename)) { - $relativefilename = preg_replace('/\.key\.sql$/', '.sql', $relativefilename); - $filetodelete = $dirins.'/'.$relativefilename; - $result = dol_delete_file($filetodelete); - } elseif (preg_match('/\.sql$/', $relativefilename)) { - $relativefilename = preg_replace('/\.sql$/', '.key.sql', $relativefilename); - $filetodelete = $dirins.'/'.$relativefilename; - $result = dol_delete_file($filetodelete); - } - } - - if (dol_is_dir_empty($dirtodelete)) { - dol_delete_dir($dirtodelete); - } - - // Update descriptor file to comment file - if (in_array($tab, array('css', 'js'))) { - $srcfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php'; - $arrayreplacement = array('/^\s*\''.preg_quote('/'.$relativefilename, '/').'\',*/m'=>' // \'/'.$relativefilename.'\','); - dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1); - } - - if (preg_match('/_extrafields/', $relativefilename)) { - // Now we update the object file to set $isextrafieldmanaged to 0 - $srcfile = $dirins.'/'.strtolower($module).'/class/'.strtolower($objectname).'.class.php'; - $arrayreplacement = array('/\$isextrafieldmanaged = 1;/' => '$isextrafieldmanaged = 0;'); - dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1); - } - - // Now we update the lib file to set $showtabofpagexxx to 0 - $varnametoupdate = ''; - $reg = array(); - if (preg_match('/_([a-z]+)\.php$/', $relativefilename, $reg)) { - $varnametoupdate = 'showtabofpage'.$reg[1]; - } - if ($varnametoupdate) { - $srcfile = $dirins.'/'.strtolower($module).'/lib/'.strtolower($module).'_'.strtolower($objectname).'.lib.php'; - $arrayreplacement = array('/\$'.$varnametoupdate.' = 1;/' => '$'.$varnametoupdate.' = 0;'); - dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1); - } + // Now we update the lib file to set $showtabofpagexxx to 0 + $varnametoupdate = ''; + $reg = array(); + if (preg_match('/_([a-z]+)\.php$/', $relativefilename, $reg)) { + $varnametoupdate = 'showtabofpage'.$reg[1]; + } + if ($varnametoupdate) { + $srcfile = $dirins.'/'.strtolower($module).'/lib/'.strtolower($module).'_'.strtolower($objectname).'.lib.php'; + $arrayreplacement = array('/\$'.$varnametoupdate.' = 1;/' => '$'.$varnametoupdate.' = 0;'); + dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1); } } } @@ -1074,9 +1014,12 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity); if ($result) { setEventMessages($result, null, 'errors'); + } else { + /* FIX ALI header must be after action. Always add an exit after a header. + header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module); + */ + setEventMessages($langs->trans('WarningModuleNeedRefrech', $langs->transnoentities($module)), null, 'warnings'); } - header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module); - setEventMessages($langs->trans('WarningModuleNeedRefrech', $langs->transnoentities($module)), null, 'warnings'); } $objectname = ucfirst($objectname); @@ -1539,31 +1482,43 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { // Regenerate left menu entry in descriptor for $objectname $stringtoadd = " \$this->menu[\$r++]=array( + // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 'fk_menu'=>'fk_mainmenu=mymodule', + // This is a Left menu entry 'type'=>'left', 'titre'=>'List MyObject', 'mainmenu'=>'mymodule', - 'leftmenu'=>'myobject', + 'leftmenu'=>'mymodule_myobject', 'url'=>'/mymodule/myobject_list.php', + // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'langs'=>'mymodule@mymodule', 'position'=>1100+\$r, + // Define condition to show or hide menu entry. Use '\$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '\$leftmenu==\'system\'' to show if leftmenu system is selected. 'enabled'=>'\$conf->mymodule->enabled', + // Use 'perms'=>'\$user->rights->mymodule->level1->level2' if you want your menu with a permission rules 'perms'=>'1', 'target'=>'', + // 0=Menu for internal users, 1=external users, 2=both 'user'=>2, ); \$this->menu[\$r++]=array( - 'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=myobject', + // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=mymodule_myobject', + // This is a Left menu entry 'type'=>'left', 'titre'=>'New MyObject', 'mainmenu'=>'mymodule', - 'leftmenu'=>'myobject', + 'leftmenu'=>'mymodule_myobject', 'url'=>'/mymodule/myobject_card.php?action=create', + // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'langs'=>'mymodule@mymodule', 'position'=>1100+\$r, + // Define condition to show or hide menu entry. Use '\$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '\$leftmenu==\'system\'' to show if leftmenu system is selected. 'enabled'=>'\$conf->mymodule->enabled', + // Use 'perms'=>'\$user->rights->mymodule->level1->level2' if you want your menu with a permission rules 'perms'=>'1', 'target'=>'', + // 0=Menu for internal users, 1=external users, 2=both 'user'=>2 );\n"; $stringtoadd = preg_replace('/MyObject/', $objectname, $stringtoadd); @@ -1572,13 +1527,14 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { $moduledescriptorfile = $destdir.'/core/modules/mod'.$module.'.class.php'; } - // TODO Allow a replace with regex using dolReplaceInFile with param arryreplacementisregex to 1 - // TODO Avoid duplicate addition - // load class and check if menu exist with same object name - $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; - dol_include_once($pathtofile); - $class = 'mod'.$module; + // TODO Allow a replace with regex using dolReplaceInFile with param arryreplacementisregex to 1 + // TODO Avoid duplicate addition + + // load class and check if menu exist with same object name + $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; + dol_include_once($pathtofile); + $class = 'mod'.$module; if (class_exists($class)) { try { $moduleobj = new $class($db); @@ -1587,8 +1543,8 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { dol_print_error($db, $e->getMessage()); } } - $menus = $moduleobj->menu; - $counter = 0 ; + $menus = $moduleobj->menu; + $counter = 0 ; foreach ($menus as $menu) { if ($menu['leftmenu'] == strtolower($objectname)) { $counter++; @@ -1597,8 +1553,9 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { if (!$counter) { dolReplaceInFile($moduledescriptorfile, array('/* END MODULEBUILDER LEFTMENU MYOBJECT */' => '/*LEFTMENU '.strtoupper($objectname).'*/'.$stringtoadd."\n\t\t".'/*END LEFTMENU '.strtoupper($objectname).'*/'."\n\t\t".'/* END MODULEBUILDER LEFTMENU MYOBJECT */')); } - // Add module descriptor to list of files to replace "MyObject' string with real name of object. - $filetogenerate[] = 'core/modules/mod'.$module.'.class.php'; + + // Add module descriptor to list of files to replace "MyObject' string with real name of object. + $filetogenerate[] = 'core/modules/mod'.$module.'.class.php'; } if (!$error) { @@ -1940,9 +1897,13 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname) { dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity); if ($result) { setEventMessages($result, null, 'errors'); + $error++; + } else { + /* TODO ALI Header reidrect must be at end after actions. Also tab=pemrissions looks strange + header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module); + */ + setEventMessages($langs->trans('WarningModuleNeedRefrech', $langs->transnoentities($module)), null, 'warnings'); } - header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module); - setEventMessages($langs->trans('WarningModuleNeedRefrech', $langs->transnoentities($module)), null, 'warnings'); } if (preg_match('/[^a-z0-9_]/i', $objectname)) { $error++; @@ -2244,15 +2205,32 @@ if ($dirins && $action == 'addright' && !empty($module) && empty($cancel)) { \$r++; "; $moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php'; + + //var_dump($existRight.' '.$firstRight);exit; if (!$existRight) { dolReplaceInFile($moduledescriptorfile, array('/*END '.strtoupper($objectForPerms).'*/' => $rightToAdd.'/*END '.strtoupper($objectForPerms).'*/')); setEventMessages($langs->trans('PermissionAddedSuccesfuly'), null); } - if ($firstRight>0) { - dolReplaceInFile($moduledescriptorfile, array('/* END MODULEBUILDER PERMISSIONS */' => '/*'.strtoupper($objectForPerms).'*/'.$rightToAdd."/*END ".strtoupper($objectForPerms).'*/'."\n\t\t".'/* END MODULEBUILDER PERMISSIONS */')); - setEventMessages($langs->trans('PermissionAddedSuccesfuly'), null); + if ($firstRight > 0) { + $filecontentbefore = file_get_contents($moduledescriptorfile); + + $result = dolReplaceInFile($moduledescriptorfile, array('/* END MODULEBUILDER PERMISSIONS */' => '/*'.strtoupper($objectForPerms).'*/'.$rightToAdd."/*END ".strtoupper($objectForPerms).'*/'."\n\t\t".'/* END MODULEBUILDER PERMISSIONS */')); + + $filecontentafter = file_get_contents($moduledescriptorfile); + + if ($filecontentbefore != $filecontentafter) { + setEventMessages($langs->trans('PermissionAddedSuccesfuly'), null); + } else { + setEventMessages($langs->trans('FailedToAddCodeIntoDescriptor', 'END MODULEBUILDER PERMISSIONS'), null, 'warnings'); + } } } + + 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; } @@ -2336,6 +2314,7 @@ if ($dirins && GETPOST('action') == 'update_right' && GETPOST('modifyright')&& e } } + // TODO ALI Update of permission must be done by rewriting completely the permission section //prepare right want to delete $right = " \$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1); @@ -2352,6 +2331,7 @@ if ($dirins && GETPOST('action') == 'update_right' && GETPOST('modifyright')&& e \$this->rights[\$r][5] = '$crud'; \$r++; "; + if (!$error) { if (isModEnabled(strtolower($module))) { $result = unActivateModule(strtolower($module)); @@ -2366,8 +2346,14 @@ if ($dirins && GETPOST('action') == 'update_right' && GETPOST('modifyright')&& e $moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php'; $check = dolReplaceInFile($moduledescriptorfile, array($right => $rightUpdated)); - header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module); setEventMessages($langs->trans('PermissionUpdatedSuccesfuly'), 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; } } @@ -2377,7 +2363,7 @@ if ($dirins && $action == 'confirm_deleteright' && !empty($module) && GETPOST('p // load class and check if right exist $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; dol_include_once($pathtofile); - $class = 'mod'.$module; + $class = 'mod'.$module; if (class_exists($class)) { try { $moduleobj = new $class($db); @@ -2387,14 +2373,14 @@ if ($dirins && $action == 'confirm_deleteright' && !empty($module) && GETPOST('p } } - $permissions = $moduleobj->rights; - $key = (int) GETPOST('permskey', 'int')-1; - //get permission want to delete from permissions array - $x1 = $permissions[$key][1]; - $x2 = $permissions[$key][4]; - $x3 = $permissions[$key][5]; - //prepare right want to delete - $rightTodelete = " + $permissions = $moduleobj->rights; + $key = (int) GETPOST('permskey', 'int')-1; + //get permission want to delete from permissions array + $x1 = $permissions[$key][1]; + $x2 = $permissions[$key][4]; + $x3 = $permissions[$key][5]; + //prepare right want to delete + $rightTodelete = " \$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1); \$this->rights[\$r][1] = '$x1'; \$this->rights[\$r][4] = '$x2'; @@ -2402,9 +2388,11 @@ if ($dirins && $action == 'confirm_deleteright' && !empty($module) && GETPOST('p \$r++; "; + $moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php'; + + // TODO ALI The delete must be done by rewriting all content between /* BEGIN MODULEBUILDER PERMISSIONS */ and /* END MODULEBUILDER PERMISSIONS */ + $check = dolReplaceInFile($moduledescriptorfile, array($rightTodelete => "\n\t\t")); - $moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php'; - $check = dolReplaceInFile($moduledescriptorfile, array($rightTodelete => "\n\t\t")); if ($check > 0) { //check if all permissions of object was deleted $permsForObj = array(); @@ -2424,13 +2412,20 @@ if ($dirins && $action == 'confirm_deleteright' && !empty($module) && GETPOST('p if ($result) { setEventMessages($result, null, 'errors'); } - header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module); setEventMessages($langs->trans('PermissionDeletedSuccesfuly'), null); setEventMessages($langs->trans('WarningModuleNeedRefrech', $langs->transnoentities($module)), null, 'warnings'); + + header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module); exit; } else { - header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module); setEventMessages($langs->trans('PermissionDeletedSuccesfuly'), 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; } } @@ -3401,7 +3396,8 @@ if ($module == 'initmodule') { print ''; print $moduleobj->numero; print ''; - print '   ('.$langs->trans("SeeIDsInUse").''; + print '   ('; + print dolButtonToOpenUrlInDialogPopup('popup_modules_id', $langs->transnoentitiesnoconv("SeeIDsInUse"), $langs->transnoentitiesnoconv("SeeIDsInUse"), '/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info', '', ''); print ' - '.$langs->trans("SeeReservedIDsRangeHere").')'; print ''; print ''; @@ -4873,8 +4869,8 @@ if ($module == 'initmodule') { } } // declared select list for actions and labels permissions - $crud = array('Read','Write','Delete'); - $labels = array("Read objects of $module","Create/Update objects of $module","Delete objects of $module"); + $crud = array('read'=>'CRUDRead', 'write'=>'CRUDCreateWrite', 'delete'=>'Delete'); + $labels = array("Read objects of ".$module, "Create/Update objects of ".$module, "Delete objects of ".$module); $action = GETPOST('action', 'alpha'); @@ -4919,18 +4915,18 @@ if ($module == 'initmodule') { print ''; print_liste_field_titre("ID", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, "center"); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, "center"); - print_liste_field_titre("Permission", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, "center"); + print_liste_field_titre("Object", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, "center"); print_liste_field_titre("CRUD", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, "center"); print_liste_field_titre("", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, "center"); print "\n"; //form for add new right - print ''; - print ''; + print ''; + print ''; print ''; print ''; @@ -4946,8 +4942,8 @@ if ($module == 'initmodule') { print '