Commit 575a8d70 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Ajout de la modalité de formation mixte + Ajout d'une garde pour éviter les inscriptions répétées

parent 38531e5d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -4,6 +4,8 @@ Journal des modifications
5.2.4
-----
- [FIX] Correction du ViewHelper SelectHelper (ne suivant pas le lien de substitution)
- Ajout de la modalité de formation mixte
- Ajout d'une garde pour éviter les inscriptions répétées

5.2.3
-----
+17 −8
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ class InscriptionController extends AbstractController
    public function ajouterAction()
    {
        $session = $this->getSessionService()->getRepository()->getRequestedSession($this);
        $libelle = $session->getFormation()->getLibelle();
        /** @var Doctorant|null $doctorant */
        $doctorantId = $this->params()->fromRoute('doctorant');
        if ($doctorantId !== null) {
@@ -78,10 +79,13 @@ class InscriptionController extends AbstractController
            $inscription = new Inscription();
            $inscription->setSession($session);
            $inscription->setDoctorant($doctorant);
            if (!empty($this->getInscriptionService()->getRepository()->findInscriptionsByDoctorantAndSession($doctorant, $session))) {
                $this->flashMessenger()->addErrorMessage("Vous êtes déjà inscrit·e à la formation <strong>" . $libelle . "</strong>.");
            } else {
                $this->getInscriptionService()->create($inscription);
            $this->flashMessenger()->addSuccessMessage("Inscription à la formation [] faite.");

                $this->flashMessenger()->addSuccessMessage("Inscription à la formation <strong>".$libelle."</strong> faite.");
                $this->getNotificationService()->triggerInscriptionEnregistree($inscription);
            }

            $retour=$this->params()->fromQuery('retour');
            if ($retour) return $this->redirect()->toUrl($retour);
@@ -98,10 +102,15 @@ class InscriptionController extends AbstractController
                $doctorant = $this->doctorantService->getRepository()->findOneByIndividu($individu);
            }
            if ($doctorant !== null) {
                if (!empty($this->getInscriptionService()->getRepository()->findInscriptionsByDoctorantAndSession($doctorant, $session))) {
                    $this->flashMessenger()->addSuccessMessage("Vous êtes déjà inscrit·e à la formation <strong>" . $libelle . "</strong>.");
                } else {
                    $inscription = new Inscription();
                    $inscription->setSession($session);
                    $inscription->setDoctorant($doctorant);
                    $this->getInscriptionService()->create($inscription);
                    $this->flashMessenger()->addSuccessMessage("Vous êtes maintenant inscrit·e à la formation <strong>" . $libelle . "</strong>.");
                }
            }
        }

+13 −0
Original line number Diff line number Diff line
@@ -87,4 +87,17 @@ class InscriptionRepository extends EntityRepository
        $result = $qb->getQuery()->getResult();
        return $result;
    }

    public function findInscriptionsByDoctorantAndSession($doctorant, ?Session $session)
    {
        $qb = $this->createQB('inscription')
            ->andWhere('inscription.doctorant = :doctorant')
            ->setParameter('doctorant', $doctorant)
            ->andWhere('inscription.session = :session')
            ->setParameter('session', $session)
            ->andWhere('inscription.histoDestruction IS NULL')
        ;
        $result = $qb->getQuery()->getResult();
        return $result;
    }
}
 No newline at end of file
+2 −0
Original line number Diff line number Diff line
@@ -75,6 +75,8 @@ $canCatalogueAfficher = $this->isAllowed(ModulePrivileges::getResourceId(ModuleP
    </div>
</div>

<?php echo $this->messenger()->addMessagesFromFlashMessengerWithNoNamespace(); ?>

<ul class="nav nav-tabs" role="tablist">
    <li role="presentation" class="nav-item active">
        <a href="#a_venir"