From 130296de48641fc2afbe3920683c36aa3bd4285c Mon Sep 17 00:00:00 2001 From: "Paolo Cunti @codencode" Date: Wed, 22 Apr 2026 21:34:56 +0200 Subject: [PATCH 1/4] Fix psgdpr menu URL query separator --- views/js/menu.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/views/js/menu.js b/views/js/menu.js index 7856c28a..a826950b 100755 --- a/views/js/menu.js +++ b/views/js/menu.js @@ -19,6 +19,12 @@ $(window).ready(function () { moduleAdminLink = moduleAdminLink.replace(/\amp;/g, ""); + function addQueryParameter(url, parameter) { + var separator = url.indexOf("?") === -1 ? "?" : "&"; + + return url + separator + parameter; + } + window.vMenu = new Vue({ el: "#psgdpr-menu", data: { @@ -27,7 +33,7 @@ $(window).ready(function () { methods: { makeActive: function (item) { this.selectedTabName = item; - window.history.pushState({}, "", moduleAdminLink + "&page=" + item); + window.history.pushState({}, "", addQueryParameter(moduleAdminLink, "page=" + item)); }, isActive: function (item) { if (this.selectedTabName == item) { From afd7c1d4eca93c548d22e340dc5f384895bacb4f Mon Sep 17 00:00:00 2001 From: Codencode Date: Tue, 5 May 2026 09:11:03 +0200 Subject: [PATCH 2/4] Refactor: replaced function addQueryParameter() with setQueryParameter() --- views/js/menu.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/views/js/menu.js b/views/js/menu.js index a826950b..35e58238 100755 --- a/views/js/menu.js +++ b/views/js/menu.js @@ -19,10 +19,10 @@ $(window).ready(function () { moduleAdminLink = moduleAdminLink.replace(/\amp;/g, ""); - function addQueryParameter(url, parameter) { - var separator = url.indexOf("?") === -1 ? "?" : "&"; - - return url + separator + parameter; + function setQueryParameter(url, key, value) { + const u = new URL(url, window.location.origin); + u.searchParams.set(key, value); + return u.toString(); } window.vMenu = new Vue({ @@ -33,7 +33,7 @@ $(window).ready(function () { methods: { makeActive: function (item) { this.selectedTabName = item; - window.history.pushState({}, "", addQueryParameter(moduleAdminLink, "page=" + item)); + window.history.pushState({}, "", setQueryParameter(moduleAdminLink, "page", item)); }, isActive: function (item) { if (this.selectedTabName == item) { From 94fe10166d3f8b153dd32f5f6a235e5300683727 Mon Sep 17 00:00:00 2001 From: Codencode Date: Tue, 5 May 2026 09:19:03 +0200 Subject: [PATCH 3/4] Fix psgdpr tab form actions and admin token retrieval when BO tokens are disabled --- psgdpr.php | 5 +++++ views/templates/admin/tabs/dataConfig.tpl | 12 ++++++++---- views/templates/admin/tabs/dataConsent.tpl | 12 ++++++++---- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/psgdpr.php b/psgdpr.php index ecd47512..fc90ad6f 100755 --- a/psgdpr.php +++ b/psgdpr.php @@ -25,6 +25,7 @@ use PrestaShop\Module\Psgdpr\Repository\LoggerRepository; use PrestaShop\Module\Psgdpr\Service\LoggerService; use PrestaShop\PrestaShop\Adapter\LegacyLogger; +use PrestaShop\PrestaShop\Core\Feature\TokenInUrls; use PrestaShopBundle\Entity\Lang; use PrestaShopBundle\Entity\Repository\LangRepository; use PrestaShopBundle\Service\Routing\Router; @@ -366,6 +367,10 @@ private function getAdminLinkWithoutToken(string $link): string */ public function getTokenFromAdminLink(string $link): string { + if (TokenInUrls::isDisabled()) { + return ''; + } + parse_str((string) parse_url($link, PHP_URL_QUERY), $result); if (is_array($result['_token'])) { diff --git a/views/templates/admin/tabs/dataConfig.tpl b/views/templates/admin/tabs/dataConfig.tpl index cec185f4..d984e1ba 100755 --- a/views/templates/admin/tabs/dataConfig.tpl +++ b/views/templates/admin/tabs/dataConfig.tpl @@ -13,15 +13,19 @@ * 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) - *} +* @copyright Since 2007 PrestaShop SA and Contributors +* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) +*} +{assign var='querySeparator' value='?'} +{if strpos($moduleAdminLink, '?') !== false} + {assign var='querySeparator' value='&'} +{/if}

{l s='Data visualization and automatic actions' d='Modules.Psgdpr.Admin'} {$module_display|escape:'htmlall':'UTF-8'}

-
+

{l s='Find here listed all personal data collected by PrestaShop and your installed modules.' d='Modules.Psgdpr.Admin'}

{l s='These data will be used at 2 different levels :' d='Modules.Psgdpr.Admin'}

diff --git a/views/templates/admin/tabs/dataConsent.tpl b/views/templates/admin/tabs/dataConsent.tpl index 309aff5f..f3d2a7ed 100755 --- a/views/templates/admin/tabs/dataConsent.tpl +++ b/views/templates/admin/tabs/dataConsent.tpl @@ -13,14 +13,18 @@ * 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) - *} +* @copyright Since 2007 PrestaShop SA and Contributors +* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) +*} +{assign var='querySeparator' value='?'} +{if strpos($moduleAdminLink, '?') !== false} + {assign var='querySeparator' value='&'} +{/if}

{l s='Configure your checkboxes' d='Modules.Psgdpr.Admin'} {$module_display|escape:'htmlall':'UTF-8'}

- +

{l s='Please customize your consent request messages in the dedicated fields below :' d='Modules.Psgdpr.Admin'}