Loading module/Evenementiel/config/merged/Evenement.config.php +22 −0 Changes for module/Evenementiel/config/merged/Evenement.config.php: 22 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ use Evenementiel\Form\Evenement\EvenementHydratorFactory; use Evenementiel\Provider\Identity\IdentityProvider; use Evenementiel\Provider\Identity\IdentityProviderFactory; use Evenementiel\Provider\Privilege\EvenementPrivileges; use Evenementiel\Provider\Privilege\EvenementielinscriptionPrivileges; use Evenementiel\Service\Evenement\EvenementService; use Evenementiel\Service\Evenement\EvenementServiceFactory; use Laminas\Router\Http\Literal; Loading Loading @@ -103,6 +104,7 @@ return [ 'inscription-participant-gestionnaire', 'inscription-etudiant-gestionnaire', 'inscription-personnel-gestionnaire', 'inscription-groupe-gestionnaire', 'pointer-anonyme', 'depointer-anonyme', ], Loading @@ -110,12 +112,18 @@ return [ EvenementPrivileges::EVENEMENT_INSCRIPTION_GESTIONNAIRE, ], ], [ 'controller' => EvenementController::class, 'action' => ['inscription-groupe-gestionnaire', 'inscription-groupe'], 'privileges' => [EvenementielinscriptionPrivileges::GROUPE], ], [ 'controller' => EvenementController::class, 'action' => [ 'inscription-etudiant', 'inscription-personnel', 'inscription-externe', 'inscription-groupe', ], 'privileges' => [ EvenementPrivileges::EVENEMENT_INSCRIPTION_PARTICIPANT, Loading Loading @@ -297,6 +305,20 @@ return [ ], ], ], 'inscription-groupe-gestionnaire' => [ 'type' => Segment::class, 'options' => [ 'route' => '/inscription-groupe-gestionnaire/:entity', 'defaults' => ['action' => 'inscription-groupe-gestionnaire'], ], ], 'inscription-groupe' => [ 'type' => Segment::class, 'options' => [ 'route' => '/inscription-groupe/:entity', 'defaults' => ['action' => 'inscription-groupe'], ], ], 'inscription-etudiant-gestionnaire' => [ 'type' => Segment::class, 'options' => [ Loading module/Evenementiel/config/merged/Inscription.config.php +4 −0 Changes for module/Evenementiel/config/merged/Inscription.config.php: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -32,6 +32,8 @@ use Evenementiel\Form\Inscription\InscriptionParticipantForm; use Evenementiel\Form\Inscription\InscriptionParticipantFormFactory; use Evenementiel\Form\Inscription\InscriptionParticipantHydrator; use Evenementiel\Form\Inscription\InscriptionParticipantHydratorFactory; use Evenementiel\Form\Inscription\InscriptionGroupeForm; use Evenementiel\Form\Inscription\InscriptionGroupeFormFactory; use UnicaenPrivilege\Provider\Rule\PrivilegeRuleProvider; return [ Loading Loading @@ -119,6 +121,7 @@ return [ 'action' => [ 'auto-inscription', 'inscription-en-cours', 'inscription-groupe', ], 'privileges' => [ EvenementielinscriptionPrivileges::AUTOINSCRIPTION, Loading Loading @@ -404,6 +407,7 @@ return [ InscriptionParticipantForm::class => InscriptionParticipantFormFactory::class, InscriptionEtudiantForm::class => InscriptionEtudiantFormFactory::class, InscriptionPersonnelForm::class => InscriptionPersonnelFormFactory::class, InscriptionGroupeForm::class => InscriptionGroupeFormFactory::class, InscriptionPlaceFieldset::class => InscriptionPlaceFieldsetFactory::class, ], ], Loading module/Evenementiel/src/Assertion/InscriptionAssertion.php +16 −8 Changes for module/Evenementiel/src/Assertion/InscriptionAssertion.php: 16 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -48,30 +48,38 @@ class InscriptionAssertion extends AbstractAssertion case EtudiantRolesProvider::ROLE_ETUDIANT: $etudiantOk = ($inscription->getParticipant()->getEtudiant() === $etudiant); return $etudiantOk && $inscriptionOk && $etatEvenementOk; return $etudiantOk && $inscription->estIndividuelle() && $inscriptionOk && $etatEvenementOk; case PersonnelRolesProvider::ROLE_PERSONNEL: $personnelOk = ($inscription->getParticipant()->getPersonnel() === $personnel); return $personnelOk && $inscriptionOk && $etatEvenementOk; return $personnelOk && $inscription->estIndividuelle() && $inscriptionOk && $etatEvenementOk; case ExterneRolesProvider::ROLE_EXTERNE: $externeOk = ($inscription->getParticipant()->getEmail() === $user->getEmail()); return $externeOk && $inscriptionOk && $etatEvenementOk; return $externeOk && $inscription->estIndividuelle() && $inscriptionOk && $etatEvenementOk; case ExterneRolesProvider::ROLE_GROUPE: $groupeOk = $inscription->estGroupe() && $inscription->getParticipant()->getEmail() === $user->getEmail(); return $groupeOk && $inscriptionOk && $etatEvenementOk; default : return true; return false; } break; case EvenementielinscriptionPrivileges::MODIFIER: switch ($role->getRoleId()) { case EtudiantRolesProvider::ROLE_ETUDIANT: $etudiantOk = ($inscription->getParticipant()->getEtudiant() === $etudiant); return $etudiantOk && $inscriptionOk && $etatEvenementOk; return $etudiantOk && $inscription->estIndividuelle() && $inscriptionOk && $etatEvenementOk; case PersonnelRolesProvider::ROLE_PERSONNEL: $personnelOk = ($inscription->getParticipant()->getPersonnel() === $personnel); return $personnelOk && $inscriptionOk && $etatEvenementOk; return $personnelOk && $inscription->estIndividuelle() && $inscriptionOk && $etatEvenementOk; case ExterneRolesProvider::ROLE_EXTERNE: $externeOk = ($inscription->getParticipant()->getEmail() === $user->getEmail()); return $externeOk && $inscriptionOk && $etatEvenementOk; return $externeOk && $inscription->estIndividuelle() && $inscriptionOk && $etatEvenementOk; case ExterneRolesProvider::ROLE_GROUPE: $groupeOk = $inscription->estGroupe() && $inscription->getParticipant()->getEmail() === $user->getEmail(); return $groupeOk && $inscriptionOk && $etatEvenementOk; default : return true; return false; } break; } Loading module/Evenementiel/src/Controller/EvenementController.php +84 −5 Changes for module/Evenementiel/src/Controller/EvenementController.php: 84 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ namespace Evenementiel\Controller; use Etudiant\Provider\Role\RolesProvider as EtudiantRolesProvider; use Evenementiel\Form\Inscription\InscriptionPersonnelFormAwareTrait; use Evenementiel\Form\Inscription\InscriptionGroupeFormAwareTrait; use Evenementiel\Form\Notification\NotificationFormAwareTrait; use Personnel\Provider\Role\RolesProvider as PersonnelRolesProvider; use Etudiant\Service\Etudiant\EtudiantServiceAwareTrait; Loading Loading @@ -53,6 +54,7 @@ class EvenementController extends AbstractActionController use MailServiceAwareTrait; use PersonnelServiceAwareTrait; use InscriptionPersonnelFormAwareTrait; use InscriptionGroupeFormAwareTrait; use NotificationFormAwareTrait; /** Loading Loading @@ -358,6 +360,84 @@ class EvenementController extends AbstractActionController /** Ajout d'inscription *******************************************************************************************/ public function inscriptionGroupeGestionnaireAction(): ViewModel|Response { $evenement = $this->getEvenementService()->getRequestedEntity($this); $form = $this->getInscriptionGroupeForm(); $form->setAutoInscriptionMode(false); $form->setAttribute('action', $this->url()->fromRoute('evenementiel/evenement/inscription-groupe-gestionnaire', ['entity' => $evenement->getId()], [], true)); $form->setAttribute('method', 'post'); if ($this->getRequest()->isPost()) { $data = $this->getRequest()->getPost()->toArray(); $form->setData($data); if ($form->isValid()) { try { $participant = $this->getParticipantService()->getParticipant($data['participant']['id'] ?? null); if ($participant === null) { throw new \RuntimeException('Le participant responsable est obligatoire.'); } $this->getInscriptionService()->inscrireGroupe($evenement, $participant, (int)$data['nombrePlacesDemandees']); $this->flashMessenger()->addSuccessMessage("L'inscription du groupe a été créée."); return $this->redirect()->toRoute('evenementiel/evenement/afficher', ['entity' => $evenement->getId()], ['fragment' => 'inscriptions'], true); } catch (\Throwable $exception) { $this->flashMessenger()->addErrorMessage($exception->getMessage()); } } } $vm = new ViewModel(['title' => "Inscription d'un groupe à l'évènement " . $evenement->getLibelle() . " du " . $evenement->getDateToString(), 'form' => $form]); $vm->setTemplate('evenementiel/inscription/modifier-groupe'); return $vm; } public function inscriptionGroupeAction(): ViewModel|Response { $evenement = $this->getEvenementService()->getRequestedEntity($this); $participant = $this->getParticipantService()->getParticipantUsager(); $form = $this->getInscriptionGroupeForm(); $form->setAutoInscriptionMode(true); $form->setAttribute('action', $this->url()->fromRoute('evenementiel/evenement/inscription-groupe', ['entity' => $evenement->getId()], [], true)); $form->setAttribute('method', 'post'); if ($this->getRequest()->isPost()) { $data = $this->getRequest()->getPost()->toArray(); $form->setData($data); if ($form->isValid()) { try { if ($participant === null) { throw new \RuntimeException('Le participant usager est introuvable.'); } $inscription = $this->getInscriptionService()->inscrireGroupe( $evenement, $participant, (int) $data['nombrePlacesDemandees'] ); switch ($inscription->getListe()) { case Inscription::PRINCIPALE: $this->getNotificationService()->triggerListePrincipale($inscription); $this->flashMessenger()->addSuccessMessage("Classement de l'inscription en liste principale."); break; case Inscription::COMPLEMENTAIRE: $this->getNotificationService()->triggerListeComplementaire($inscription); $this->flashMessenger()->addWarningMessage("Liste principale complète. <br/> Classement de l'inscription en liste d'attente."); break; default: $this->flashMessenger()->addErrorMessage("Échec du classement de l'inscription."); break; } exit(); } catch (\Throwable $exception) { $this->flashMessenger()->addErrorMessage($exception->getMessage()); } } } $vm = new ViewModel(['title' => "Inscription de groupe à l'évènement " . $evenement->getLibelle() . " du " . $evenement->getDateToString(), 'form' => $form]); $vm->setTemplate('evenementiel/inscription/modifier-groupe'); return $vm; } public function inscriptionParticipantGestionnaireAction(): ViewModel { $evenement = $this->getEvenementService()->getRequestedEntity($this); Loading Loading @@ -451,7 +531,7 @@ class EvenementController extends AbstractActionController // Vérifier si l'étudiant existe déjà en tant que participant $participant = $this->getParticipantService()->createOrUpdateUsager($etudiant); // verifier si l'inscription existe déjà $existingInscription = $this->getInscriptionService()->inscriptionExists($participant, $evenement); $existingInscription = $this->getInscriptionService()->inscriptionExists($participant, $evenement, Inscription::TYPE_INDIVIDUELLE); if ($existingInscription === null) { $inscription->setParticipant($participant); $this->getInscriptionService()->create($inscription); Loading Loading @@ -522,7 +602,7 @@ class EvenementController extends AbstractActionController // Vérifier si le personnel existe déjà en tant que participant $participant = $this->getParticipantService()->createOrUpdateUsager($personnel); // verifier si l'inscription existe déjà $existingInscription = $this->getInscriptionService()->inscriptionExists($participant, $evenement); $existingInscription = $this->getInscriptionService()->inscriptionExists($participant, $evenement, Inscription::TYPE_INDIVIDUELLE); if ($existingInscription === null) { $inscription->setParticipant($participant); $this->getInscriptionService()->create($inscription); Loading Loading @@ -591,7 +671,7 @@ class EvenementController extends AbstractActionController if ($inscription->getEvenement() !== null && $usager->getEmail() !== null ) { $participant = $this->getParticipantService()->createOrUpdateUsager($usager); $existingInscription = $this->getInscriptionService()->inscriptionExists($participant, $evenement); $existingInscription = $this->getInscriptionService()->inscriptionExists($participant, $evenement, Inscription::TYPE_INDIVIDUELLE); if ($existingInscription !== null) { $existingInscription->dehistoriser(); $existingInscription->setNombrePlacesDemandees($inscription->getNombrePlacesDemandees()); Loading Loading @@ -703,7 +783,7 @@ class EvenementController extends AbstractActionController && $inscription->getEvenement() !== null && $participant->getEmail() !== null ) { $existingInscription = $this->getInscriptionService()->inscriptionExists($participant, $evenement); $existingInscription = $this->getInscriptionService()->inscriptionExists($participant, $evenement, Inscription::TYPE_INDIVIDUELLE); if ($existingInscription !== null) { $existingInscription->dehistoriser(); $existingInscription->setNombrePlacesDemandees($inscription->getNombrePlacesDemandees()); Loading Loading @@ -893,4 +973,3 @@ class EvenementController extends AbstractActionController return $this->redirect()->toRoute("evenementiel/evenement", [], [], true); } } module/Evenementiel/src/Controller/EvenementControllerFactory.php +3 −1 Changes for module/Evenementiel/src/Controller/EvenementControllerFactory.php: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use Evenementiel\Form\Evenement\EvenementForm; use Evenementiel\Form\Inscription\InscriptionEtudiantForm; use Evenementiel\Form\Inscription\InscriptionParticipantForm; use Evenementiel\Form\Inscription\InscriptionPersonnelForm; use Evenementiel\Form\Inscription\InscriptionGroupeForm; use Evenementiel\Form\Notification\NotificationForm; use Evenementiel\Service\Evenement\EvenementService; use Evenementiel\Service\Inscription\InscriptionService; Loading Loading @@ -64,6 +65,7 @@ class EvenementControllerFactory $inscriptionService = $container->get(InscriptionService::class); $inscriptionEtudiantForm = $container->get('FormElementManager')->get(InscriptionEtudiantForm::class); $inscriptionPersonnelForm = $container->get('FormElementManager')->get(InscriptionPersonnelForm::class); $inscriptionGroupeForm = $container->get('FormElementManager')->get(InscriptionGroupeForm::class); $participantService = $container->get(ParticipantService::class); $etudiantService = $container->get(EtudiantService::class); $userService = $container->get(UserService::class); Loading @@ -84,6 +86,7 @@ class EvenementControllerFactory $controller->setInscriptionService($inscriptionService); $controller->setInscriptionEtudiantForm($inscriptionEtudiantForm); $controller->setInscriptionPersonnelForm($inscriptionPersonnelForm); $controller->setInscriptionGroupeForm($inscriptionGroupeForm); $controller->setParticipantService($participantService); $controller->setEtudiantService($etudiantService); $controller->setUserService($userService); Loading @@ -95,4 +98,3 @@ class EvenementControllerFactory return $controller; } } Loading
module/Evenementiel/config/merged/Evenement.config.php +22 −0 Changes for module/Evenementiel/config/merged/Evenement.config.php: 22 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ use Evenementiel\Form\Evenement\EvenementHydratorFactory; use Evenementiel\Provider\Identity\IdentityProvider; use Evenementiel\Provider\Identity\IdentityProviderFactory; use Evenementiel\Provider\Privilege\EvenementPrivileges; use Evenementiel\Provider\Privilege\EvenementielinscriptionPrivileges; use Evenementiel\Service\Evenement\EvenementService; use Evenementiel\Service\Evenement\EvenementServiceFactory; use Laminas\Router\Http\Literal; Loading Loading @@ -103,6 +104,7 @@ return [ 'inscription-participant-gestionnaire', 'inscription-etudiant-gestionnaire', 'inscription-personnel-gestionnaire', 'inscription-groupe-gestionnaire', 'pointer-anonyme', 'depointer-anonyme', ], Loading @@ -110,12 +112,18 @@ return [ EvenementPrivileges::EVENEMENT_INSCRIPTION_GESTIONNAIRE, ], ], [ 'controller' => EvenementController::class, 'action' => ['inscription-groupe-gestionnaire', 'inscription-groupe'], 'privileges' => [EvenementielinscriptionPrivileges::GROUPE], ], [ 'controller' => EvenementController::class, 'action' => [ 'inscription-etudiant', 'inscription-personnel', 'inscription-externe', 'inscription-groupe', ], 'privileges' => [ EvenementPrivileges::EVENEMENT_INSCRIPTION_PARTICIPANT, Loading Loading @@ -297,6 +305,20 @@ return [ ], ], ], 'inscription-groupe-gestionnaire' => [ 'type' => Segment::class, 'options' => [ 'route' => '/inscription-groupe-gestionnaire/:entity', 'defaults' => ['action' => 'inscription-groupe-gestionnaire'], ], ], 'inscription-groupe' => [ 'type' => Segment::class, 'options' => [ 'route' => '/inscription-groupe/:entity', 'defaults' => ['action' => 'inscription-groupe'], ], ], 'inscription-etudiant-gestionnaire' => [ 'type' => Segment::class, 'options' => [ Loading
module/Evenementiel/config/merged/Inscription.config.php +4 −0 Changes for module/Evenementiel/config/merged/Inscription.config.php: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -32,6 +32,8 @@ use Evenementiel\Form\Inscription\InscriptionParticipantForm; use Evenementiel\Form\Inscription\InscriptionParticipantFormFactory; use Evenementiel\Form\Inscription\InscriptionParticipantHydrator; use Evenementiel\Form\Inscription\InscriptionParticipantHydratorFactory; use Evenementiel\Form\Inscription\InscriptionGroupeForm; use Evenementiel\Form\Inscription\InscriptionGroupeFormFactory; use UnicaenPrivilege\Provider\Rule\PrivilegeRuleProvider; return [ Loading Loading @@ -119,6 +121,7 @@ return [ 'action' => [ 'auto-inscription', 'inscription-en-cours', 'inscription-groupe', ], 'privileges' => [ EvenementielinscriptionPrivileges::AUTOINSCRIPTION, Loading Loading @@ -404,6 +407,7 @@ return [ InscriptionParticipantForm::class => InscriptionParticipantFormFactory::class, InscriptionEtudiantForm::class => InscriptionEtudiantFormFactory::class, InscriptionPersonnelForm::class => InscriptionPersonnelFormFactory::class, InscriptionGroupeForm::class => InscriptionGroupeFormFactory::class, InscriptionPlaceFieldset::class => InscriptionPlaceFieldsetFactory::class, ], ], Loading
module/Evenementiel/src/Assertion/InscriptionAssertion.php +16 −8 Changes for module/Evenementiel/src/Assertion/InscriptionAssertion.php: 16 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -48,30 +48,38 @@ class InscriptionAssertion extends AbstractAssertion case EtudiantRolesProvider::ROLE_ETUDIANT: $etudiantOk = ($inscription->getParticipant()->getEtudiant() === $etudiant); return $etudiantOk && $inscriptionOk && $etatEvenementOk; return $etudiantOk && $inscription->estIndividuelle() && $inscriptionOk && $etatEvenementOk; case PersonnelRolesProvider::ROLE_PERSONNEL: $personnelOk = ($inscription->getParticipant()->getPersonnel() === $personnel); return $personnelOk && $inscriptionOk && $etatEvenementOk; return $personnelOk && $inscription->estIndividuelle() && $inscriptionOk && $etatEvenementOk; case ExterneRolesProvider::ROLE_EXTERNE: $externeOk = ($inscription->getParticipant()->getEmail() === $user->getEmail()); return $externeOk && $inscriptionOk && $etatEvenementOk; return $externeOk && $inscription->estIndividuelle() && $inscriptionOk && $etatEvenementOk; case ExterneRolesProvider::ROLE_GROUPE: $groupeOk = $inscription->estGroupe() && $inscription->getParticipant()->getEmail() === $user->getEmail(); return $groupeOk && $inscriptionOk && $etatEvenementOk; default : return true; return false; } break; case EvenementielinscriptionPrivileges::MODIFIER: switch ($role->getRoleId()) { case EtudiantRolesProvider::ROLE_ETUDIANT: $etudiantOk = ($inscription->getParticipant()->getEtudiant() === $etudiant); return $etudiantOk && $inscriptionOk && $etatEvenementOk; return $etudiantOk && $inscription->estIndividuelle() && $inscriptionOk && $etatEvenementOk; case PersonnelRolesProvider::ROLE_PERSONNEL: $personnelOk = ($inscription->getParticipant()->getPersonnel() === $personnel); return $personnelOk && $inscriptionOk && $etatEvenementOk; return $personnelOk && $inscription->estIndividuelle() && $inscriptionOk && $etatEvenementOk; case ExterneRolesProvider::ROLE_EXTERNE: $externeOk = ($inscription->getParticipant()->getEmail() === $user->getEmail()); return $externeOk && $inscriptionOk && $etatEvenementOk; return $externeOk && $inscription->estIndividuelle() && $inscriptionOk && $etatEvenementOk; case ExterneRolesProvider::ROLE_GROUPE: $groupeOk = $inscription->estGroupe() && $inscription->getParticipant()->getEmail() === $user->getEmail(); return $groupeOk && $inscriptionOk && $etatEvenementOk; default : return true; return false; } break; } Loading
module/Evenementiel/src/Controller/EvenementController.php +84 −5 Changes for module/Evenementiel/src/Controller/EvenementController.php: 84 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ namespace Evenementiel\Controller; use Etudiant\Provider\Role\RolesProvider as EtudiantRolesProvider; use Evenementiel\Form\Inscription\InscriptionPersonnelFormAwareTrait; use Evenementiel\Form\Inscription\InscriptionGroupeFormAwareTrait; use Evenementiel\Form\Notification\NotificationFormAwareTrait; use Personnel\Provider\Role\RolesProvider as PersonnelRolesProvider; use Etudiant\Service\Etudiant\EtudiantServiceAwareTrait; Loading Loading @@ -53,6 +54,7 @@ class EvenementController extends AbstractActionController use MailServiceAwareTrait; use PersonnelServiceAwareTrait; use InscriptionPersonnelFormAwareTrait; use InscriptionGroupeFormAwareTrait; use NotificationFormAwareTrait; /** Loading Loading @@ -358,6 +360,84 @@ class EvenementController extends AbstractActionController /** Ajout d'inscription *******************************************************************************************/ public function inscriptionGroupeGestionnaireAction(): ViewModel|Response { $evenement = $this->getEvenementService()->getRequestedEntity($this); $form = $this->getInscriptionGroupeForm(); $form->setAutoInscriptionMode(false); $form->setAttribute('action', $this->url()->fromRoute('evenementiel/evenement/inscription-groupe-gestionnaire', ['entity' => $evenement->getId()], [], true)); $form->setAttribute('method', 'post'); if ($this->getRequest()->isPost()) { $data = $this->getRequest()->getPost()->toArray(); $form->setData($data); if ($form->isValid()) { try { $participant = $this->getParticipantService()->getParticipant($data['participant']['id'] ?? null); if ($participant === null) { throw new \RuntimeException('Le participant responsable est obligatoire.'); } $this->getInscriptionService()->inscrireGroupe($evenement, $participant, (int)$data['nombrePlacesDemandees']); $this->flashMessenger()->addSuccessMessage("L'inscription du groupe a été créée."); return $this->redirect()->toRoute('evenementiel/evenement/afficher', ['entity' => $evenement->getId()], ['fragment' => 'inscriptions'], true); } catch (\Throwable $exception) { $this->flashMessenger()->addErrorMessage($exception->getMessage()); } } } $vm = new ViewModel(['title' => "Inscription d'un groupe à l'évènement " . $evenement->getLibelle() . " du " . $evenement->getDateToString(), 'form' => $form]); $vm->setTemplate('evenementiel/inscription/modifier-groupe'); return $vm; } public function inscriptionGroupeAction(): ViewModel|Response { $evenement = $this->getEvenementService()->getRequestedEntity($this); $participant = $this->getParticipantService()->getParticipantUsager(); $form = $this->getInscriptionGroupeForm(); $form->setAutoInscriptionMode(true); $form->setAttribute('action', $this->url()->fromRoute('evenementiel/evenement/inscription-groupe', ['entity' => $evenement->getId()], [], true)); $form->setAttribute('method', 'post'); if ($this->getRequest()->isPost()) { $data = $this->getRequest()->getPost()->toArray(); $form->setData($data); if ($form->isValid()) { try { if ($participant === null) { throw new \RuntimeException('Le participant usager est introuvable.'); } $inscription = $this->getInscriptionService()->inscrireGroupe( $evenement, $participant, (int) $data['nombrePlacesDemandees'] ); switch ($inscription->getListe()) { case Inscription::PRINCIPALE: $this->getNotificationService()->triggerListePrincipale($inscription); $this->flashMessenger()->addSuccessMessage("Classement de l'inscription en liste principale."); break; case Inscription::COMPLEMENTAIRE: $this->getNotificationService()->triggerListeComplementaire($inscription); $this->flashMessenger()->addWarningMessage("Liste principale complète. <br/> Classement de l'inscription en liste d'attente."); break; default: $this->flashMessenger()->addErrorMessage("Échec du classement de l'inscription."); break; } exit(); } catch (\Throwable $exception) { $this->flashMessenger()->addErrorMessage($exception->getMessage()); } } } $vm = new ViewModel(['title' => "Inscription de groupe à l'évènement " . $evenement->getLibelle() . " du " . $evenement->getDateToString(), 'form' => $form]); $vm->setTemplate('evenementiel/inscription/modifier-groupe'); return $vm; } public function inscriptionParticipantGestionnaireAction(): ViewModel { $evenement = $this->getEvenementService()->getRequestedEntity($this); Loading Loading @@ -451,7 +531,7 @@ class EvenementController extends AbstractActionController // Vérifier si l'étudiant existe déjà en tant que participant $participant = $this->getParticipantService()->createOrUpdateUsager($etudiant); // verifier si l'inscription existe déjà $existingInscription = $this->getInscriptionService()->inscriptionExists($participant, $evenement); $existingInscription = $this->getInscriptionService()->inscriptionExists($participant, $evenement, Inscription::TYPE_INDIVIDUELLE); if ($existingInscription === null) { $inscription->setParticipant($participant); $this->getInscriptionService()->create($inscription); Loading Loading @@ -522,7 +602,7 @@ class EvenementController extends AbstractActionController // Vérifier si le personnel existe déjà en tant que participant $participant = $this->getParticipantService()->createOrUpdateUsager($personnel); // verifier si l'inscription existe déjà $existingInscription = $this->getInscriptionService()->inscriptionExists($participant, $evenement); $existingInscription = $this->getInscriptionService()->inscriptionExists($participant, $evenement, Inscription::TYPE_INDIVIDUELLE); if ($existingInscription === null) { $inscription->setParticipant($participant); $this->getInscriptionService()->create($inscription); Loading Loading @@ -591,7 +671,7 @@ class EvenementController extends AbstractActionController if ($inscription->getEvenement() !== null && $usager->getEmail() !== null ) { $participant = $this->getParticipantService()->createOrUpdateUsager($usager); $existingInscription = $this->getInscriptionService()->inscriptionExists($participant, $evenement); $existingInscription = $this->getInscriptionService()->inscriptionExists($participant, $evenement, Inscription::TYPE_INDIVIDUELLE); if ($existingInscription !== null) { $existingInscription->dehistoriser(); $existingInscription->setNombrePlacesDemandees($inscription->getNombrePlacesDemandees()); Loading Loading @@ -703,7 +783,7 @@ class EvenementController extends AbstractActionController && $inscription->getEvenement() !== null && $participant->getEmail() !== null ) { $existingInscription = $this->getInscriptionService()->inscriptionExists($participant, $evenement); $existingInscription = $this->getInscriptionService()->inscriptionExists($participant, $evenement, Inscription::TYPE_INDIVIDUELLE); if ($existingInscription !== null) { $existingInscription->dehistoriser(); $existingInscription->setNombrePlacesDemandees($inscription->getNombrePlacesDemandees()); Loading Loading @@ -893,4 +973,3 @@ class EvenementController extends AbstractActionController return $this->redirect()->toRoute("evenementiel/evenement", [], [], true); } }
module/Evenementiel/src/Controller/EvenementControllerFactory.php +3 −1 Changes for module/Evenementiel/src/Controller/EvenementControllerFactory.php: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use Evenementiel\Form\Evenement\EvenementForm; use Evenementiel\Form\Inscription\InscriptionEtudiantForm; use Evenementiel\Form\Inscription\InscriptionParticipantForm; use Evenementiel\Form\Inscription\InscriptionPersonnelForm; use Evenementiel\Form\Inscription\InscriptionGroupeForm; use Evenementiel\Form\Notification\NotificationForm; use Evenementiel\Service\Evenement\EvenementService; use Evenementiel\Service\Inscription\InscriptionService; Loading Loading @@ -64,6 +65,7 @@ class EvenementControllerFactory $inscriptionService = $container->get(InscriptionService::class); $inscriptionEtudiantForm = $container->get('FormElementManager')->get(InscriptionEtudiantForm::class); $inscriptionPersonnelForm = $container->get('FormElementManager')->get(InscriptionPersonnelForm::class); $inscriptionGroupeForm = $container->get('FormElementManager')->get(InscriptionGroupeForm::class); $participantService = $container->get(ParticipantService::class); $etudiantService = $container->get(EtudiantService::class); $userService = $container->get(UserService::class); Loading @@ -84,6 +86,7 @@ class EvenementControllerFactory $controller->setInscriptionService($inscriptionService); $controller->setInscriptionEtudiantForm($inscriptionEtudiantForm); $controller->setInscriptionPersonnelForm($inscriptionPersonnelForm); $controller->setInscriptionGroupeForm($inscriptionGroupeForm); $controller->setParticipantService($participantService); $controller->setEtudiantService($etudiantService); $controller->setUserService($userService); Loading @@ -95,4 +98,3 @@ class EvenementControllerFactory return $controller; } }