From 08086ed379092fb2ca2bd60a8de8813b8a08a654 Mon Sep 17 00:00:00 2001 From: jevgenijvisockij Date: Tue, 19 Mar 2024 14:37:36 +0200 Subject: [PATCH] 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 *} -
+