mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix modules disabled in demo must remains disabled
This commit is contained in:
parent
81a8efd856
commit
daf32e9f14
|
|
@ -588,6 +588,10 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
|||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
if (!empty($_SESSION["disablemodules"])) {
|
||||
$disabled_modules = explode(',', $_SESSION["disablemodules"]);
|
||||
}
|
||||
|
||||
// Show list of modules
|
||||
$oldfamily = '';
|
||||
$foundoneexternalmodulewithupdate = 0;
|
||||
|
|
@ -613,6 +617,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
|||
continue;
|
||||
}
|
||||
|
||||
$modulenameshort = strtolower(preg_replace('/^mod/i', '', get_class($objMod)));
|
||||
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
|
||||
|
||||
// Check filters
|
||||
|
|
@ -754,6 +759,11 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
|||
$codeenabledisable = '';
|
||||
$codetoconfig = '';
|
||||
|
||||
// Force disable of module disabled into session (for demo for example)
|
||||
if (in_array($modulenameshort, $disabled_modules)) {
|
||||
$objMod->disabled = true;
|
||||
}
|
||||
|
||||
// Activate/Disable and Setup (2 columns)
|
||||
if (!empty($conf->global->$const_name)) { // If module is already activated
|
||||
// Set $codeenabledisable
|
||||
|
|
@ -761,6 +771,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
|||
if (!empty($arrayofwarnings[$modName])) {
|
||||
$codeenabledisable .= '<!-- This module has a warning to show when we activate it (note: your country is '.$mysoc->country_code.') -->'."\n";
|
||||
}
|
||||
|
||||
if (!empty($objMod->disabled)) {
|
||||
$codeenabledisable .= $langs->trans("Disabled");
|
||||
} elseif (!empty($objMod->always_enabled) || ((!empty($conf->multicompany->enabled) && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user