diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index b75bc8b21f1..091e94f91bc 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -299,7 +299,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5200__+MAX_llx_menu__, 'members', 'cat', 13__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=3', 'MembersCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5201__+MAX_llx_menu__, 'members', '', 5200__+MAX_llx_menu__, '/categories/card.php?action=create&type=3', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); -- HRM - Holiday -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5000__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/holiday/index.php?&leftmenu=hrm', 'CPTitreMenu', 0, 'holiday', '$user->rights->holiday->write', '', 0, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5000__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/holiday/list.php?&leftmenu=hrm', 'CPTitreMenu', 0, 'holiday', '$user->rights->holiday->write', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5001__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/card.php?&action=request', 'MenuAddCP', 1, 'holiday', '$user->rights->holiday->write', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5002__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/define_holiday.php?&action=request', 'MenuConfCP', 1, 'holiday', '$user->rights->holiday->define_holiday', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5003__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/view_log.php?&action=request', 'MenuLogCP', 1, 'holiday', '$user->rights->holiday->view_log', '', 0, 3, __ENTITY__); diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index de2870d7a9f..c886741fc41 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -1686,11 +1686,13 @@ print $sql; /** * Function called when module is enabled. - * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. + * The init function adds tabs, constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. * It also creates data directories * - * @param string $options Options when enabling module ('', 'noboxes') - * @return int 1 if OK, 0 if KO + * @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes') + * 'noboxes' = Do not insert boxes + * 'newboxdefonly' = For boxes, insert def of boxes only and not boxes activation + * @return int 1 if OK, 0 if KO */ public function init($options = '') { @@ -1699,11 +1701,11 @@ print $sql; /** * Function called when module is disabled. - * Remove from database constants, boxes and permissions from Dolibarr database. + * The remove function removes tabs, constants, boxes, permissions and menus from Dolibarr database. * Data directories are not deleted * * @param string $options Options when enabling module ('', 'noboxes') - * @return int 1 if OK, 0 if KO + * @return int 1 if OK, 0 if KO */ public function remove($options = '') { diff --git a/htdocs/core/modules/modExpenseReport.class.php b/htdocs/core/modules/modExpenseReport.class.php index 690ca7ba87e..123f4fe4aa0 100644 --- a/htdocs/core/modules/modExpenseReport.class.php +++ b/htdocs/core/modules/modExpenseReport.class.php @@ -139,7 +139,7 @@ class modExpenseReport extends DolibarrModules $this->rights_class = 'expensereport'; $this->rights[1][0] = 771; - $this->rights[1][1] = 'Read expense reports (own and his subordinates)'; + $this->rights[1][1] = 'Read expense reports (yours and your subordinates)'; $this->rights[1][2] = 'r'; $this->rights[1][3] = 1; $this->rights[1][4] = 'lire'; diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index 988391bca42..b4517b4bfbe 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -180,88 +180,6 @@ class modHoliday extends DolibarrModules $r=0; - /* Move to HRM menu - // Add here entries to declare new menus - $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu - 'type'=>'top', // This is a Top menu entry - 'titre'=>'CPTitreMenu', - 'mainmenu'=>'holiday', - 'leftmenu'=>'holiday', - 'url'=>'/holiday/index.php', - 'langs'=>'holiday', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>100, - 'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. - 'perms'=>'$user->rights->holiday->write', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both - $r++; - $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=holiday', // Put 0 if this is a top menu - 'type'=>'left', // This is a Top menu entry - 'titre'=>'CPTitreMenu', - 'mainmenu'=>'holiday', - 'leftmenu'=>'holiday', - 'url'=>'/holiday/index.php?mainmenu=holiday&leftmenu=holiday', - 'langs'=>'holiday', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>100, - 'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. - 'perms'=>'$user->rights->holiday->write', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both - $r++; - $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=holiday,fk_leftmenu=holiday', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry) - 'type'=>'left', // This is a Left menu entry - 'titre'=>'MenuAddCP', - 'mainmenu'=>'holiday', - 'leftmenu'=>'holiday_add', - 'url'=>'/holiday/card.php?mainmenu=holiday&action=request', - 'langs'=>'holiday', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>101, - 'enabled'=>'$conf->holiday->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. - 'perms'=>'$user->rights->holiday->write', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both - $r++; - $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=holiday,fk_leftmenu=holiday', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry) - 'type'=>'left', // This is a Left menu entry - 'titre'=>'MenuConfCP', - 'mainmenu'=>'holiday', - 'leftmenu'=>'holiday_conf', - 'url'=>'/holiday/define_holiday.php?mainmenu=holiday&action=request', - 'langs'=>'holiday', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>102, - 'enabled'=>'$conf->holiday->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. - 'perms'=>'$user->rights->holiday->define_holiday', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both - $r++; - $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=holiday,fk_leftmenu=holiday', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry) - 'type'=>'left', // This is a Left menu entry - 'titre'=>'MenuLogCP', - 'mainmenu'=>'holiday_def', - 'url'=>'/holiday/view_log.php?mainmenu=holiday&action=request', - 'leftmenu'=>'holiday', - 'langs'=>'holiday', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>103, - 'enabled'=>'$conf->holiday->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. - 'perms'=>'$user->rights->holiday->view_log', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both - $r++; - $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=holiday,fk_leftmenu=holiday', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry) - 'type'=>'left', // This is a Left menu entry - 'titre'=>'MenuReportMonth', - 'mainmenu'=>'holiday', - 'leftmenu'=>'holiday_report', - 'url'=>'/holiday/month_report.php?mainmenu=holiday&action=request', - 'langs'=>'holiday', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>104, - 'enabled'=>'$conf->holiday->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. - 'perms'=>'$user->rights->holiday->view_log', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both - $r++; -*/ - // Exports $r=1; diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index c350fb003e6..4e10fbf925c 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -18,7 +18,7 @@ */ /** - * \file htdocs/holiday/index.php + * \file htdocs/holiday/list.php * \ingroup holiday * \brief List of holiday. */ diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 214a6c54fbf..f42e55cb697 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -366,29 +366,29 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) migrate_event_assignement($db,$langs,$conf); } - // Scripts for lat version + // Scripts for last version $afterversionarray=explode('.','3.7.9'); $beforeversionarray=explode('.','3.8.9'); if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0) { // Reload modules (this must be always and only into last targeted version) $listofmodule=array( - 'MAIN_MODULE_AGENDA', - 'MAIN_MODULE_BARCODE', - 'MAIN_MODULE_CRON', - 'MAIN_MODULE_COMMANDE', - 'MAIN_MODULE_DEPLACEMENT', - 'MAIN_MODULE_DON', - 'MAIN_MODULE_ECM', - 'MAIN_MODULE_FACTURE', - 'MAIN_MODULE_FOURNISSEUR', - 'MAIN_MODULE_HOLIDAY', - 'MAIN_MODULE_OPENSURVEY', - 'MAIN_MODULE_PAYBOX', - 'MAIN_MODULE_PRODUIT', - 'MAIN_MODULE_SOCIETE', - 'MAIN_MODULE_SERVICE', - 'MAIN_MODULE_USER' + 'MAIN_MODULE_AGENDA'=>'newboxdefonly', + 'MAIN_MODULE_BARCODE'=>'newboxdefonly', + 'MAIN_MODULE_CRON'=>'newboxdefonly', + 'MAIN_MODULE_COMMANDE'=>'newboxdefonly', + 'MAIN_MODULE_DEPLACEMENT'=>'newboxdefonly', + 'MAIN_MODULE_DON'=>'newboxdefonly', + 'MAIN_MODULE_ECM'=>'newboxdefonly', + 'MAIN_MODULE_FACTURE'=>'newboxdefonly', + 'MAIN_MODULE_FOURNISSEUR'=>'newboxdefonly', + 'MAIN_MODULE_HOLIDAY'=>'newboxdefonly', + 'MAIN_MODULE_OPENSURVEY'=>'newboxdefonly', + 'MAIN_MODULE_PAYBOX'=>'newboxdefonly', + 'MAIN_MODULE_PRODUIT'=>'newboxdefonly', + 'MAIN_MODULE_SOCIETE'=>'newboxdefonly', + 'MAIN_MODULE_SERVICE'=>'newboxdefonly', + 'MAIN_MODULE_USER'=>'newboxdefonly' ); migrate_reload_modules($db,$langs,$conf,$listofmodule); @@ -3750,30 +3750,33 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array()) { dolibarr_install_syslog("upgrade2::migrate_reload_modules"); - // Module to reload if no info is provided + // If no info is provided, we reload all modules with mode newboxdefonly. if (count($listofmodule) == 0) { $listofmodule=array( - 'MAIN_MODULE_AGENDA', - 'MAIN_MODULE_SOCIETE', - 'MAIN_MODULE_PRODUIT', - 'MAIN_MODULE_SERVICE', - 'MAIN_MODULE_COMMANDE', - 'MAIN_MODULE_FACTURE', - 'MAIN_MODULE_FOURNISSEUR', - 'MAIN_MODULE_USER', - 'MAIN_MODULE_DEPLACEMENT', - 'MAIN_MODULE_DON', - 'MAIN_MODULE_ECM', - 'MAIN_MODULE_PAYBOX', - 'MAIN_MODULE_OPENSURVEY' + 'MAIN_MODULE_AGENDA'=>'newboxdefonly', + 'MAIN_MODULE_SOCIETE'=>'newboxdefonly', + 'MAIN_MODULE_PRODUIT'=>'newboxdefonly', + 'MAIN_MODULE_SERVICE'=>'newboxdefonly', + 'MAIN_MODULE_COMMANDE'=>'newboxdefonly', + 'MAIN_MODULE_FACTURE'=>'newboxdefonly', + 'MAIN_MODULE_FOURNISSEUR'=>'newboxdefonly', + 'MAIN_MODULE_HOLIDAY'=>'newboxdefonly', + 'MAIN_MODULE_USER'=>'newboxdefonly', + 'MAIN_MODULE_DEPLACEMENT'=>'newboxdefonly', + 'MAIN_MODULE_DON'=>'newboxdefonly', + 'MAIN_MODULE_ECM'=>'newboxdefonly', + 'MAIN_MODULE_PAYBOX'=>'newboxdefonly', + 'MAIN_MODULE_OPENSURVEY'=>'newboxdefonly' ); } - foreach($listofmodule as $moduletoreload) + foreach($listofmodule as $moduletoreload => $reloadmode) { if (empty($moduletoreload) || empty($conf->global->$moduletoreload)) continue; + $mod=null; + if ($moduletoreload == 'MAIN_MODULE_AGENDA') { dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Agenda module"); @@ -3781,7 +3784,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array()) if ($res) { $mod=new modAgenda($db); $mod->remove('noboxes'); - $mod->init('newboxdefonly'); + $mod->init($reloadmode); } } if ($moduletoreload == 'MAIN_MODULE_BARCODE') @@ -3791,7 +3794,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array()) if ($res) { $mod=new modBarcode($db); $mod->remove('noboxes'); - $mod->init('newboxdefonly'); + $mod->init($reloadmode); } } if ($moduletoreload == 'MAIN_MODULE_CRON') @@ -3801,7 +3804,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array()) if ($res) { $mod=new modCron($db); $mod->remove('noboxes'); - $mod->init('newboxdefonly'); + $mod->init($reloadmode); } } if ($moduletoreload == 'MAIN_MODULE_SOCIETE') @@ -3811,7 +3814,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array()) if ($res) { $mod=new modSociete($db); $mod->remove('noboxes'); - $mod->init('newboxdefonly'); + $mod->init($reloadmode); } } if ($moduletoreload == 'MAIN_MODULE_PRODUIT') // Permission has changed into 2.7 @@ -3821,7 +3824,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array()) if ($res) { $mod=new modProduct($db); //$mod->remove('noboxes'); - $mod->init('newboxdefonly'); + $mod->init($reloadmode); } } if ($moduletoreload == 'MAIN_MODULE_SERVICE') // Permission has changed into 2.7 @@ -3832,7 +3835,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array()) if ($res) { $mod=new modService($db); //$mod->remove('noboxes'); - $mod->init('newboxdefonly'); + $mod->init($reloadmode); } } if ($moduletoreload == 'MAIN_MODULE_COMMANDE') // Permission has changed into 2.9 @@ -3843,7 +3846,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array()) if ($res) { $mod=new modCommande($db); //$mod->remove('noboxes'); - $mod->init('newboxdefonly'); + $mod->init($reloadmode); } } if ($moduletoreload == 'MAIN_MODULE_FACTURE') // Permission has changed into 2.9 @@ -3853,7 +3856,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array()) if ($res) { $mod=new modFacture($db); //$mod->remove('noboxes'); - $mod->init('newboxdefonly'); + $mod->init($reloadmode); } } if ($moduletoreload == 'MAIN_MODULE_FOURNISSEUR') // Permission has changed into 2.9 @@ -3863,7 +3866,17 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array()) if ($res) { $mod=new modFournisseur($db); //$mod->remove('noboxes'); - $mod->init('newboxdefonly'); + $mod->init($reloadmode); + } + } + if ($moduletoreload == 'MAIN_MODULE_HOLIDAY') // Permission and tabs has changed into 3.8 + { + dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Leave Request module"); + $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modHoliday.class.php'; + if ($res) { + $mod=new modHoliday($db); + $mod->remove('noboxes'); + $mod->init($reloadmode); } } if ($moduletoreload == 'MAIN_MODULE_DEPLACEMENT') // Permission has changed into 3.0 @@ -3872,8 +3885,8 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array()) $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modDeplacement.class.php'; if ($res) { $mod=new modDeplacement($db); - //$mod->remove('noboxes'); // We need to remove because a permission id has been removed - $mod->init('newboxdefonly'); + //$mod->remove('noboxes'); + $mod->init($reloadmode); } } if ($moduletoreload == 'MAIN_MODULE_DON') // Permission has changed into 3.0 @@ -3882,8 +3895,8 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array()) $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modDon.class.php'; if ($res) { $mod=new modDon($db); - //$mod->remove('noboxes'); // We need to remove because a permission id has been removed - $mod->init('newboxdefonly'); + //$mod->remove('noboxes'); + $mod->init($reloadmode); } } if ($moduletoreload == 'MAIN_MODULE_ECM') // Permission has changed into 3.0 and 3.1 @@ -3893,7 +3906,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array()) if ($res) { $mod=new modECM($db); $mod->remove('noboxes'); // We need to remove because a permission id has been removed - $mod->init('newboxdefonly'); + $mod->init($reloadmode); } } if ($moduletoreload == 'MAIN_MODULE_PAYBOX') // Permission has changed into 3.0 @@ -3903,7 +3916,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array()) if ($res) { $mod=new modPaybox($db); $mod->remove('noboxes'); // We need to remove because id of module has changed - $mod->init('newboxdefonly'); + $mod->init($reloadmode); } } if ($moduletoreload == 'MAIN_MODULE_OPENSURVEY') // Permission has changed into 3.0 @@ -3913,7 +3926,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array()) if ($res) { $mod=new modOpenSurvey($db); $mod->remove('noboxes'); // We need to remove because menu entries has changed - $mod->init('newboxdefonly'); + $mod->init($reloadmode); } } if ($moduletoreload == 'MAIN_MODULE_USER') // Permission has changed into 3.0 @@ -3922,11 +3935,20 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array()) $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modUser.class.php'; if ($res) { $mod=new modUser($db); - //$mod->remove('noboxes'); // We need to remove because id of module has changed - $mod->init('newboxdefonly'); + //$mod->remove('noboxes'); + $mod->init($reloadmode); } } + if (! empty($mod) && is_object($mod)) + { + print '