From 08086ed379092fb2ca2bd60a8de8813b8a08a654 Mon Sep 17 00:00:00 2001 From: jevgenijvisockij Date: Tue, 19 Mar 2024 14:37:36 +0200 Subject: [PATCH 1/2] Adjusted cloudsync --- .../admin/AdminMollieSettingsController.php | 28 +++++++++++-------- .../subscriptions-settings.html.twig | 2 ++ views/templates/admin/logo.tpl | 2 +- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/controllers/admin/AdminMollieSettingsController.php b/controllers/admin/AdminMollieSettingsController.php index 420f9f43d..39ec55cb9 100644 --- a/controllers/admin/AdminMollieSettingsController.php +++ b/controllers/admin/AdminMollieSettingsController.php @@ -27,7 +27,7 @@ public function __construct() $this->bootstrap = true; } - private function initCloudSyncAndPsAccounts(): void + private function initCloudSyncAndPsAccounts(): bool { $mboInstaller = new Prestashop\ModuleLibMboInstaller\DependencyBuilder($this->module); @@ -36,6 +36,7 @@ private function initCloudSyncAndPsAccounts(): void $this->context->smarty->assign('dependencies', $dependencies); $this->content .= $this->context->smarty->fetch($this->module->getLocalPath() . 'views/templates/admin/dependency_builder.tpl'); + return false; } $this->context->smarty->assign('module_dir', $this->module->getPathUri()); @@ -78,11 +79,23 @@ private function initCloudSyncAndPsAccounts(): void } $this->content .= $this->context->smarty->fetch($this->module->getLocalPath() . 'views/templates/admin/cloudsync.tpl'); + return true; } public function postProcess() { - $this->initCloudSyncAndPsAccounts(); + /** @var \Mollie\Service\Content\TemplateParserInterface $templateParser */ + $templateParser = $this->module->getService(\Mollie\Service\Content\TemplateParserInterface::class); + + $this->content = $templateParser->parseTemplate( + $this->context->smarty, + $this->module->getService(\Mollie\Builder\Content\LogoInfoBlock::class), + $this->module->getLocalPath() . 'views/templates/admin/logo.tpl' + ); + $cloudSyncComplete = $this->initCloudSyncAndPsAccounts(); + if (!$cloudSyncComplete) { + return; + } /** @var \Mollie\Repository\ModuleRepository $moduleRepository */ $moduleRepository = $this->module->getService(\Mollie\Repository\ModuleRepository::class); $moduleDatabaseVersion = $moduleRepository->getModuleDatabaseVersion($this->module->name); @@ -101,9 +114,6 @@ public function postProcess() return; } - /** @var \Mollie\Service\Content\TemplateParserInterface $templateParser */ - $templateParser = $this->module->getService(\Mollie\Service\Content\TemplateParserInterface::class); - $isSubmitted = (bool) Tools::isSubmit("submit{$this->module->name}"); /* @phpstan-ignore-next-line */ @@ -149,17 +159,11 @@ public function postProcess() $this->context->controller->addCSS($this->module->getPathUri() . 'views/css/mollie.css'); $this->context->controller->addCSS($this->module->getPathUri() . 'views/css/admin/logo_input.css'); - $html = $templateParser->parseTemplate( - $this->context->smarty, - $this->module->getService(\Mollie\Builder\Content\LogoInfoBlock::class), - $this->module->getLocalPath() . 'views/templates/admin/logo.tpl' - ); - /** @var \Mollie\Builder\Content\UpdateMessageInfoBlock $updateMessageInfoBlock */ $updateMessageInfoBlock = $this->module->getService(\Mollie\Builder\Content\UpdateMessageInfoBlock::class); $updateMessageInfoBlockData = $updateMessageInfoBlock->setAddons(false); - $html .= $templateParser->parseTemplate( + $html = $templateParser->parseTemplate( $this->context->smarty, $updateMessageInfoBlockData, $this->module->getLocalPath() . 'views/templates/admin/updateMessage.tpl' diff --git a/views/templates/admin/Subscription/subscriptions-settings.html.twig b/views/templates/admin/Subscription/subscriptions-settings.html.twig index 3b571e579..7c3806775 100644 --- a/views/templates/admin/Subscription/subscriptions-settings.html.twig +++ b/views/templates/admin/Subscription/subscriptions-settings.html.twig @@ -9,6 +9,8 @@ * @codingStandardsIgnoreStart *#} +{% import '@PrestaShop/Admin/macros.html.twig' as ps %} + {% set subscriptionOptions = subscriptionOptionsForm %} {% if subscriptionOptionsForm.subscription_options is defined and subscriptionOptionsForm.subscription_options %} diff --git a/views/templates/admin/logo.tpl b/views/templates/admin/logo.tpl index 6087b7297..841eb900b 100644 --- a/views/templates/admin/logo.tpl +++ b/views/templates/admin/logo.tpl @@ -8,7 +8,7 @@ * @see https://github.com/mollie/PrestaShop * @codingStandardsIgnoreStart *} -
+
From 633b5a6b9e78e3c1275b07dc3443dd76cf233da7 Mon Sep 17 00:00:00 2001 From: jevgenijvisockij Date: Tue, 19 Mar 2024 14:42:06 +0200 Subject: [PATCH 2/2] CS fixer --- controllers/admin/AdminMollieSettingsController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/controllers/admin/AdminMollieSettingsController.php b/controllers/admin/AdminMollieSettingsController.php index 39ec55cb9..22b79b81c 100644 --- a/controllers/admin/AdminMollieSettingsController.php +++ b/controllers/admin/AdminMollieSettingsController.php @@ -36,6 +36,7 @@ private function initCloudSyncAndPsAccounts(): bool $this->context->smarty->assign('dependencies', $dependencies); $this->content .= $this->context->smarty->fetch($this->module->getLocalPath() . 'views/templates/admin/dependency_builder.tpl'); + return false; } @@ -79,6 +80,7 @@ private function initCloudSyncAndPsAccounts(): bool } $this->content .= $this->context->smarty->fetch($this->module->getLocalPath() . 'views/templates/admin/cloudsync.tpl'); + return true; }