mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-14 07:54:10 +01:00
Compare commits
3 Commits
feature/91
...
9010_Fix_f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aedc81fb90 | ||
|
|
c3cc07316e | ||
|
|
06b0cad74f |
@@ -1937,14 +1937,26 @@ EOF
|
||||
public function ComputeChoiceFlags(array $aChoice, string $sChoiceId, array $aSelectedComponents, bool $bAllDisabled, bool $bDisableUninstallCheck, bool $bUpgradeMode)
|
||||
{
|
||||
$oITopExtension = $this->oExtensionsMap->GetFromExtensionCode($aChoice['extension_code']);
|
||||
//If the extension is missing from disk, it won't exist in the ExtensionsMap, thus returning null
|
||||
$bCanBeUninstalled = isset($aChoice['uninstallable']) ? $aChoice['uninstallable'] === true || $aChoice['uninstallable'] === 'yes' : $oITopExtension->CanBeUninstalled();
|
||||
$bSelected = isset($aSelectedComponents[$sChoiceId]) && ($aSelectedComponents[$sChoiceId] == $sChoiceId);
|
||||
$bMandatory = (isset($aChoice['mandatory']) && $aChoice['mandatory']) || $bUpgradeMode && $oITopExtension->bInstalled && !$bCanBeUninstalled && !$bDisableUninstallCheck;
|
||||
|
||||
$bMissingFromDisk = isset($aChoice['missing']) && $aChoice['missing'] === true;
|
||||
$bMandatory = (isset($aChoice['mandatory']) && $aChoice['mandatory']);
|
||||
$bInstalled = $bMissingFromDisk || $oITopExtension->bInstalled;
|
||||
$bDisabled = $bMandatory || $bAllDisabled || $bMissingFromDisk;
|
||||
$bChecked = $bMandatory || $bSelected;
|
||||
|
||||
$bChecked = $bSelected;
|
||||
$bDisabled = false;
|
||||
if ($bMissingFromDisk) {
|
||||
$bDisabled = true;
|
||||
$bChecked = false;
|
||||
}
|
||||
elseif($bMandatory || $bInstalled && !$bCanBeUninstalled){
|
||||
$bDisabled = true;
|
||||
$bChecked = true;
|
||||
}
|
||||
if($bAllDisabled){
|
||||
$bDisabled = true;
|
||||
}
|
||||
|
||||
if (isset($aChoice['sub_options'])) {
|
||||
$aOptions = $aChoice['sub_options']['options'] ?? [];
|
||||
|
||||
@@ -67,6 +67,60 @@ class WizStepModulesChoiceTest extends ItopTestCase
|
||||
'checked' => true,
|
||||
],
|
||||
],
|
||||
'A missing extension should be disabled and unchecked' => [
|
||||
'aExtensionsOnDiskOrDb' => [
|
||||
],
|
||||
'aWizardStepDefinition' => [
|
||||
'extension_code' => 'itop-ext1',
|
||||
'mandatory' => false,
|
||||
'missing' => true,
|
||||
'uninstallable' => true,
|
||||
],
|
||||
'bCurrentSelected' => false,
|
||||
'aExpectedFlags' => [
|
||||
'uninstallable' => true,
|
||||
'missing' => true,
|
||||
'installed' => true,
|
||||
'disabled' => true,
|
||||
'checked' => false,
|
||||
],
|
||||
],
|
||||
'A missing extension should always be disabled and unchecked, even when mandatory' => [
|
||||
'aExtensionsOnDiskOrDb' => [
|
||||
],
|
||||
'aWizardStepDefinition' => [
|
||||
'extension_code' => 'itop-ext1',
|
||||
'mandatory' => true,
|
||||
'missing' => true,
|
||||
'uninstallable' => true,
|
||||
],
|
||||
'bCurrentSelected' => false,
|
||||
'aExpectedFlags' => [
|
||||
'uninstallable' => true,
|
||||
'missing' => true,
|
||||
'installed' => true,
|
||||
'disabled' => true,
|
||||
'checked' => false,
|
||||
],
|
||||
],
|
||||
'A missing extension should always be disabled and unchecked, even when non-uninstallable' => [
|
||||
'aExtensionsOnDiskOrDb' => [
|
||||
],
|
||||
'aWizardStepDefinition' => [
|
||||
'extension_code' => 'itop-ext1',
|
||||
'mandatory' => true,
|
||||
'missing' => true,
|
||||
'uninstallable' => false,
|
||||
],
|
||||
'bCurrentSelected' => false,
|
||||
'aExpectedFlags' => [
|
||||
'uninstallable' => false,
|
||||
'missing' => true,
|
||||
'installed' => true,
|
||||
'disabled' => true,
|
||||
'checked' => false,
|
||||
],
|
||||
],
|
||||
'An installed but not selected extension should not be checked and be enabled' => [
|
||||
'aExtensionsOnDiskOrDb' => [
|
||||
'itop-ext1' => [
|
||||
|
||||
Reference in New Issue
Block a user