diff --git a/controllers/front/FrontAjaxGdpr.php b/controllers/front/FrontAjaxGdpr.php index be623951..7d894793 100644 --- a/controllers/front/FrontAjaxGdpr.php +++ b/controllers/front/FrontAjaxGdpr.php @@ -20,7 +20,7 @@ * @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) */ -class psgdprFrontAjaxGdprModuleFrontController extends FrontController +class psgdprFrontAjaxGdprModuleFrontController extends ModuleFrontController { /** * Store if the client consented or not to GDPR on a specific module for statistic purpose only @@ -28,17 +28,11 @@ class psgdprFrontAjaxGdprModuleFrontController extends FrontController * @throws PrestaShopDatabaseException * @throws PrestaShopException */ - public function display() + public function displayAjaxAddlog() { /** @var LoggerService $loggerService */ $loggerService = $this->get('PrestaShop\Module\Psgdpr\Service\LoggerService'); - if (Tools::getValue('action') !== 'AddLog') { - $this->ajaxRender(); - - return false; - } - $customerId = (int) Tools::getValue('id_customer'); $customerToken = (string) Tools::getValue('customer_token'); diff --git a/controllers/front/gdpr.php b/controllers/front/gdpr.php index c81ca023..b3a77b36 100644 --- a/controllers/front/gdpr.php +++ b/controllers/front/gdpr.php @@ -101,7 +101,6 @@ public function setMedia(): bool parent::setMedia(); - $this->context->controller->addJS($js_path . 'front.js'); $this->context->controller->addCSS($css_path . 'account-gdpr-page.css'); return true; diff --git a/psgdpr.php b/psgdpr.php index 885423ac..7ec30837 100755 --- a/psgdpr.php +++ b/psgdpr.php @@ -748,7 +748,6 @@ public function hookDisplayGDPRConsent(array $params): string } $message = $consentRepository->findModuleConsentMessage($moduleId, $this->context->language->id); - $url = $this->context->link->getModuleLink($this->name, 'FrontAjaxGdpr', [], true); $customerId = $this->context->customer->id; $guestId = 0; @@ -765,7 +764,6 @@ public function hookDisplayGDPRConsent(array $params): string 'psgdpr_guest_token' => sha1('psgdpr' . $guestId . $_SERVER['REMOTE_ADDR'] . date('Y-m-d')), 'psgdpr_id_module' => $moduleId, 'psgdpr_consent_message' => $message, - 'psgdpr_front_controller' => $url, ]); return $this->fetch('module:' . $this->name . '/views/templates/hook/display_rgpd_consent.tpl'); diff --git a/src/Service/ExportService.php b/src/Service/ExportService.php index 69e673eb..6fd0c706 100644 --- a/src/Service/ExportService.php +++ b/src/Service/ExportService.php @@ -129,12 +129,19 @@ public function getThirdPartyModulesInformations($customer): array } /** @var array $moduleData */ - $moduleData = json_decode($dataFromModule); + $moduleData = json_decode($dataFromModule, true); if (empty($moduleData)) { $moduleData = $this->translator->trans('No data available', [], 'Modules.Psgdpr.Admin'); } + if (isset($moduleData['template'])) { + $thirdPartyModuleData[$moduleInfos->name]['template'] = _PS_CORE_DIR_ . $moduleData['template']; + $moduleData = $moduleData['data']; + } else { + $thirdPartyModuleData[$moduleInfos->name]['template'] = ''; + } + if (!is_array($moduleData)) { $thirdPartyModuleData[$moduleInfos->name]['name'] = $entryName; $thirdPartyModuleData[$moduleInfos->name]['headers'][] = $this->translator->trans('Information', [], 'Modules.Psgdpr.Admin'); diff --git a/views/js/front.js b/views/js/front.js deleted file mode 100755 index 6e494304..00000000 --- a/views/js/front.js +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright since 2007 PrestaShop SA and Contributors - * PrestaShop is an International Registered Trademark & Property of PrestaShop SA - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License 3.0 (AFL-3.0) - * that is bundled with this package in the file LICENSE.md. - * It is also available through the world-wide-web at this URL: - * https://opensource.org/licenses/AFL-3.0 - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@prestashop.com so we can send you a copy immediately. - * - * @author PrestaShop SA - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) - */ - -$(document).ready(function() { - psgdpr_front_controller = psgdpr_front_controller.replace(/\amp;/g,''); - - $(document).on('click', '#exportPersonalData', function (e) { - $.ajax({ - data: 'POST', - dataType: 'JSON', - url: psgdpr_front_controller, - data: { - ajax: true, - action: test, - id_customer: psgdpr_id_customer - }, - success: function (data) { - - }, - error: function (err) { - console.log(err); - } - }); - }); -}); diff --git a/views/templates/front/pdf/sections/modules.tpl b/views/templates/front/pdf/sections/modules.tpl index 7b6eddab..7c38184c 100644 --- a/views/templates/front/pdf/sections/modules.tpl +++ b/views/templates/front/pdf/sections/modules.tpl @@ -18,22 +18,25 @@ *} {foreach from=$modules item=module key=key} -

{$module['name']}

-
+

{$module['name']}

+
+ {if $module.template!=''} + {include file=$module.template} + {else} + + + {foreach from=$module['headers'] item=data key=index} + + {/foreach} + -
{$data}
- - {foreach from=$module['headers'] item=data key=index} - - {/foreach} - - - - {foreach from=$module['data'] item=entry key=index} - {foreach from=$entry item=value key=index} - - {/foreach} - {/foreach} - -
{$data}
{$value}
+ + {foreach from=$module['data'] item=entry key=index} + {foreach from=$entry item=value key=index} + {$value} + {/foreach} + {/foreach} + + + {/if} {/foreach} diff --git a/views/templates/hook/display_rgpd_consent.tpl b/views/templates/hook/display_rgpd_consent.tpl index fb73d41a..48da0f18 100644 --- a/views/templates/hook/display_rgpd_consent.tpl +++ b/views/templates/hook/display_rgpd_consent.tpl @@ -29,8 +29,6 @@ {/block} {literal}