diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php index d9994e318399de67c3f69a4642f0cb0d65e2a6f0..c10618f340f2d36ea459cfa47cb8208e0baa2175 100644 --- a/dev/skeletons/modMyModule.class.php +++ b/dev/skeletons/modMyModule.class.php @@ -102,8 +102,8 @@ class modMyModule extends DolibarrModules $this->const = array(); // Array to add new pages in new tabs - // Example: $this->tabs = array('objecttype:+tabname1:Title1:@mymodule:/mymodule/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1 - // 'objecttype:+tabname2:Title2:@mymodule:/mymodule/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2 + // Example: $this->tabs = array('objecttype:+tabname1:Title1:@mymodule:$user->rights->mymodule->read:/mymodule/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1 + // 'objecttype:+tabname2:Title2:@mymodule:$user->rights->othermodule->read:/mymodule/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2 // 'objecttype:-tabname'); // To remove an existing tab identified by code tabname // where objecttype can be // 'thirdparty' to add a tab in third party view diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index 5fd2fe63834014f1440f92f9e7c17af5a7e101f0..429a7510da7df6db1b90c33b9e5dd222468123c9 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -3752,7 +3752,19 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode= $values=explode(':',$value); if ($mode == 'add') { - if (sizeof($values) == 5) // new declaration + if (sizeof($values) == 6) // new declaration with permissions + { + if ($values[0] != $type) continue; + if (verifCond($values[4])) + { + if ($values[3]) $langs->load($values[3]); + $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[5]),1); + $head[$h][1] = $langs->trans($values[2]); + $head[$h][2] = str_replace('+','',$values[1]); + $h++; + } + } + if (sizeof($values) == 5) // new declaration { if ($values[0] != $type) continue; if ($values[3]) $langs->load($values[3]);