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:
26
migrations/Version20260321270000.php
Normal file
26
migrations/Version20260321270000.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
final class Version20260321270000 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Add is_invitation to billet_buyer';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE billet_buyer ADD COLUMN IF NOT EXISTS is_invitation BOOLEAN DEFAULT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE billet_buyer DROP COLUMN IF EXISTS is_invitation');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -408,7 +408,7 @@ class AccountController extends AbstractController
|
|||||||
'commission_rate' => $user->getCommissionRate() ?? 0,
|
'commission_rate' => $user->getCommissionRate() ?? 0,
|
||||||
'billet_design' => $em->getRepository(BilletDesign::class)->findOneBy(['event' => $event]),
|
'billet_design' => $em->getRepository(BilletDesign::class)->findOneBy(['event' => $event]),
|
||||||
'event_orders' => $eventOrders,
|
'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_ht' => $eventTotalHT / 100,
|
||||||
'event_total_sold' => $eventTotalSold,
|
'event_total_sold' => $eventTotalSold,
|
||||||
'event_total_orders' => \count($paidEventOrders),
|
'event_total_orders' => \count($paidEventOrders),
|
||||||
@@ -731,6 +731,7 @@ class AccountController extends AbstractController
|
|||||||
$order->setEmail($email);
|
$order->setEmail($email);
|
||||||
$order->setOrderNumber(date('Y-m-d').'-'.$count);
|
$order->setOrderNumber(date('Y-m-d').'-'.$count);
|
||||||
$order->setTotalHT(0);
|
$order->setTotalHT(0);
|
||||||
|
$order->setIsInvitation(true);
|
||||||
|
|
||||||
foreach ($items as $itemData) {
|
foreach ($items as $itemData) {
|
||||||
$billetId = (int) ($itemData['billet_id'] ?? 0);
|
$billetId = (int) ($itemData['billet_id'] ?? 0);
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ class BilletBuyer
|
|||||||
#[ORM\Column(length: 20)]
|
#[ORM\Column(length: 20)]
|
||||||
private string $status = self::STATUS_PENDING;
|
private string $status = self::STATUS_PENDING;
|
||||||
|
|
||||||
|
#[ORM\Column(nullable: true)]
|
||||||
|
private ?bool $isInvitation = null;
|
||||||
|
|
||||||
#[ORM\Column(length: 255, nullable: true)]
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
private ?string $stripeSessionId = null;
|
private ?string $stripeSessionId = null;
|
||||||
|
|
||||||
@@ -172,6 +175,18 @@ class BilletBuyer
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isInvitation(): ?bool
|
||||||
|
{
|
||||||
|
return $this->isInvitation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setIsInvitation(?bool $isInvitation): static
|
||||||
|
{
|
||||||
|
$this->isInvitation = $isInvitation;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function getAccessToken(): string
|
public function getAccessToken(): string
|
||||||
{
|
{
|
||||||
return $this->accessToken;
|
return $this->accessToken;
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ class BilletOrderService
|
|||||||
'token' => $order->getAccessToken(),
|
'token' => $order->getAccessToken(),
|
||||||
], UrlGeneratorInterface::ABSOLUTE_URL);
|
], UrlGeneratorInterface::ABSOLUTE_URL);
|
||||||
|
|
||||||
$isInvitation = 0 === $order->getTotalHT();
|
$isInvitation = true === $order->isInvitation();
|
||||||
|
|
||||||
$html = $this->twig->render('email/order_confirmation.html.twig', [
|
$html = $this->twig->render('email/order_confirmation.html.twig', [
|
||||||
'order' => $order,
|
'order' => $order,
|
||||||
|
|||||||
@@ -85,7 +85,7 @@
|
|||||||
<div class="info-block">
|
<div class="info-block">
|
||||||
<div class="info-title">Acheteur</div>
|
<div class="info-title">Acheteur</div>
|
||||||
<div class="info-text">
|
<div class="info-text">
|
||||||
{% if order.totalHT == 0 %}
|
{% if order.invitation %}
|
||||||
{{ organizer.companyName ?? (organizer.firstName ~ ' ' ~ organizer.lastName) }}<br>
|
{{ organizer.companyName ?? (organizer.firstName ~ ' ' ~ organizer.lastName) }}<br>
|
||||||
{% if organizer.email %}{{ organizer.email }}{% endif %}
|
{% if organizer.email %}{{ organizer.email }}{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|||||||
Reference in New Issue
Block a user