Add isInvitation field on BilletBuyer to distinguish invitations from free billets

- isInvitation (nullable bool) on BilletBuyer instead of checking totalHT == 0
- Set isInvitation=true when creating invitation in controller
- Email subject/content based on order.isInvitation
- Invoice shows organizer as buyer when order.isInvitation
- Invitations list filtered by isInvitation=true

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Serreau Jovann
2026-03-21 19:14:45 +01:00
parent ec8f8537ce
commit be630e1c67
5 changed files with 45 additions and 3 deletions

View File

@@ -408,7 +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']),
'invitations' => $em->getRepository(BilletBuyer::class)->findBy(['event' => $event, 'isInvitation' => true], ['createdAt' => 'DESC']),
'event_total_ht' => $eventTotalHT / 100,
'event_total_sold' => $eventTotalSold,
'event_total_orders' => \count($paidEventOrders),
@@ -731,6 +731,7 @@ class AccountController extends AbstractController
$order->setEmail($email);
$order->setOrderNumber(date('Y-m-d').'-'.$count);
$order->setTotalHT(0);
$order->setIsInvitation(true);
foreach ($items as $itemData) {
$billetId = (int) ($itemData['billet_id'] ?? 0);