Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions controllers/front/FrontAjaxGdpr.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,19 @@
* @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
*
* @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');

Expand Down
1 change: 0 additions & 1 deletion controllers/front/gdpr.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions psgdpr.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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');
Expand Down
9 changes: 8 additions & 1 deletion src/Service/ExportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
41 changes: 0 additions & 41 deletions views/js/front.js

This file was deleted.

37 changes: 20 additions & 17 deletions views/templates/front/pdf/sections/modules.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,25 @@
*}

{foreach from=$modules item=module key=key}
<h2>{$module['name']}</h2>
<br>
<h2>{$module['name']}</h2>
<br>
{if $module.template!=''}
{include file=$module.template}
{else}
<table id="summary-tab" width="100%">
<tr>
{foreach from=$module['headers'] item=data key=index}
<th class="header" valign="middle">{$data}</th>
{/foreach}
</tr>

<table id="summary-tab" width="100%">
<tr>
{foreach from=$module['headers'] item=data key=index}
<th class="header" valign="middle">{$data}</th>
{/foreach}
</tr>

<tr>
{foreach from=$module['data'] item=entry key=index}
{foreach from=$entry item=value key=index}
<td class="center white">{$value}</td>
{/foreach}
{/foreach}
</tr>
</table>
<tr>
{foreach from=$module['data'] item=entry key=index}
{foreach from=$entry item=value key=index}
<td class="center white">{$value}</td>
{/foreach}
{/foreach}
</tr>
</table>
{/if}
{/foreach}
8 changes: 4 additions & 4 deletions views/templates/hook/display_rgpd_consent.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
{/block}
{literal}
<script type="text/javascript">
var psgdpr_front_controller = "{/literal}{$psgdpr_front_controller|escape:'htmlall':'UTF-8'}{literal}";
psgdpr_front_controller = psgdpr_front_controller.replace(/\amp;/g,'');
var psgdpr_id_customer = "{/literal}{$psgdpr_id_customer|escape:'htmlall':'UTF-8'}{literal}";
var psgdpr_customer_token = "{/literal}{$psgdpr_customer_token|escape:'htmlall':'UTF-8'}{literal}";
var psgdpr_id_guest = "{/literal}{$psgdpr_id_guest|escape:'htmlall':'UTF-8'}{literal}";
Expand Down Expand Up @@ -63,10 +61,12 @@
// Triggered on page loading
toggleFormActive();

$(document).on('submit', parentForm, function(event) {
parentForm.on('submit', function(event) {
$.ajax({
type: 'POST',
url: psgdpr_front_controller,
url: "{/literal}{$link->getModuleLink('psgdpr','FrontAjaxGdpr',['ajax' => 1], true)}{literal}",
async: false,
dataType : 'text',
data: {
ajax: true,
action: 'AddLog',
Expand Down