diff --git a/setup/wizardsteps/WizStepDataAudit.php b/setup/wizardsteps/WizStepDataAudit.php index 2b63be2d8..a7f6d2b60 100644 --- a/setup/wizardsteps/WizStepDataAudit.php +++ b/setup/wizardsteps/WizStepDataAudit.php @@ -69,7 +69,7 @@ class WizStepDataAudit extends WizStepInstall $aInstallParams = $this->BuildConfig(); - $this->AddProgressBar($oPage); + $this->AddProgressBar($oPage, 'Progress of the verification'); $sJSONData = json_encode($aInstallParams); $oPage->add(''); @@ -78,17 +78,19 @@ class WizStepDataAudit extends WizStepInstall $oPage->add(''); $sApplicationUrl = $this->oWizard->GetParameter('application_url').'pages/exec.php?exec_module=combodo-data-feature-removal&exec_page=index.php'; $oPage->add(''); - if (!$this->CheckDependencies()) { $oPage->error($this->sDependencyIssue); - } - - $oPage->add_ready_script( - <<add_ready_script(<<add_ready_script(<<add('
Progress of the installation'); + $oPage->add('
'.$sTitle.''); $oPage->add('
'); $oPage->LinkScriptFromAppRoot('setup/jquery.progression.js'); $oPage->add('

Ready to start...

0%
'); @@ -74,7 +74,7 @@ class WizStepInstall extends AbstractWizStepInstall { $aInstallParams = $this->BuildConfig(); - $this->AddProgressBar($oPage); + $this->AddProgressBar($oPage, 'Progress of the installation'); $sJSONData = json_encode($aInstallParams); $oPage->add(''); @@ -136,6 +136,7 @@ EOF $oPage->add_ready_script( <<oWizard->GetParameter('authent', ''); + $oPage->add('
'); $oPage->add(''); //$oPage->add('
'); $oPage->add_ready_script( diff --git a/setup/wizardsteps/WizStepModulesChoice.php b/setup/wizardsteps/WizStepModulesChoice.php index 5dc762dd4..0a0f6b875 100644 --- a/setup/wizardsteps/WizStepModulesChoice.php +++ b/setup/wizardsteps/WizStepModulesChoice.php @@ -680,10 +680,14 @@ EOF if ($bMissingFromDisk) { $bDisabled = true; $bChecked = false; - } elseif ($bMandatory || $bInstalled && !$bCanBeUninstalled) { + } elseif ($bMandatory) { $bDisabled = true; $bChecked = true; + } elseif ($bInstalled && !$bCanBeUninstalled && !$bDisableUninstallCheck) { + $bChecked = true; + $bDisabled = true; } + if ($bAllDisabled) { $bDisabled = true; } diff --git a/tests/php-unit-tests/unitary-tests/setup/WizStepModulesChoiceTest.php b/tests/php-unit-tests/unitary-tests/setup/WizStepModulesChoiceTest.php index 9d21471de..039215a8c 100644 --- a/tests/php-unit-tests/unitary-tests/setup/WizStepModulesChoiceTest.php +++ b/tests/php-unit-tests/unitary-tests/setup/WizStepModulesChoiceTest.php @@ -39,6 +39,7 @@ class WizStepModulesChoiceTest extends ItopTestCase 'uninstallable' => true, ], 'bCurrentSelected' => false, + 'bDisableUninstallChecks' => false, 'aExpectedFlags' => [ 'uninstallable' => true, 'missing' => false, @@ -59,6 +60,7 @@ class WizStepModulesChoiceTest extends ItopTestCase 'uninstallable' => true, ], 'bCurrentSelected' => true, + 'bDisableUninstallChecks' => false, 'aExpectedFlags' => [ 'uninstallable' => true, 'missing' => false, @@ -77,6 +79,7 @@ class WizStepModulesChoiceTest extends ItopTestCase 'uninstallable' => true, ], 'bCurrentSelected' => false, + 'bDisableUninstallChecks' => false, 'aExpectedFlags' => [ 'uninstallable' => true, 'missing' => true, @@ -95,6 +98,7 @@ class WizStepModulesChoiceTest extends ItopTestCase 'uninstallable' => true, ], 'bCurrentSelected' => false, + 'bDisableUninstallChecks' => false, 'aExpectedFlags' => [ 'uninstallable' => true, 'missing' => true, @@ -113,6 +117,7 @@ class WizStepModulesChoiceTest extends ItopTestCase 'uninstallable' => false, ], 'bCurrentSelected' => false, + 'bDisableUninstallChecks' => false, 'aExpectedFlags' => [ 'uninstallable' => false, 'missing' => true, @@ -133,6 +138,7 @@ class WizStepModulesChoiceTest extends ItopTestCase 'uninstallable' => true, ], 'bCurrentSelected' => false, + 'bDisableUninstallChecks' => false, 'aExpectedFlags' => [ 'uninstallable' => true, 'missing' => false, @@ -153,6 +159,7 @@ class WizStepModulesChoiceTest extends ItopTestCase 'uninstallable' => false, ], 'bCurrentSelected' => false, + 'bDisableUninstallChecks' => false, 'aExpectedFlags' => [ 'uninstallable' => false, 'missing' => false, @@ -161,6 +168,27 @@ class WizStepModulesChoiceTest extends ItopTestCase 'checked' => true, ], ], + 'An installed non uninstallable extension should be enabled if the "disable uninstallation check" flag is set' => [ + 'aExtensionsOnDiskOrDb' => [ + 'itop-ext1' => [ + 'installed' => true, + ], + ], + 'aWizardStepDefinition' => [ + 'extension_code' => 'itop-ext1', + 'mandatory' => false, + 'uninstallable' => false, + ], + 'bCurrentSelected' => true, + 'bDisableUninstallChecks' => true, + 'aExpectedFlags' => [ + 'uninstallable' => false, + 'missing' => false, + 'installed' => true, + 'disabled' => false, + 'checked' => true, + ], + ], 'A mandatory extension should be checked and disabled' => [ 'aExtensionsOnDiskOrDb' => [ 'itop-ext1' => [ @@ -173,6 +201,28 @@ class WizStepModulesChoiceTest extends ItopTestCase 'uninstallable' => true, ], 'bCurrentSelected' => false, + 'bDisableUninstallChecks' => false, + 'aExpectedFlags' => [ + 'uninstallable' => true, + 'missing' => false, + 'installed' => false, + 'disabled' => true, + 'checked' => true, + ], + ], + 'A mandatory extension should be checked and disabled even if the "disable uninstallation check" flag is set' => [ + 'aExtensionsOnDiskOrDb' => [ + 'itop-ext1' => [ + 'installed' => false, + ], + ], + 'aWizardStepDefinition' => [ + 'extension_code' => 'itop-ext1', + 'mandatory' => true, + 'uninstallable' => true, + ], + 'bCurrentSelected' => false, + 'bDisableUninstallChecks' => true, 'aExpectedFlags' => [ 'uninstallable' => true, 'missing' => false, @@ -205,6 +255,7 @@ class WizStepModulesChoiceTest extends ItopTestCase ], ], 'bCurrentSelected' => false, + 'bDisableUninstallChecks' => false, 'aExpectedFlags' => [ 'uninstallable' => true, 'missing' => false, @@ -237,6 +288,7 @@ class WizStepModulesChoiceTest extends ItopTestCase ], ], 'bCurrentSelected' => false, + 'bDisableUninstallChecks' => false, 'aExpectedFlags' => [ 'uninstallable' => true, 'missing' => false, @@ -269,6 +321,7 @@ class WizStepModulesChoiceTest extends ItopTestCase ], ], 'bCurrentSelected' => false, + 'bDisableUninstallChecks' => false, 'aExpectedFlags' => [ 'uninstallable' => true, 'missing' => false, @@ -301,6 +354,7 @@ class WizStepModulesChoiceTest extends ItopTestCase ], ], 'bCurrentSelected' => false, + 'bDisableUninstallChecks' => false, 'aExpectedFlags' => [ 'uninstallable' => true, 'missing' => false, @@ -315,10 +369,10 @@ class WizStepModulesChoiceTest extends ItopTestCase /** * @dataProvider ProviderComputeChoiceFlags */ - public function testComputeChoiceFlags($aExtensionsOnDiskOrDb, $aWizardStepDefinition, $bIsCurrentSelected, $aExpectedFlags) + public function testComputeChoiceFlags($aExtensionsOnDiskOrDb, $aWizardStepDefinition, $bIsCurrentSelected, $bDisableUninstallChecks, $aExpectedFlags) { $this->oStep->setExtensionMap(iTopExtensionsMapFake::createFromArray($aExtensionsOnDiskOrDb)); - $aFlags = $this->oStep->ComputeChoiceFlags($aWizardStepDefinition, '_0', $bIsCurrentSelected ? ['_0' => '_0'] : [], false, false, true); + $aFlags = $this->oStep->ComputeChoiceFlags($aWizardStepDefinition, '_0', $bIsCurrentSelected ? ['_0' => '_0'] : [], false, $bDisableUninstallChecks, true); $this->assertEquals($aExpectedFlags, $aFlags); }