From cffd1f174d715b9a48b7eb9ac95915c98da06e1c Mon Sep 17 00:00:00 2001 From: Xavier Leune Date: Fri, 30 Jun 2017 18:54:13 +0200 Subject: [PATCH] Fix sur les inscriptions --- app/Resources/views/event/ticket/ticket.html.twig | 8 +++++++- htdocs/css/tickets.css | 7 +++++-- sources/AppBundle/Controller/TicketController.php | 8 +++++--- sources/AppBundle/Event/Form/PurchaseType.php | 3 ++- sources/AppBundle/Event/Form/TicketType.php | 3 ++- 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/app/Resources/views/event/ticket/ticket.html.twig b/app/Resources/views/event/ticket/ticket.html.twig index 633fd849f..c4f51dd5f 100644 --- a/app/Resources/views/event/ticket/ticket.html.twig +++ b/app/Resources/views/event/ticket/ticket.html.twig @@ -35,7 +35,7 @@ @@ -56,6 +56,12 @@ {% endif %} + {% if not ticketForm.vars.valid %} +
+ {{ 'Une ou plusieurs erreurs sont survenues. Merci de vérifier le formulaire' }} +
+ {% endif %} + {{ form_start(ticketForm, {attr: {id: 'formulaire'}}) }}
diff --git a/htdocs/css/tickets.css b/htdocs/css/tickets.css index d375b6f37..22944d261 100644 --- a/htdocs/css/tickets.css +++ b/htdocs/css/tickets.css @@ -152,7 +152,7 @@ div.tickets--bankwire{ ul.tickets--errors, #fieldset--7 div{ margin-left:200px; } -ul.tickets--errors{ +.tickets--errors{ font-weight: bold; color: #B0413E; } @@ -162,9 +162,12 @@ p.tickets--type-stock-limit{ #tickets--other-payments{ cursor: pointer; } -div.tickets--members-detail{ +div.tickets--members-detail, div.tickets--errors{ padding: 0 1em; border: 1px #50a0dd solid; margin: 1em auto; background-color:#f2f2f2; } +div.tickets--errors{ + border-color: #B0413E; +} diff --git a/sources/AppBundle/Controller/TicketController.php b/sources/AppBundle/Controller/TicketController.php index 09d7748f6..334f4589c 100644 --- a/sources/AppBundle/Controller/TicketController.php +++ b/sources/AppBundle/Controller/TicketController.php @@ -197,7 +197,8 @@ public function ticketAction($eventSlug, Request $request) return $this->render('event/ticket/ticket.html.twig', [ 'event' => $event, - 'ticketForm' => $purchaseForm->createView() + 'ticketForm' => $purchaseForm->createView(), + 'nbPersonnes' => $purchaseForm->get('nbPersonnes')->getData() // If there is an error, this will open all fields ]); } @@ -206,7 +207,7 @@ public function paymentAction($eventSlug, Request $request) $event = $this->checkEventSlug($eventSlug); $invoiceRepository = $this->get('app.invoice_repository'); - $invoiceRef = $request->get('invoiceRef'); + $invoiceRef = $request->get('invoiceRef', $request->query->get('invoiceRef', null)); $invoice = $invoiceRepository->getByReference($invoiceRef); if ($invoice === null) { @@ -215,7 +216,7 @@ public function paymentAction($eventSlug, Request $request) if ($invoice->getStatus() !== Ticket::STATUS_CREATED) { $this->get('logger')->addWarning(sprintf('Invoice %s already paid, cannot show the paymentAction', $invoiceRef)); - return $this->render(':event/ticket:payment_already_done.html.twig'); + return $this->render(':event/ticket:payment_already_done.html.twig', ['event' => $event]); } $params = [ @@ -229,6 +230,7 @@ public function paymentAction($eventSlug, Request $request) } elseif ($invoice->getPaymentType() === Ticket::PAYMENT_BANKWIRE) { $params['rib'] = $GLOBALS['AFUP_CONF']->obtenir('rib'); } + return $this->render('event/ticket/payment.html.twig', $params); } diff --git a/sources/AppBundle/Event/Form/PurchaseType.php b/sources/AppBundle/Event/Form/PurchaseType.php index f92343519..2bb97e172 100644 --- a/sources/AppBundle/Event/Form/PurchaseType.php +++ b/sources/AppBundle/Event/Form/PurchaseType.php @@ -43,7 +43,8 @@ public function buildForm(FormBuilderInterface $builder, array $options) ], 'multiple' => false, 'expanded' => false, - 'mapped' => false + 'mapped' => false, + 'data' => 1 ]) ->add('tickets', CollectionType::class, [ // each entry in the array will be an "email" field diff --git a/sources/AppBundle/Event/Form/TicketType.php b/sources/AppBundle/Event/Form/TicketType.php index 1621b1ef1..743d55fb2 100644 --- a/sources/AppBundle/Event/Form/TicketType.php +++ b/sources/AppBundle/Event/Form/TicketType.php @@ -76,7 +76,8 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'label' => 'Email' ]) ->add('phoneNumber', TextType::class, [ - 'label' => 'Téléphone' + 'label' => 'Téléphone', + 'required' => false ]) ->add('ticketEventType', ChoiceType::class, [ 'expanded' => true,