From ce5096a8968187c4591004bc7c602eca6a1488b0 Mon Sep 17 00:00:00 2001 From: xtophe38 <13520055+xtophe38@users.noreply.github.com> Date: Tue, 29 Nov 2022 19:00:17 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B05758=20Change=20setup=20test=20for=20GDP?= =?UTF-8?q?R=20consent=20(#336)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We were using SetupUtils::IsProductVersion, but this was blocking for certain packages like TeemIP standalone. After this change we are now relying on a new method : \SetupUtils::IsConnectableToITopHub. It will check the iTop Hub Connector module presence instead. --- setup/setuputils.class.inc.php | 12 ++++++++++++ setup/wizardsteps.class.inc.php | 12 +++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/setup/setuputils.class.inc.php b/setup/setuputils.class.inc.php index c8eb6847a..1ba6b9c35 100644 --- a/setup/setuputils.class.inc.php +++ b/setup/setuputils.class.inc.php @@ -1594,6 +1594,18 @@ JS return array_key_exists('itsm-designer-connector', $aModules); } + /** + * @param array $aModules List of available module codes + * + * @return bool true if the Hub connector is installed + * + * @since 2.7.8 3.0.3 3.1.0 N°5758 method creation + */ + public static function IsConnectableToITopHub($aModules) + { + return array_key_exists('itop-hub-connector', $aModules); + } + /** * @param array $aModules Available modules with code as key and metadata array as values * Same structure as the one returned by {@link \RunTimeEnvironment::AnalyzeInstallation} diff --git a/setup/wizardsteps.class.inc.php b/setup/wizardsteps.class.inc.php index b834c2a77..9adb5692c 100644 --- a/setup/wizardsteps.class.inc.php +++ b/setup/wizardsteps.class.inc.php @@ -707,15 +707,17 @@ class WizStepLicense extends WizardStep } /** - * @return bool + * @return bool true if we need to display a GDPR confirmation * @throws \Exception - * @since 2.7.7 3.0.2 3.1.0 + * @since 2.7.7 3.0.2 3.1.0 N°5037 method creation + * @since 2.7.8 3.0.3 3.1.0 N°5758 rename from NeedsRgpdConsent to NeedsGdprConsent */ - private function NeedsRgpdConsent() + private function NeedsGdprConsent() { $sMode = $this->oWizard->GetParameter('install_mode'); $aModules = SetupUtils::AnalyzeInstallation($this->oWizard); - return $sMode == 'install' && !SetupUtils::IsProductVersion($aModules); + + return (($sMode === 'install') && SetupUtils::IsConnectableToITopHub($aModules)); } /** @@ -752,7 +754,7 @@ EOF $oPage->add(''); $sChecked = ($this->oWizard->GetParameter('accept_license', 'no') == 'yes') ? ' checked ' : ''; $oPage->p(''); - if ($this->NeedsRgpdConsent()) { + if ($this->NeedsGdprConsent()) { $oPage->add('