Add isInvitation to BilletOrder, orga details in PDF footer, rename Sortie libre
- Add isInvitation (nullable bool) to BilletOrder: null=no badge, true=invitation - PDF footer: add SIRET, email, phone of organizer - PDF: show invitation badge based on ticket.isInvitation instead of design - Rename "Sortie libre" to "Sortie - Entree illimitee" Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
26
migrations/Version20260321220000.php
Normal file
26
migrations/Version20260321220000.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 Version20260321220000 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Add is_invitation to billet_order';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE billet_order ADD COLUMN IF NOT EXISTS is_invitation BOOLEAN DEFAULT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE billet_order DROP COLUMN IF EXISTS is_invitation');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -37,6 +37,9 @@ class BilletOrder
|
|||||||
#[ORM\Column(length: 20)]
|
#[ORM\Column(length: 20)]
|
||||||
private string $state = self::STATE_VALID;
|
private string $state = self::STATE_VALID;
|
||||||
|
|
||||||
|
#[ORM\Column(nullable: true)]
|
||||||
|
private ?bool $isInvitation = null;
|
||||||
|
|
||||||
#[ORM\Column(nullable: true)]
|
#[ORM\Column(nullable: true)]
|
||||||
private ?\DateTimeImmutable $firstScannedAt = null;
|
private ?\DateTimeImmutable $firstScannedAt = null;
|
||||||
|
|
||||||
@@ -129,6 +132,18 @@ class BilletOrder
|
|||||||
return self::STATE_VALID === $this->state;
|
return self::STATE_VALID === $this->state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isInvitation(): ?bool
|
||||||
|
{
|
||||||
|
return $this->isInvitation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setIsInvitation(?bool $isInvitation): static
|
||||||
|
{
|
||||||
|
$this->isInvitation = $isInvitation;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function getFirstScannedAt(): ?\DateTimeImmutable
|
public function getFirstScannedAt(): ?\DateTimeImmutable
|
||||||
{
|
{
|
||||||
return $this->firstScannedAt;
|
return $this->firstScannedAt;
|
||||||
|
|||||||
@@ -298,9 +298,9 @@
|
|||||||
{% if ticket.billet.definedExit %}
|
{% if ticket.billet.definedExit %}
|
||||||
<span class="badge-exit-def">Sortie definitive</span>
|
<span class="badge-exit-def">Sortie definitive</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="badge-exit-libre">Sortie libre</span>
|
<span class="badge-exit-libre">Sortie - Entree illimitee</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if design %}
|
{% if ticket.invitation %}
|
||||||
<span class="badge-invitation" style="background: {{ inv_color }};">{{ inv_title }}</span>
|
<span class="badge-invitation" style="background: {{ inv_color }};">{{ inv_title }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
@@ -341,9 +341,15 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<td>
|
<td>
|
||||||
<div class="footer-org">{{ organizer.companyName ?? (organizer.firstName ~ ' ' ~ organizer.lastName) }}</div>
|
<div class="footer-org">{{ organizer.companyName ?? (organizer.firstName ~ ' ' ~ organizer.lastName) }}</div>
|
||||||
|
{% if organizer.siret %}
|
||||||
|
<div class="footer-details">SIRET: {{ organizer.siret }}</div>
|
||||||
|
{% endif %}
|
||||||
{% if organizer.address %}
|
{% if organizer.address %}
|
||||||
<div class="footer-details">{{ organizer.address }}{% if organizer.postalCode %}, {{ organizer.postalCode }}{% endif %}{% if organizer.city %} {{ organizer.city }}{% endif %}</div>
|
<div class="footer-details">{{ organizer.address }}{% if organizer.postalCode %}, {{ organizer.postalCode }}{% endif %}{% if organizer.city %} {{ organizer.city }}{% endif %}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if organizer.email or organizer.phone %}
|
||||||
|
<div class="footer-details">{% if organizer.email %}{{ organizer.email }}{% endif %}{% if organizer.email and organizer.phone %} — {% endif %}{% if organizer.phone %}{{ organizer.phone }}{% endif %}</div>
|
||||||
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td class="footer-powered">E-Ticket<br>by E-Cosplay</td>
|
<td class="footer-powered">E-Ticket<br>by E-Cosplay</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ class BilletOrderTest extends TestCase
|
|||||||
self::assertSame(0.0, $ticket->getUnitPriceHTDecimal());
|
self::assertSame(0.0, $ticket->getUnitPriceHTDecimal());
|
||||||
self::assertSame(BilletOrder::STATE_VALID, $ticket->getState());
|
self::assertSame(BilletOrder::STATE_VALID, $ticket->getState());
|
||||||
self::assertTrue($ticket->isValid());
|
self::assertTrue($ticket->isValid());
|
||||||
|
self::assertNull($ticket->isInvitation());
|
||||||
self::assertNull($ticket->getFirstScannedAt());
|
self::assertNull($ticket->getFirstScannedAt());
|
||||||
self::assertMatchesRegularExpression('/^ETICKET-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}$/', $ticket->getReference());
|
self::assertMatchesRegularExpression('/^ETICKET-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}$/', $ticket->getReference());
|
||||||
self::assertInstanceOf(\DateTimeImmutable::class, $ticket->getCreatedAt());
|
self::assertInstanceOf(\DateTimeImmutable::class, $ticket->getCreatedAt());
|
||||||
@@ -82,6 +83,18 @@ class BilletOrderTest extends TestCase
|
|||||||
self::assertTrue($ticket->isValid());
|
self::assertTrue($ticket->isValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSetAndGetIsInvitation(): void
|
||||||
|
{
|
||||||
|
$ticket = new BilletOrder();
|
||||||
|
$result = $ticket->setIsInvitation(true);
|
||||||
|
|
||||||
|
self::assertTrue($ticket->isInvitation());
|
||||||
|
self::assertSame($ticket, $result);
|
||||||
|
|
||||||
|
$ticket->setIsInvitation(null);
|
||||||
|
self::assertNull($ticket->isInvitation());
|
||||||
|
}
|
||||||
|
|
||||||
public function testSetAndGetFirstScannedAt(): void
|
public function testSetAndGetFirstScannedAt(): void
|
||||||
{
|
{
|
||||||
$ticket = new BilletOrder();
|
$ticket = new BilletOrder();
|
||||||
|
|||||||
Reference in New Issue
Block a user