From ea3356f1d0c4effbfd4ab613cd9cecc639473b09 Mon Sep 17 00:00:00 2001 From: Maxime Date: Thu, 19 Mar 2026 09:43:25 +0100 Subject: [PATCH 1/5] =?UTF-8?q?Ajout=20de=20la=20cl=C3=A9=20primaire=20dan?= =?UTF-8?q?s=20les=20m=C3=A9tadonn=C3=A9es=20du=20TicketSpecialPriceReposi?= =?UTF-8?q?tory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Event/Model/Repository/TicketSpecialPriceRepository.php | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/AppBundle/Event/Model/Repository/TicketSpecialPriceRepository.php b/sources/AppBundle/Event/Model/Repository/TicketSpecialPriceRepository.php index 732c86652..92514c2fb 100644 --- a/sources/AppBundle/Event/Model/Repository/TicketSpecialPriceRepository.php +++ b/sources/AppBundle/Event/Model/Repository/TicketSpecialPriceRepository.php @@ -80,6 +80,7 @@ public static function initMetadata(SerializerFactoryInterface $serializerFactor ->addField([ 'columnName' => 'id', 'fieldName' => 'id', + 'primary' => true, 'type' => 'int', ]) ->addField([ From 1eaec34e0c2303e74440eba4a5352e0f79cc795a Mon Sep 17 00:00:00 2001 From: Maxime Date: Thu, 19 Mar 2026 09:43:39 +0100 Subject: [PATCH 2/5] =?UTF-8?q?Ajout=20de=20la=20fonctionnalit=C3=A9=20de?= =?UTF-8?q?=20prolongation=20de=20token=20visiteur=20(#1747)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Permet de prolonger la validité d'un token visiteur de 3 jours depuis la liste des tokens dans l'administration des événements. --- app/config/routing/admin_event.yml | 6 +++ .../Admin/Event/ExtendSpecialPriceAction.php | 38 +++++++++++++++++++ .../Admin/Event/SpecialPriceAction.php | 3 ++ templates/admin/event/special_price.html.twig | 8 ++++ .../Admin/Events/TokensVIsiteurs.feature | 14 +++++++ 5 files changed, 69 insertions(+) create mode 100644 sources/AppBundle/Controller/Admin/Event/ExtendSpecialPriceAction.php diff --git a/app/config/routing/admin_event.yml b/app/config/routing/admin_event.yml index 6c9d756b3..fee64e9ab 100644 --- a/app/config/routing/admin_event.yml +++ b/app/config/routing/admin_event.yml @@ -61,6 +61,12 @@ admin_event_special_price: path: /special_price defaults: {_controller: AppBundle\Controller\Admin\Event\SpecialPriceAction} +admin_event_special_price_extend: + path: /special_price/{id}/extend + defaults: {_controller: AppBundle\Controller\Admin\Event\ExtendSpecialPriceAction} + requirements: + id: \d+ + admin_event_prices: path: /prices defaults: {_controller: AppBundle\Controller\Admin\Event\PricesAction } diff --git a/sources/AppBundle/Controller/Admin/Event/ExtendSpecialPriceAction.php b/sources/AppBundle/Controller/Admin/Event/ExtendSpecialPriceAction.php new file mode 100644 index 000000000..80e3b70f9 --- /dev/null +++ b/sources/AppBundle/Controller/Admin/Event/ExtendSpecialPriceAction.php @@ -0,0 +1,38 @@ +ticketSpecialPriceRepository->get($id); + + if ($specialPrice === null) { + throw $this->createNotFoundException(); + } + + $newDateEnd = clone $specialPrice->getDateEnd(); + $newDateEnd->modify(sprintf('+%d days', SpecialPriceAction::EXTEND_DAYS)); + $specialPrice->setDateEnd($newDateEnd); + + $this->ticketSpecialPriceRepository->save($specialPrice); + + $this->addFlash('notice', sprintf('La validité du token a été prolongée de %d jours.', SpecialPriceAction::EXTEND_DAYS)); + + return $this->redirectToRoute('admin_event_special_price', [ + 'id' => $eventSelection->event->getId(), + ]); + } +} diff --git a/sources/AppBundle/Controller/Admin/Event/SpecialPriceAction.php b/sources/AppBundle/Controller/Admin/Event/SpecialPriceAction.php index 9a30a8c7f..d508374fa 100644 --- a/sources/AppBundle/Controller/Admin/Event/SpecialPriceAction.php +++ b/sources/AppBundle/Controller/Admin/Event/SpecialPriceAction.php @@ -16,6 +16,8 @@ class SpecialPriceAction extends AbstractController { + public const EXTEND_DAYS = 3; + public function __construct( private readonly TicketSpecialPriceRepository $ticketSpecialPriceRepository, private readonly Authentication $authentication, @@ -53,6 +55,7 @@ public function __invoke(Request $request, AdminEventSelection $eventSelection): 'title' => 'Gestion des prix custom', 'form' => $form->createView(), 'event_select_form' => $eventSelection->selectForm(), + 'extend_days' => self::EXTEND_DAYS, ]); } } diff --git a/templates/admin/event/special_price.html.twig b/templates/admin/event/special_price.html.twig index 9a73c1517..1c3ce1341 100644 --- a/templates/admin/event/special_price.html.twig +++ b/templates/admin/event/special_price.html.twig @@ -15,6 +15,7 @@ Date de début Date de fin Utilisé ? + Lien @@ -34,6 +35,13 @@ non {% endif %} + + + + + Lien diff --git a/tests/behat/features/Admin/Events/TokensVIsiteurs.feature b/tests/behat/features/Admin/Events/TokensVIsiteurs.feature index 78e18b151..bf993c3e7 100644 --- a/tests/behat/features/Admin/Events/TokensVIsiteurs.feature +++ b/tests/behat/features/Admin/Events/TokensVIsiteurs.feature @@ -21,3 +21,17 @@ Feature: Administration - Évènements - Tokens Visiteurs # Lien d'un token And I follow "Lien" Then I should see "Spécial Forum * 2€ TTC" + + @reloadDbWithTestData + Scenario: Prolonger la validité d'un token visiteur + Given I am logged in as admin and on the Administration + And I follow "Tokens visiteurs" + # Ajout d'un token + When I fill in "ticket_special_price[price]" with "2" + And I fill in "ticket_special_price[description]" with "Token visiteur de test" + And I press "Enregistrer" + Then I should see "Le token a été enregistré" + # Prolongation du token + And I should see tooltip "Prolonger la validité de 3 jours" + When I follow the button of tooltip "Prolonger la validité de 3 jours" + Then I should see "La validité du token a été prolongée de 3 jours." From ca3f55677b0b4e666061ec24340138da8471053f Mon Sep 17 00:00:00 2001 From: Maxime Date: Thu, 19 Mar 2026 14:53:02 +0100 Subject: [PATCH 3/5] Update sources/AppBundle/Controller/Admin/Event/ExtendSpecialPriceAction.php Co-authored-by: Albin Kester <83301974+stakovicz@users.noreply.github.com> --- .../Controller/Admin/Event/ExtendSpecialPriceAction.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/AppBundle/Controller/Admin/Event/ExtendSpecialPriceAction.php b/sources/AppBundle/Controller/Admin/Event/ExtendSpecialPriceAction.php index 80e3b70f9..de7e4953c 100644 --- a/sources/AppBundle/Controller/Admin/Event/ExtendSpecialPriceAction.php +++ b/sources/AppBundle/Controller/Admin/Event/ExtendSpecialPriceAction.php @@ -19,7 +19,7 @@ public function __invoke(int $id, AdminEventSelection $eventSelection): Response { $specialPrice = $this->ticketSpecialPriceRepository->get($id); - if ($specialPrice === null) { + if (!$specialPrice instanceof TicketSpecialPrice) { throw $this->createNotFoundException(); } From 764f45f602e04b7edff12c00a7e66a2f8babd215 Mon Sep 17 00:00:00 2001 From: Maxime Date: Thu, 19 Mar 2026 15:01:49 +0100 Subject: [PATCH 4/5] =?UTF-8?q?Pr=C3=A9ciser=20l'unit=C3=A9=20de=20la=20co?= =?UTF-8?q?nstante=20EXTEND=5FDAYS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/AppBundle/Controller/Admin/Event/SpecialPriceAction.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/AppBundle/Controller/Admin/Event/SpecialPriceAction.php b/sources/AppBundle/Controller/Admin/Event/SpecialPriceAction.php index d508374fa..3ca87b934 100644 --- a/sources/AppBundle/Controller/Admin/Event/SpecialPriceAction.php +++ b/sources/AppBundle/Controller/Admin/Event/SpecialPriceAction.php @@ -16,7 +16,7 @@ class SpecialPriceAction extends AbstractController { - public const EXTEND_DAYS = 3; + public const EXTEND_DAYS = 3; // jours public function __construct( private readonly TicketSpecialPriceRepository $ticketSpecialPriceRepository, From 39df2983c19da5d90b47e98d3de1290ebef72923 Mon Sep 17 00:00:00 2001 From: Maxime Date: Fri, 20 Mar 2026 09:52:18 +0100 Subject: [PATCH 5/5] Ajout du use manquant pour TicketSpecialPrice --- .../Controller/Admin/Event/ExtendSpecialPriceAction.php | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/AppBundle/Controller/Admin/Event/ExtendSpecialPriceAction.php b/sources/AppBundle/Controller/Admin/Event/ExtendSpecialPriceAction.php index de7e4953c..f52a2bc43 100644 --- a/sources/AppBundle/Controller/Admin/Event/ExtendSpecialPriceAction.php +++ b/sources/AppBundle/Controller/Admin/Event/ExtendSpecialPriceAction.php @@ -6,6 +6,7 @@ use AppBundle\Event\AdminEventSelection; use AppBundle\Event\Model\Repository\TicketSpecialPriceRepository; +use AppBundle\Event\Model\TicketSpecialPrice; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response;