Fix invitation list (use dedicated variable), invitation email subject and content

- Pass invitations from controller instead of Twig filter on paginator
- Email subject: "Votre invitation" for invitations, "Vos billets" for purchases
- Email content: different intro text for invitations

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Serreau Jovann
2026-03-21 19:09:49 +01:00
parent bf6aa16e20
commit 66ddc297b1
4 changed files with 17 additions and 4 deletions

View File

@@ -408,6 +408,7 @@ class AccountController extends AbstractController
'commission_rate' => $user->getCommissionRate() ?? 0,
'billet_design' => $em->getRepository(BilletDesign::class)->findOneBy(['event' => $event]),
'event_orders' => $eventOrders,
'invitations' => $em->getRepository(BilletBuyer::class)->findBy(['event' => $event, 'totalHT' => 0], ['createdAt' => 'DESC']),
'event_total_ht' => $eventTotalHT / 100,
'event_total_sold' => $eventTotalSold,
'event_total_orders' => \count($paidEventOrders),

View File

@@ -165,15 +165,22 @@ class BilletOrderService
'token' => $order->getAccessToken(),
], UrlGeneratorInterface::ABSOLUTE_URL);
$isInvitation = 0 === $order->getTotalHT();
$html = $this->twig->render('email/order_confirmation.html.twig', [
'order' => $order,
'tickets' => $tickets,
'orderUrl' => $orderUrl,
'isInvitation' => $isInvitation,
]);
$subject = $isInvitation
? 'Votre invitation - '.$order->getEvent()->getTitle()
: 'Vos billets - '.$order->getEvent()->getTitle();
$this->mailer->sendEmail(
$order->getEmail(),
'Vos billets - '.$order->getEvent()->getTitle(),
$subject,
$html,
'E-Ticket <contact@e-cosplay.fr>',
null,

View File

@@ -429,14 +429,13 @@
</div>
</div>
{% set invitation_orders = event_orders|filter(o => o.totalHT == 0) %}
{% if invitation_orders|length > 0 %}
{% if invitations|length > 0 %}
<div class="card-brutal overflow-hidden">
<div class="section-header">
<h2 class="text-[10px] font-black uppercase tracking-widest text-white">Invitations envoyees</h2>
</div>
<div class="p-6">
{% for order in invitation_orders %}
{% for order in invitations %}
<div class="flex flex-wrap items-center gap-4 py-3 {{ not loop.last ? 'border-b border-gray-200' : '' }}">
<div class="flex-1 min-w-0">
<p class="font-black text-sm">{{ order.firstName }} {{ order.lastName }}</p>

View File

@@ -3,9 +3,15 @@
{% block title %}Vos billets - {{ order.event.title }}{% endblock %}
{% block content %}
{% if isInvitation|default(false) %}
<h2>Votre invitation !</h2>
<p>Bonjour {{ order.firstName }},</p>
<p>Vous etes invite(e) a l'evenement <strong>{{ order.event.title }}</strong>.</p>
{% else %}
<h2>Vos billets sont prets !</h2>
<p>Bonjour {{ order.firstName }},</p>
<p>Merci pour votre commande <strong>{{ order.orderNumber }}</strong> pour l'evenement <strong>{{ order.event.title }}</strong>.</p>
{% endif %}
<table style="width: 100%; border-collapse: collapse; margin: 20px 0;">
<thead>