diff --git a/CHANGELOG.md b/CHANGELOG.md index bbc32db..edba499 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ All notable changes to this module are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the module adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.1.1] 2026-10-05 + +### Fixed +- The back-office pages of the module answered 500 on default-twig 1.2.0, which removed the `token_url()` Twig function: the rule and action forms now carry the CSRF token in a hidden field, never in the URL. +- Uninstalling the module with its data now drops its three tables. +- The back-office hook imported the parser resolver from a namespace the core does not ship. + ## [2.1.0] 2026-10-02 Product discounts served through the catalog price contract of the core. Requires Thelia 3.2. diff --git a/Config/module.xml b/Config/module.xml index a01b533..0c772b2 100644 --- a/Config/module.xml +++ b/Config/module.xml @@ -15,7 +15,7 @@ en_US fr_FR - 2.1.0 + 2.1.1 Samuel Diakité diff --git a/Controller/Back/ActionController.php b/Controller/Back/ActionController.php index d052e0b..18f1ff6 100644 --- a/Controller/Back/ActionController.php +++ b/Controller/Back/ActionController.php @@ -234,7 +234,7 @@ public function toggleAction( return $response; } - $tokenProvider->checkToken((string) $request->query->get('_token')); + $tokenProvider->checkRequestToken($request); $action = QueryBuilderActionQuery::create()->filterByRuleId($ruleId)->findOneById($actionId); @@ -258,7 +258,7 @@ public function deleteAction( return $response; } - $tokenProvider->checkToken((string) $request->query->get('_token')); + $tokenProvider->checkRequestToken($request); $action = QueryBuilderActionQuery::create()->filterByRuleId($ruleId)->findOneById($actionId); diff --git a/Controller/Back/RuleController.php b/Controller/Back/RuleController.php index dc56a80..d771de7 100644 --- a/Controller/Back/RuleController.php +++ b/Controller/Back/RuleController.php @@ -274,7 +274,7 @@ public function toggleRule( return $response; } - $tokenProvider->checkToken((string) $request->query->get('_token')); + $tokenProvider->checkRequestToken($request); $rule = QueryBuilderRuleQuery::create()->findOneById($ruleId); @@ -297,7 +297,7 @@ public function deleteRule( return $response; } - $tokenProvider->checkToken((string) $request->query->get('_token')); + $tokenProvider->checkRequestToken($request); $rule = QueryBuilderRuleQuery::create()->findOneById($ruleId); diff --git a/Hook/BackHook.php b/Hook/BackHook.php index edba022..49dad5b 100644 --- a/Hook/BackHook.php +++ b/Hook/BackHook.php @@ -11,7 +11,7 @@ use Thelia\Core\Hook\BaseHook; use Thelia\Core\Security\AccessManager; use Thelia\Core\Security\SecurityContext; -use Thelia\Core\Template\ParserResolver; +use Thelia\Core\Template\Parser\ParserResolver; use Thelia\Tools\URL; /** diff --git a/QueryBuilder.php b/QueryBuilder.php index f06f615..16d5e1e 100644 --- a/QueryBuilder.php +++ b/QueryBuilder.php @@ -7,6 +7,7 @@ use OpenStudio\QueryBuilderBundle\Form\QueryBuilderType; use OpenStudio\QueryBuilderBundle\Service\FormOptionsNormalizer; use Propel\Runtime\Connection\ConnectionInterface; +use Propel\Runtime\Propel; use QueryBuilder\Service\DiscountCatalogPriceResolver; use Symfony\Component\DependencyInjection\Loader\Configurator\ServicesConfigurator; use Symfony\Component\Finder\Finder; @@ -48,6 +49,20 @@ public function postActivation(?ConnectionInterface $con = null): void } } + public function destroy(?ConnectionInterface $con = null, $deleteModuleData = false): void + { + if (!$deleteModuleData) { + return; + } + + $con ??= Propel::getConnection(); + + // Children first: the foreign keys would refuse the parent while they are there. + $con->exec('DROP TABLE IF EXISTS `query_builder_suggestion`'); + $con->exec('DROP TABLE IF EXISTS `query_builder_action`'); + $con->exec('DROP TABLE IF EXISTS `query_builder_rule`'); + } + public function update($currentVersion, $newVersion, ?ConnectionInterface $con = null): void { $updateDir = __DIR__ . DS . 'Config' . DS . 'update'; diff --git a/templates/backOffice/default-twig/QueryBuilder/rule-edit.html.twig b/templates/backOffice/default-twig/QueryBuilder/rule-edit.html.twig index f8a7595..3f114f6 100644 --- a/templates/backOffice/default-twig/QueryBuilder/rule-edit.html.twig +++ b/templates/backOffice/default-twig/QueryBuilder/rule-edit.html.twig @@ -255,7 +255,8 @@ {{ action.type }} {% if is_granted('UPDATE', { module: 'QueryBuilder' }) %} -
+ + {% if action.activate %} {% else %} @@ -277,7 +278,8 @@ {% endif %} {% if is_granted('DELETE', { module: 'QueryBuilder' }) %} - + + diff --git a/templates/backOffice/default-twig/QueryBuilder/rule-list.html.twig b/templates/backOffice/default-twig/QueryBuilder/rule-list.html.twig index 781f0c1..54eaeed 100644 --- a/templates/backOffice/default-twig/QueryBuilder/rule-list.html.twig +++ b/templates/backOffice/default-twig/QueryBuilder/rule-list.html.twig @@ -82,7 +82,8 @@ {{ rule.action_count }} {% if is_granted('UPDATE', { module: 'QueryBuilder' }) %} - + + {% if rule.activate %} {% else %} @@ -104,7 +105,8 @@ {% endif %} {% if is_granted('DELETE', { module: 'QueryBuilder' }) %} - + +