New: add possibility to defined permissions in external tab
This commit is contained in:
parent
0a376dc831
commit
9dfd4275b5
@ -102,8 +102,8 @@ class modMyModule extends DolibarrModules
|
|||||||
$this->const = array();
|
$this->const = array();
|
||||||
|
|
||||||
// Array to add new pages in new tabs
|
// 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
|
// 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:/mymodule/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2
|
// '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
|
// 'objecttype:-tabname'); // To remove an existing tab identified by code tabname
|
||||||
// where objecttype can be
|
// where objecttype can be
|
||||||
// 'thirdparty' to add a tab in third party view
|
// 'thirdparty' to add a tab in third party view
|
||||||
|
|||||||
@ -3752,7 +3752,19 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode=
|
|||||||
$values=explode(':',$value);
|
$values=explode(':',$value);
|
||||||
if ($mode == 'add')
|
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[0] != $type) continue;
|
||||||
if ($values[3]) $langs->load($values[3]);
|
if ($values[3]) $langs->load($values[3]);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user