Commit 216dc720 authored by Florian Joriot's avatar Florian Joriot
Browse files

Correction bug ajout de typeFormation bug

parent 47b7cda1
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -36,6 +36,19 @@ return [
                        ],
                        'may_terminate' => true,
                    ],
                    'ajout'           => [
                        'type'          => 'Segment',
                        'options'       => [
                            'route'       => '/ajout/:groupeTypeFormation',
                            'constraints' => [
                                'typeFormation' => '[0-9]*',
                            ],
                            'defaults'    => [
                                'action' => 'ajout',
                            ],
                        ],
                        'may_terminate' => true,
                    ],
                    'supprimer'        => [
                        'type'          => 'Segment',
                        'options'       => [
@@ -126,7 +139,7 @@ return [
                ],
                [
                    'controller' => 'Application\Controller\TypeFormation',
                    'action'     => ['saisie', 'supprimer', 'saisieGroupe', 'supprimerGroupe', "trier"],
                    'action'     => ['saisie', 'supprimer', 'saisieGroupe', 'supprimerGroupe', "trier", 'ajout'],
                    'privileges' => [Privileges::ODF_TYPE_FORMATION_EDITION],
                ],
            ],
@@ -135,7 +148,6 @@ return [
    'controllers'   => [
        'factories' => [
            'Application\Controller\TypeFormation'       => Controller\Factory\TypeFormationControllerFactory::class,
            'Application\Controller\GroupeTypeFormation' => Controller\Factory\GroupeTypeFormationControllerFactory::class,
        ],
    ],
    'form_elements' => [
+27 −0
Original line number Diff line number Diff line
@@ -81,6 +81,33 @@ class TypeFormationController extends AbstractController



    public function ajoutAction()
    {
        $this->em()->getFilters()->enable('historique')->init([
            GroupeTypeFormation::class,
        ]);


        $form  = $this->getFormTypeFormationTypeFormationSaisie();
        $title = "Création d'un nouveau type de formation";
        /** @var TypeFormation $typeFormation */
        $typeFormation       = $this->getServiceTypeFormation()->newEntity();
        $groupeTypeFormation = $this->getEvent()->getParam('groupeTypeFormation');
        $typeFormation->setGroupe($groupeTypeFormation);

        $form->bindRequestSave($typeFormation, $this->getRequest(), function () use ($typeFormation, $form) {

            $this->getServiceTypeFormation()->save($typeFormation);
            $this->flashMessenger()->addSuccessMessage(
                "Ajout réussi"
            );
        });

        return compact('form', 'title');
    }



    public function saisieGroupeAction()
    {
        $groupeTypeFormation = $this->getEvent()->getParam('groupeTypeFormation');
+7 −0
Original line number Diff line number Diff line
<?php
/**
 * @var $this  \Application\View\Renderer\PhpRenderer
 */

echo $this->messenger()->addCurrentMessagesFromFlashMessenger();
echo $this->form($form);
+1 −1
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ echo $this->messenger()->addCurrentMessagesFromFlashMessenger();
                </table>
                <?php if ($canEdit): ?>
                    <tr class="champ-triable">
                        <a class="btn btn-primary ajax-modal " data-event="type-formation-edition" href="<?= $this->url('type-formation/saisie', ['typeFormation' => '','groupeTypeFormation' => $groupeTypeFormation->getId()]); ?>"><i
                        <a class="btn btn-primary ajax-modal " data-event="type-formation-edition" href="<?= $this->url('type-formation/ajout', ['groupeTypeFormation' => $groupeTypeFormation->getId()]); ?>"><i
                                    class="fas fa-plus"></i>
                            Ajout d'un nouveau type de formation</a>
                    </tr>