Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/config/packages/backoffice_menu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ parameters:
forum_inscriptions:
nom: 'Inscriptions'
niveau: 'ROLE_FORUM'
url: '/admin/event/tickets'
extra_routes:
- admin_event_ticket_list
forum_pending_bankwires:
nom: 'Virements en attente'
niveau: 'ROLE_ADMIN'
Expand Down
4 changes: 4 additions & 0 deletions app/config/routing/admin_event.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,7 @@ admin_event_sessions_delete:
id: ~
requirements:
id: \d+

admin_event_ticket_list:
path: /tickets
defaults: { _controller: AppBundle\Controller\Admin\Event\Ticket\IndexAction }
158 changes: 156 additions & 2 deletions db/seeds/Inscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

declare(strict_types=1);

use AppBundle\Association\MemberType;
use AppBundle\Event\Model\Ticket;
use Phinx\Seed\AbstractSeed;

Expand All @@ -12,6 +13,7 @@ public function run(): void
// Inscriptions
$data = [
[
'date' => time(),
'reference' => 'REF-TEST-001',
'type_inscription' => Ticket::TYPE_2_DAYS,
'montant' => $GLOBALS['AFUP_Tarifs_Forum'][Ticket::TYPE_2_DAYS],
Expand All @@ -24,9 +26,11 @@ public function run(): void
'newsletter_afup' => '1',
'newsletter_nexen' => '0',
'id_forum' => Event::ID_FORUM,
'member_type' => MemberType::MemberPhysical->value,
'etat' => Ticket::STATUS_PAID,
],
[
'date' => (new \DateTime("2023-06-25"))->getTimestamp(),
'reference' => 'REF-TEST-002',
'type_inscription' => Ticket::TYPE_2_DAYS,
'montant' => $GLOBALS['AFUP_Tarifs_Forum'][Ticket::TYPE_2_DAYS],
Expand All @@ -39,9 +43,11 @@ public function run(): void
'newsletter_afup' => '1',
'newsletter_nexen' => '0',
'id_forum' => Event::ID_FORUM,
'member_type' => MemberType::MemberPhysical->value,
'etat' => Ticket::STATUS_PAID,
],
[
'date' => (new \DateTime("2024-01-02"))->getTimestamp(),
'reference' => 'REF-TEST-003',
'type_inscription' => Ticket::TYPE_2_DAYS,
'montant' => $GLOBALS['AFUP_Tarifs_Forum'][Ticket::TYPE_2_DAYS],
Expand All @@ -54,8 +60,79 @@ public function run(): void
'newsletter_afup' => '1',
'newsletter_nexen' => '0',
'id_forum' => Event::ID_FORUM,
'member_type' => MemberType::MemberPhysical->value,
'etat' => Ticket::STATUS_PAID,
],
[
'date' => (new \DateTime("2024-01-02"))->getTimestamp(),
'reference' => 'REF-TEST-004',
'type_inscription' => Ticket::TYPE_2_DAYS_AFUP,
'montant' => $GLOBALS['AFUP_Tarifs_Forum'][Ticket::TYPE_2_DAYS_AFUP],
'civilite' => 'Mme',
'nom' => 'Sans',
'prenom' => 'Cotisation',
'email' => '[email protected]',
'telephone' => '0102030406',
'citer_societe' => '1',
'newsletter_afup' => '1',
'newsletter_nexen' => '0',
'id_forum' => Event::ID_FORUM,
'member_type' => MemberType::MemberPhysical->value,
'etat' => Ticket::STATUS_PAID,
],
[
'date' => time(),
'reference' => 'REF-TEST-005',
'type_inscription' => Ticket::TYPE_2_DAYS_AFUP,
'montant' => $GLOBALS['AFUP_Tarifs_Forum'][Ticket::TYPE_2_DAYS_AFUP],
'civilite' => 'M',
'nom' => 'Personne',
'prenom' => 'Paul',
'email' => '[email protected]',
'telephone' => '0102030406',
'citer_societe' => '1',
'newsletter_afup' => '1',
'newsletter_nexen' => '0',
'id_forum' => Event::ID_FORUM,
'id_member' => Users::ID_USER_PERSONNE_PHYSIQUE,
'member_type' => MemberType::MemberPhysical->value,
'etat' => Ticket::STATUS_PAID,
],
[
'date' => time(),
'reference' => 'REF-TEST-006',
'type_inscription' => Ticket::TYPE_2_DAYS_AFUP,
'montant' => $GLOBALS['AFUP_Tarifs_Forum'][Ticket::TYPE_2_DAYS_AFUP],
'civilite' => 'M',
'nom' => 'Maurice',
'prenom' => 'Jean',
'email' => '[email protected]',
'telephone' => '0102030406',
'citer_societe' => '1',
'newsletter_afup' => '1',
'newsletter_nexen' => '0',
'id_forum' => Event::ID_FORUM,
'id_member' => Users::ID_USER_EXPIRIE,
'member_type' => MemberType::MemberPhysical->value,
'etat' => Ticket::STATUS_PAID,
],
[
'date' => time(),
'reference' => 'REF-TEST-007',
'type_inscription' => Ticket::TYPE_2_DAYS,
'montant' => $GLOBALS['AFUP_Tarifs_Forum'][Ticket::TYPE_2_DAYS],
'civilite' => 'Mme',
'nom' => 'Annulé',
'prenom' => 'Lepaiement',
'email' => '[email protected]',
'telephone' => '0601020304',
'citer_societe' => '1',
'newsletter_afup' => '1',
'newsletter_nexen' => '0',
'id_forum' => Event::ID_FORUM,
'member_type' => MemberType::MemberPhysical->value,
'etat' => Ticket::STATUS_CANCELLED,
],
];

$table = $this->table('afup_inscription_forum');
Expand All @@ -76,6 +153,7 @@ public function run(): void
'email' => '[email protected]',
'nom' => 'Michu',
'prenom' => 'Bernadette',
'societe' => 'Helios Aerospace',
'adresse' => '3 rue du chemin',
'code_postal' => '99002',
'ville' => 'Ville',
Expand All @@ -91,7 +169,7 @@ public function run(): void
'reference' => 'REF-TEST-002',
'montant' => $GLOBALS['AFUP_Tarifs_Forum'][Ticket::TYPE_2_DAYS],
'date_reglement' => (new \DateTime("2023-06-25"))->getTimestamp(),
'type_reglement' => Ticket::PAYMENT_CREDIT_CARD,
'type_reglement' => Ticket::PAYMENT_CHEQUE,
'email' => '[email protected]',
'nom' => 'Jean',
'prenom' => 'Maurice',
Expand All @@ -110,7 +188,7 @@ public function run(): void
'reference' => 'REF-TEST-003',
'montant' => $GLOBALS['AFUP_Tarifs_Forum'][Ticket::TYPE_2_DAYS],
'date_reglement' => (new \DateTime("2024-01-02"))->getTimestamp(),
'type_reglement' => Ticket::PAYMENT_CREDIT_CARD,
'type_reglement' => Ticket::PAYMENT_BANKWIRE,
'email' => '[email protected]',
'nom' => 'Kirk',
'prenom' => 'James Tiberius',
Expand All @@ -125,6 +203,82 @@ public function run(): void
'id_forum' => Event::ID_FORUM,
'date_facture' => (new \DateTime("2024-01-02"))->getTimestamp(),
],
[
'reference' => 'REF-TEST-004',
'montant' => $GLOBALS['AFUP_Tarifs_Forum'][Ticket::TYPE_2_DAYS_AFUP],
'date_reglement' => (new \DateTime("2024-01-02"))->getTimestamp(),
'type_reglement' => Ticket::PAYMENT_CREDIT_CARD,
'email' => '[email protected]',
'nom' => 'Sans',
'prenom' => 'Cotisation',
'adresse' => "3 avenue de l'enterprise",
'code_postal' => '69003',
'ville' => 'Lyon',
'id_pays' => 'FR',
'autorisation' => 'ozzbfksgvz',
'transaction' => 'yaedskem',
'etat' => Ticket::STATUS_PAID,
'facturation' => 1,
'id_forum' => Event::ID_FORUM,
'date_facture' => (new \DateTime("2024-01-02"))->getTimestamp(),
],
[
'reference' => 'REF-TEST-005',
'montant' => $GLOBALS['AFUP_Tarifs_Forum'][Ticket::TYPE_2_DAYS_AFUP],
'date_reglement' => (new \DateTime("2024-01-02"))->getTimestamp(),
'type_reglement' => Ticket::PAYMENT_CREDIT_CARD,
'nom' => 'Personne',
'prenom' => 'Paul',
'email' => '[email protected]',
'adresse' => "3 avenue de l'enterprise",
'code_postal' => '69003',
'ville' => 'Lyon',
'id_pays' => 'FR',
'autorisation' => 'ozzbfksgvz',
'transaction' => 'yaedskem',
'etat' => Ticket::STATUS_PAID,
'facturation' => 1,
'id_forum' => Event::ID_FORUM,
'date_facture' => (new \DateTime("2024-01-02"))->getTimestamp(),
],
[
'reference' => 'REF-TEST-006',
'montant' => $GLOBALS['AFUP_Tarifs_Forum'][Ticket::TYPE_2_DAYS_AFUP],
'date_reglement' => (new \DateTime("2024-01-02"))->getTimestamp(),
'type_reglement' => Ticket::PAYMENT_CREDIT_CARD,
'nom' => 'Maurice',
'prenom' => 'Jean',
'email' => '[email protected]',
'adresse' => "3 avenue de l'enterprise",
'code_postal' => '69003',
'ville' => 'Lyon',
'id_pays' => 'FR',
'autorisation' => 'ozzbfksgvz',
'transaction' => 'yaedskem',
'etat' => Ticket::STATUS_PAID,
'facturation' => 1,
'id_forum' => Event::ID_FORUM,
'date_facture' => (new \DateTime("2024-01-02"))->getTimestamp(),
],
[
'reference' => 'REF-TEST-007',
'montant' => $GLOBALS['AFUP_Tarifs_Forum'][Ticket::TYPE_2_DAYS],
'date_reglement' => time(),
'type_reglement' => Ticket::PAYMENT_CREDIT_CARD,
'nom' => 'Annulé',
'prenom' => 'Lepaiement',
'email' => '[email protected]',
'adresse' => '3 rue du chemin',
'code_postal' => '99002',
'ville' => 'Ville',
'id_pays' => 'FR',
'autorisation' => 'otzbfksgve',
'transaction' => 'taedsken',
'etat' => Ticket::STATUS_CANCELLED,
'facturation' => 0,
'id_forum' => Event::ID_FORUM,
'date_facture' => time(),
],
];

$table = $this->table('afup_facturation_forum');
Expand Down
8 changes: 4 additions & 4 deletions htdocs/pages/administration/forum_inscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ function updateGlobalsForTarif(
$invoice = $invoiceRepository->getByReference($_GET['id']);
if ($forum_inscriptions->supprimerInscription($_GET['id']) && (null === $invoice || $invoiceService->deleteInvoice($invoice))) {
Logs::log('Suppression de l\'inscription ' . $_GET['id']);
afficherMessage('L\'inscription a été supprimée', 'index.php?page=forum_inscriptions&action=lister');
afficherMessage('L\'inscription a été supprimée', '/admin/event/tickets?id=' . $_GET['id_forum']);
} else {
afficherMessage('Une erreur est survenue lors de la suppression de l\'inscription', 'index.php?page=forum_inscriptions&action=lister', true);
afficherMessage('Une erreur est survenue lors de la suppression de l\'inscription', '/admin/event/tickets?id=' . $_GET['id_forum'], true);
}
} else {

Expand All @@ -154,7 +154,7 @@ function updateGlobalsForTarif(
} else {
$champs = $forum_inscriptions->obtenir($_GET['id']);
if ($champs == false) {
afficherMessage('L\'inscription n\'existe plus', 'index.php?page=forum_inscriptions&action=lister');
afficherMessage('L\'inscription n\'existe plus', '/admin/event/tickets?id=' . $_GET['id_forum']);
exit(0);
}
$champs2 = $forum_facturation->obtenir($champs['reference']);
Expand Down Expand Up @@ -409,7 +409,7 @@ function updateGlobalsForTarif(
} else {
Logs::log('Modification de l\'inscription de ' . $formulaire->exportValue('prenom') . ' ' . $formulaire->exportValue('nom') . ' (' . $_GET['id'] . ')');
}
afficherMessage('L\'inscription a été ' . (($action == 'ajouter') ? 'ajoutée' : 'modifiée'), 'index.php?page=forum_inscriptions&action=lister&id_forum=' . $valeurs['id_forum']);
afficherMessage('L\'inscription a été ' . (($action == 'ajouter') ? 'ajoutée' : 'modifiée'), '/admin/event/tickets?id=' . $_GET['id_forum']);
} else {
$smarty->assign('erreur', 'Une erreur est survenue lors de ' . (($action == 'ajouter') ? "l'ajout" : 'la modification') . ' de l\'inscription');
}
Expand Down
119 changes: 119 additions & 0 deletions sources/AppBundle/Controller/Admin/Event/Ticket/IndexAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<?php

declare(strict_types=1);

namespace AppBundle\Controller\Admin\Event\Ticket;

use AppBundle\Event\AdminEventSelection;
use AppBundle\Event\Model\Event;
use AppBundle\Event\Model\EventStats;
use AppBundle\Event\Model\Repository\EventStatsRepository;
use AppBundle\Event\Model\Repository\TicketRepository;
use AppBundle\Event\Ticket\TicketOffers;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class IndexAction extends AbstractController
{
public function __construct(
private readonly EventStatsRepository $eventStatsRepository,
private readonly TicketRepository $ticketRepository,
private readonly TicketOffers $ticketOffer,
private readonly FormFactoryInterface $formFactory,
) {}

public function __invoke(Request $request, AdminEventSelection $eventSelection): Response
{
//TODO : à supprimer quand les actions via le formulaire auront été migrées
if (isset($_SESSION['flash']['message'])) {
$this->addFlash('notice', $_SESSION['flash']['message']);
}
if (isset($_SESSION['flash']['erreur'])) {
$this->addFlash('error', $_SESSION['flash']['erreur']);
}
unset($_SESSION['flash']);


$event = $eventSelection->event;
$data = [
'id' => $event->getId(),
];
$filterForm = $this->filterForm($data);
$filterForm->handleRequest($request);

if ($filterForm->isSubmitted() && $filterForm->isValid()) {
$data = $filterForm->getData();
$data = array_filter($data);
}
$data['sort_key'] ??= 'date';
$data['sort_direction'] ??= 'desc';

$statistics = $this->eventStatsRepository->getStats($event->getId());
$tickets = $this->ticketRepository->getByEventWithAll(
event: $event,
search: $data['filter'] ?? null,
sortKey: $data['sort_key'],
sortDirection: $data['sort_direction'],
);
$computed = $this->computeStatistics($statistics, $event);

return $this->render('admin/event/ticket/index.html.twig', [
'event' => $event,
'event_select_form' => $eventSelection->selectForm(),
'statistics' => $statistics,
'tickets' => $tickets,
'computed' => $computed,
'filter_form' => $filterForm,
'filter' => $data,
]);
}

private function computeStatistics(EventStats $statistics, Event $event): array
{
$computed = [];
$offers = $this->ticketOffer->getAllOffersForEvent($event);

foreach ($offers as $ticketType => $ticketOffer) {

$registered = $statistics->ticketType->registered[$ticketType] ?? 0;
$confirmed = $statistics->ticketType->confirmed[$ticketType] ?? 0;
$paying = $statistics->ticketType->paying[$ticketType] ?? 0;
$amount = $paying * $ticketOffer->price;

if ($registered) {
$computed[$ticketType] = [
'label' => $ticketOffer->name,
'registered' => $registered,
'confirmed' => $confirmed,
'paying' => $paying,
'amount' => $ticketOffer->price,
'payingAmount' => $amount,
'availableTickets' => $ticketOffer->availableTickets,
];
}
}

return $computed;
}

private function filterForm(array $data): FormInterface
{
return $this->formFactory->createNamedBuilder('', FormType::class, $data, [
'csrf_protection' => false,
])
->setMethod('GET')
->add('filter', TextType::class, ['required' => false])
->add('id', HiddenType::class, ['required' => false])
->add('sort_key', HiddenType::class, ['required' => false])
->add('sort_direction', HiddenType::class, ['required' => false])
->add('submit', SubmitType::class)
->getForm();
}
}
Loading
Loading