From 7d4fc98ecc9a699e9ad9bb0deca67c96eea3013f Mon Sep 17 00:00:00 2001 From: Timmy38 <101416770+Timmy38@users.noreply.github.com> Date: Mon, 31 Aug 2026 14:47:14 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B010005=20Force=20check=20installed=20exte?= =?UTF-8?q?nsions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup/wizardsteps/WizStepModulesChoice.php | 4 ++ .../setup/WizStepModulesChoiceTest.php | 50 +++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/setup/wizardsteps/WizStepModulesChoice.php b/setup/wizardsteps/WizStepModulesChoice.php index 3f6222db9f..4f72b6d940 100644 --- a/setup/wizardsteps/WizStepModulesChoice.php +++ b/setup/wizardsteps/WizStepModulesChoice.php @@ -797,6 +797,10 @@ EOF $bDisabled = !$bDisableUninstallCheck; } + if ($bDisabled) { + $bChecked = $bInstalled; + } + if (isset($aChoice['sub_options'])) { $aOptions = $aChoice['sub_options']['options'] ?? []; foreach ($aOptions as $index => $aSubChoice) { diff --git a/tests/php-unit-tests/unitary-tests/setup/WizStepModulesChoiceTest.php b/tests/php-unit-tests/unitary-tests/setup/WizStepModulesChoiceTest.php index 425f152ab3..f067579257 100644 --- a/tests/php-unit-tests/unitary-tests/setup/WizStepModulesChoiceTest.php +++ b/tests/php-unit-tests/unitary-tests/setup/WizStepModulesChoiceTest.php @@ -718,6 +718,56 @@ class WizStepModulesChoiceTest extends ItopTestCase 'remote' => false, ], ], + '#node17 - An installed non uninstallable extension should be checked and disabled when the "disable uninstallation check" flag is not set, even if it is not selected' => [ + 'aExtensionsOnDiskOrDb' => [ + 'itop-ext1' => [ + 'installed' => true, + ], + ], + 'aWizardStepDefinition' => [ + 'extension_code' => 'itop-ext1', + 'uninstallable' => false, + ], + 'aSelectedComponents' => [], + 'bDisableUninstallChecks' => false, + 'aExpectedFlags' => [ + 'uninstallable' => false, + 'missing' => false, + 'installed' => true, + 'disabled' => true, + 'checked' => true, + 'dependency_issue' => false, + 'mandatory' => false, + 'remote' => false, + ], + ], + '#node18 - An installed but not selected extension with missing dependencies without force uninstall should be checked and disabled, even if it is not selected' => [ + 'aExtensionsOnDiskOrDb' => [ + 'itop-ext1' => [ + 'installed' => true, + 'missing_dependencies' => [ + 'itop-ext1-1', + ], + ], + ], + 'aWizardStepDefinition' => [ + 'extension_code' => 'itop-ext1', + 'uninstallable' => true, + 'missing_dependencies' => true, + ], + 'aSelectedComponents' => [], + 'bDisableUninstallChecks' => false, + 'aExpectedFlags' => [ + 'uninstallable' => true, + 'missing' => false, + 'installed' => true, + 'disabled' => true, + 'checked' => true, + 'dependency_issue' => true, + 'mandatory' => false, + 'remote' => false, + ], + ], ]; }