diff --git a/setup/wizardsteps/WizStepModulesChoice.php b/setup/wizardsteps/WizStepModulesChoice.php
index 8474588d69..2fb123a9a0 100644
--- a/setup/wizardsteps/WizStepModulesChoice.php
+++ b/setup/wizardsteps/WizStepModulesChoice.php
@@ -21,11 +21,12 @@
use Combodo\iTop\PhpParser\Evaluation\PhpExpressionEvaluator;
use Combodo\iTop\Setup\ModuleDiscovery\ModuleFileReader;
use Combodo\iTop\Setup\ModuleDiscovery\ModuleFileReaderException;
+use Combodo\iTop\Test\UnitTest\Integration\ExtensionsMapTest;
/**
* Choice of the modules to be installed
*/
-class WizStepModulesChoice extends WizardStep
+class WizStepModulesChoice extends AbstractWizStepInstall
{
protected static string $SEP = '_';
protected bool $bUpgrade = false;
@@ -118,15 +119,44 @@ class WizStepModulesChoice extends WizardStep
return [$aExtensionsAdded, $aExtensionsRemoved, $aExtensionsNotUninstallable];
}
- public function IsDataAuditEnabled(): bool
+ public static function GetSetupComponentsFromExtensions(Config $oConfig, array $aSelectedExtensions): array
{
- $sPath = APPROOT.'env-production';
- if (!is_dir($sPath)) {
- SetupLog::Info("Reinstallation of an iTop from a backup (No env-production found). Setup data audit disabled");
+ $sSourceFile = APPROOT.'datamodels/2.x/installation.xml';
+ $oExtensionsMap = new iTopExtensionsMap();
+ $oExtensionsMap->LoadChoicesFromDatabase($oConfig);
+ $aOptions = $oExtensionsMap->GetAllExtensionsOptionInfo(false);
- return false;
+ if (is_file($sSourceFile)) {
+ $aParams = new XMLParameters($sSourceFile);
+ $aSteps = $aParams->Get('steps', []);
+
+ // Display this step of the wizard only if there is something to display
+ if (count($aOptions) > 0) {
+ $aSteps[] = [
+ 'title' => 'Extensions',
+ 'description' => '
Select additional extensions to install. You can launch the installation again to install new extensions or remove installed ones.
',
+ 'banner' => '/images/icons/icons8-puzzle.svg',
+ 'options' => $aOptions,
+ ];
+ }
+ } else {
+ //legacy package
+ $aSteps = [
+ [
+ 'title' => 'Modules Selection',
+ 'description' => 'Select the modules to install. You can launch the installation again to install new modules, but you cannot remove already installed modules.
',
+ 'banner' => '/images/icons/icons8-apps-tab.svg',
+ 'options' => $aOptions,
+ ],
+ ];
}
- return true;
+
+ $aRes = [];
+ foreach ($aSteps as $aStep) {
+
+ }
+
+ return [];
}
public function UpdateWizardStateAndGetNextStep($bMoveForward = true): WizardState
@@ -861,11 +891,7 @@ EOF
return 'Non-uninstallable extension missing';
}
- if ($this->GetStepInfo(1 + $this->GetStepIndex()) === null && $this->IsDataAuditEnabled()) {
- return 'Check compatibility';
- }
-
- return 'Next';
+ return 'Check compatibility';
}
}
diff --git a/tests/php-unit-tests/unitary-tests/setup/WizStepModulesChoiceTest.php b/tests/php-unit-tests/unitary-tests/setup/WizStepModulesChoiceTest.php
index 04429c87d2..6003813d04 100644
--- a/tests/php-unit-tests/unitary-tests/setup/WizStepModulesChoiceTest.php
+++ b/tests/php-unit-tests/unitary-tests/setup/WizStepModulesChoiceTest.php
@@ -1391,4 +1391,11 @@ HTML,
$this->assertEquals($sExpectedHTML, $oPage->sContent);
}
+
+ public function testGetSetupComponentsFromExtensions()
+ {
+ $aSelectedExtensions = ["itop-config-mgmt-core","itop-config-mgmt-datacenter","itop-config-mgmt-end-user","itop-config-mgmt-storage","itop-config-mgmt-virtualization","itop-container-mgmt","itop-service-mgmt-enterprise","itop-ticket-mgmt-simple-ticket","itop-ticket-mgmt-simple-ticket-enhanced-portal","itop-change-mgmt-simple","itop-kown-error-mgmt","itop-problem-mgmt","combodo-oauth2-client","combodo-mfa-extended","combodo-data-replication","combodo-api-playground","combodo-snapshot"];
+ $aExpected = json_decode('[{"_0":"_0","_1":"_1","_2":"_2","_3":"_3","_4":"_4","_4_0":"_4_0"},{"_0":"_0"},{"_0":"_0","_0_0":"_0_0"},{"_0":"_0"},{"_0":"_0","_1":"_1"},{"_0":"_0","_1":"_1","_3":"_3","_4":"_4","_5":"_5"}]', true);
+ $this->assertEquals($aExpected, \WizStepModulesChoice::GetSetupComponentsFromExtensions($aSelectedExtensions));
+ }
}