Hello Dolibarr community,
I currently create a new module with module builder (testmar4), everything goes well. But now I have trouble to modify it.
When I create a new objet (animal) it doesn’t appear on the left menu even if :
- the menu part of description file is updated as well as the menu interface :
// Main menu entries to add
$this->menu = array();
$r = 0;
// Add here entries to declare new menus
/* BEGIN MODULEBUILDER TOPMENU */
$this->menu[$r++] = array(
'fk_menu'=>'', // '' 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
'type'=>'top', // This is a Top menu entry
'titre'=>'ModuleTestmar4Name',
'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth valignmiddle"'),
'mainmenu'=>'testmar4',
'leftmenu'=>'',
'url'=>'/testmar4/testmar4index.php',
'langs'=>'testmar4@testmar4', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>1000 + $r,
'enabled'=>'isModEnabled("testmar4")', // Define condition to show or hide menu entry. Use 'isModEnabled("testmar4")' if entry must be visible if module is enabled.
'perms'=>'1', // Use 'perms'=>'$user->hasRight("testmar4", "animal", "read")' if you want your menu with a permission rules
'target'=>'',
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
);
/* END MODULEBUILDER TOPMENU*/
/* BEGIN MODULEBUILDER LEFTMENU MYOBJECT*/
/*LEFTMENU ANIMAL*/
$this->menu[$r++]=array(
'fk_menu'=>'fk_mainmenu=testmar4',
'type'=>'left',
'titre'=>'Animal',
'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth valignmiddle"'),
'mainmenu'=>'testmar4',
'leftmenu'=>'animal',
'url'=>'/testmar4/animal_list.php',
'langs'=>'testmar4@testmar4',
'position'=>1000+$r,
'enabled'=>'$conf->testmodule->enabled',
'perms'=>'1',
'target'=>'',
'user'=>2,
);
$this->menu[$r++]=array(
'fk_menu'=>'fk_mainmenu=testmar4,fk_leftmenu=animal',
'type'=>'left',
'titre'=>'List Animal',
'mainmenu'=>'testmar4',
'leftmenu'=>'testmar4_animal_list',
'url'=>'/testmar4/animal_list.php',
'langs'=>'testmar4@testmar4',
'position'=>1000+$r,
'enabled'=>'$conf->testmar4->enabled',
'perms'=>'1',
'target'=>'',
'user'=>2,
);
$this->menu[$r++]=array(
'fk_menu'=>'fk_mainmenu=testmar4,fk_leftmenu=animal',
'type'=>'left',
'titre'=>'New Animal',
'mainmenu'=>'testmar4',
'leftmenu'=>'testmar4_animal_new',
'url'=>'/testmar4/animal_card.php?action=create',
'langs'=>'testmar4@testmar4',
'position'=>1000+$r,
'enabled'=>'$conf->testmar4->enabled',
'perms'=>'1',
'target'=>'',
'user'=>2
);
/*END LEFTMENU ANIMAL*/
/* END MODULEBUILDER LEFTMENU MYOBJECT */
- Interface show that the object is well created
However no left menu is showed
Yet I can access the animal create or animal list if I modify the URL.
I also try to add setup in mymodule/admin/, I can see that I have now two settings but the new one isn’t accessible :
Not Found The requested URL was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
(I follow the tutorial Développement module - Dolibarr ERP CRM Wiki)
And I noticed that the URL is wrong : /admin/testmar4_setupapage.php@testmar4 as it should be custom/testmar4/admin/testmar4_setupapage.php@testmar4.
That’s why I think I have a path problem but I don’t know why.
If you have any idea, please feel free to help me !
Thanks !
Dolibarr version 18.0.0