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');
|
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($_SESSION["disablemodules"])) {
|
||||||
|
$disabled_modules = explode(',', $_SESSION["disablemodules"]);
|
||||||
|
}
|
||||||
|
|
||||||
// Show list of modules
|
// Show list of modules
|
||||||
$oldfamily = '';
|
$oldfamily = '';
|
||||||
$foundoneexternalmodulewithupdate = 0;
|
$foundoneexternalmodulewithupdate = 0;
|
||||||
@ -613,6 +617,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$modulenameshort = strtolower(preg_replace('/^mod/i', '', get_class($objMod)));
|
||||||
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
|
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
|
||||||
|
|
||||||
// Check filters
|
// Check filters
|
||||||
@ -754,6 +759,11 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
|||||||
$codeenabledisable = '';
|
$codeenabledisable = '';
|
||||||
$codetoconfig = '';
|
$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)
|
// Activate/Disable and Setup (2 columns)
|
||||||
if (!empty($conf->global->$const_name)) { // If module is already activated
|
if (!empty($conf->global->$const_name)) { // If module is already activated
|
||||||
// Set $codeenabledisable
|
// Set $codeenabledisable
|
||||||
@ -761,6 +771,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
|||||||
if (!empty($arrayofwarnings[$modName])) {
|
if (!empty($arrayofwarnings[$modName])) {
|
||||||
$codeenabledisable .= '<!-- This module has a warning to show when we activate it (note: your country is '.$mysoc->country_code.') -->'."\n";
|
$codeenabledisable .= '<!-- This module has a warning to show when we activate it (note: your country is '.$mysoc->country_code.') -->'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($objMod->disabled)) {
|
if (!empty($objMod->disabled)) {
|
||||||
$codeenabledisable .= $langs->trans("Disabled");
|
$codeenabledisable .= $langs->trans("Disabled");
|
||||||
} elseif (!empty($objMod->always_enabled) || ((!empty($conf->multicompany->enabled) && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) {
|
} 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