mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-08 18:48:22 +01:00
FIX detection of setup not done with
MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING
This commit is contained in:
@@ -25,7 +25,6 @@
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var DoliDB $db
|
||||
@@ -136,7 +135,7 @@ print '<section class="setupsection setupmodules cursorpointer">';
|
||||
|
||||
// Define $nbmodulesnotautoenabled - TODO This code is at different places
|
||||
$nbmodulesnotautoenabled = count($conf->modules);
|
||||
$listofmodulesautoenabled = array('agenda', 'fckeditor', 'export', 'import');
|
||||
$listofmodulesautoenabled = array('user', 'agenda', 'fckeditor', 'export', 'import'); // All modules with ->enabled_bydefault to true (so enabled during install)
|
||||
foreach ($listofmodulesautoenabled as $moduleautoenable) {
|
||||
if (in_array($moduleautoenable, $conf->modules)) {
|
||||
$nbmodulesnotautoenabled--;
|
||||
@@ -148,7 +147,7 @@ print img_picto('', 'cog', 'class="paddingright valignmiddle double"');
|
||||
print ' ';
|
||||
print '<a class="nounderlineimp" href="'.DOL_URL_ROOT.'/admin/modules.php?mainmenu=home">'.$langs->transnoentities("Setup").' - '.$langs->transnoentities("Modules").'</a>';
|
||||
print '<br><br>'.$langs->trans("SetupDescription4b");
|
||||
if ($nbmodulesnotautoenabled <= getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only minimal initial modules enabled
|
||||
if ($nbmodulesnotautoenabled < getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only minimal initial modules enabled
|
||||
$langs->load("errors");
|
||||
$warnpicto = img_warning($langs->trans("WarningEnableYourModulesApplications"), 'style="padding-right: 6px;"');
|
||||
print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/modules.php?mainmenu=home">'.$warnpicto.$langs->trans("WarningEnableYourModulesApplications").'</a></div>';
|
||||
|
||||
@@ -673,7 +673,7 @@ $nbofactivatedmodules = count($conf->modules);
|
||||
|
||||
// Define $nbmodulesnotautoenabled - TODO This code is at different places
|
||||
$nbmodulesnotautoenabled = count($conf->modules);
|
||||
$listofmodulesautoenabled = array('agenda', 'fckeditor', 'export', 'import');
|
||||
$listofmodulesautoenabled = array('user', 'agenda', 'fckeditor', 'export', 'import');
|
||||
foreach ($listofmodulesautoenabled as $moduleautoenable) {
|
||||
if (in_array($moduleautoenable, $conf->modules)) {
|
||||
$nbmodulesnotautoenabled--;
|
||||
@@ -689,7 +689,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
$desc .= ' '.$langs->trans("ModulesDesc2", '{picto2}');
|
||||
$desc = str_replace('{picto}', img_picto('', 'switch_off', 'class="size15x"'), $desc);
|
||||
$desc = str_replace('{picto2}', img_picto('', 'setup', 'class="size15x"'), $desc);
|
||||
if ($nbmodulesnotautoenabled <= getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only minimal initial modules enabled
|
||||
if ($nbmodulesnotautoenabled < getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only minimal initial modules enabled
|
||||
$deschelp .= '<div class="info hideonsmartphone">'.$desc."<br></div>\n";
|
||||
}
|
||||
if (getDolGlobalString('MAIN_SETUP_MODULES_INFO')) { // Show a custom message. A good usage for SaaS with option MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING.
|
||||
|
||||
@@ -107,14 +107,14 @@ print '</span>';
|
||||
|
||||
// Define $nbmodulesnotautoenabled - TODO This code is at different places
|
||||
$nbmodulesnotautoenabled = count($conf->modules);
|
||||
$listofmodulesautoenabled = array('agenda', 'fckeditor', 'export', 'import');
|
||||
$listofmodulesautoenabled = array('user', 'agenda', 'fckeditor', 'export', 'import');
|
||||
foreach ($listofmodulesautoenabled as $moduleautoenable) {
|
||||
if (in_array($moduleautoenable, $conf->modules)) {
|
||||
$nbmodulesnotautoenabled--;
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->admin && $nbmodulesnotautoenabled <= getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only minimal initial modules enabled
|
||||
if ($user->admin && $nbmodulesnotautoenabled < getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only minimal initial modules enabled
|
||||
$langs->load("admin");
|
||||
print info_admin($langs->trans("WarningOnlyCategoryTypesOfActivatedModules").' '.$langs->trans("YouCanEnableModulesFrom"));
|
||||
}
|
||||
|
||||
@@ -776,7 +776,7 @@ function modules_prepare_head($nbofactivatedmodules, $nboftotalmodules, $nbmodul
|
||||
$head = array();
|
||||
$mode = getDolGlobalString('MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT', 'commonkanban');
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$mode;
|
||||
if ($nbmodulesnotautoenabled <= getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only minimal initial modules enabled)
|
||||
if ($nbmodulesnotautoenabled < getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only minimal initial modules enabled)
|
||||
//$head[$h][1] = $form->textwithpicto($langs->trans("AvailableModules"), $desc);
|
||||
$head[$h][1] = $langs->trans("AvailableModules");
|
||||
$head[$h][1] .= $form->textwithpicto('', $langs->trans("YouMustEnableOneModule").'.<br><br><span class="opacitymedium">'.$desc.'</span>', 1, 'warning');
|
||||
|
||||
@@ -1165,7 +1165,7 @@ function get_left_menu_home($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu =
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu == "setup") {
|
||||
// Define $nbmodulesnotautoenabled - TODO This code is at different places
|
||||
$nbmodulesnotautoenabled = count($conf->modules);
|
||||
$listofmodulesautoenabled = array('agenda', 'fckeditor', 'export', 'import');
|
||||
$listofmodulesautoenabled = array('user', 'agenda', 'fckeditor', 'export', 'import');
|
||||
foreach ($listofmodulesautoenabled as $moduleautoenable) {
|
||||
if (in_array($moduleautoenable, $conf->modules)) {
|
||||
$nbmodulesnotautoenabled--;
|
||||
@@ -1181,7 +1181,7 @@ function get_left_menu_home($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu =
|
||||
}
|
||||
$newmenu->add("/admin/company.php?mainmenu=home", $langs->trans("MenuCompanySetup").$warnpicto, 1);
|
||||
$warnpicto = '';
|
||||
if ($nbmodulesnotautoenabled <= getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only user module enabled
|
||||
if ($nbmodulesnotautoenabled < getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only minimal initial modules enabled)
|
||||
$langs->load("errors");
|
||||
$warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"));
|
||||
}
|
||||
|
||||
@@ -71,6 +71,7 @@ class modUser extends DolibarrModules
|
||||
$this->phpmin = array(7, 0); // Minimum version of PHP required by module
|
||||
$this->langfiles = array("main", "users", "companies", "members", "salaries", "hrm");
|
||||
$this->always_enabled = true; // Can't be disabled
|
||||
$this->auto_enabled = true;
|
||||
|
||||
// Constants
|
||||
$this->const = array();
|
||||
|
||||
@@ -475,14 +475,14 @@ if ($step == 1 || !$datatoexport) {
|
||||
|
||||
// Define $nbmodulesnotautoenabled - TODO This code is at different places
|
||||
$nbmodulesnotautoenabled = count($conf->modules);
|
||||
$listofmodulesautoenabled = array('agenda', 'fckeditor', 'export', 'import');
|
||||
$listofmodulesautoenabled = array('user', 'agenda', 'fckeditor', 'export', 'import');
|
||||
foreach ($listofmodulesautoenabled as $moduleautoenable) {
|
||||
if (in_array($moduleautoenable, $conf->modules)) {
|
||||
$nbmodulesnotautoenabled--;
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->admin && $nbmodulesnotautoenabled <= getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only minimal initial modules enabled
|
||||
if ($user->admin && $nbmodulesnotautoenabled < getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only minimal initial modules enabled
|
||||
print info_admin($langs->trans("WarningOnlyProfilesOfActivatedModules").' '.$langs->trans("YouCanEnableModulesFrom"));
|
||||
}
|
||||
|
||||
|
||||
@@ -352,14 +352,14 @@ if ($step == 1 || !$datatoimport) {
|
||||
|
||||
// Define $nbmodulesnotautoenabled - TODO This code is at different places
|
||||
$nbmodulesnotautoenabled = count($conf->modules);
|
||||
$listofmodulesautoenabled = array('agenda', 'fckeditor', 'export', 'import');
|
||||
$listofmodulesautoenabled = array('user', 'agenda', 'fckeditor', 'export', 'import');
|
||||
foreach ($listofmodulesautoenabled as $moduleautoenable) {
|
||||
if (in_array($moduleautoenable, $conf->modules)) {
|
||||
$nbmodulesnotautoenabled--;
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->admin && $nbmodulesnotautoenabled <= getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only minimal initial modules enabled
|
||||
if ($user->admin && $nbmodulesnotautoenabled < getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only minimal initial modules enabled
|
||||
print info_admin($langs->trans("WarningOnlyProfilesOfActivatedModules").' '.$langs->trans("YouCanEnableModulesFrom"));
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ $hookmanager->initHooks(array('index'));
|
||||
|
||||
// Define $nbmodulesnotautoenabled - TODO This code is at different places
|
||||
$nbmodulesnotautoenabled = count($conf->modules);
|
||||
$listofmodulesautoenabled = array('agenda', 'fckeditor', 'export', 'import');
|
||||
$listofmodulesautoenabled = array('user', 'agenda', 'fckeditor', 'export', 'import');
|
||||
foreach ($listofmodulesautoenabled as $moduleautoenable) {
|
||||
if (in_array($moduleautoenable, $conf->modules)) {
|
||||
$nbmodulesnotautoenabled--;
|
||||
@@ -68,7 +68,7 @@ if (!getDolGlobalString('MAIN_INFO_SOCIETE_NOM') || !getDolGlobalString('MAIN_IN
|
||||
header("Location: ".DOL_URL_ROOT."/admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete");
|
||||
exit;
|
||||
}
|
||||
if ($nbmodulesnotautoenabled <= getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only autoenabled modules (property ->enabled_bydefault in modules) are activated
|
||||
if ($nbmodulesnotautoenabled < getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only autoenabled modules (property ->enabled_bydefault in modules) are activated
|
||||
header("Location: ".DOL_URL_ROOT."/admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete");
|
||||
exit;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user