Loading config/autoload/unicaen-evenement.global.php +4 −0 Changes for config/autoload/unicaen-evenement.global.php: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -9,7 +9,9 @@ use EntretienProfessionnel\Service\Evenement\RappelCampagneAvancementService; use EntretienProfessionnel\Service\Evenement\RappelEntretienProfessionnelService; use EntretienProfessionnel\Service\Evenement\RappelPasObservationService; use Formation\Event\Convocation\ConvocationEvent; use Formation\Event\DemandeRetour\DemandeRetourEvent; use Formation\Event\InscriptionCloture\InscriptionClotureEvent; use Formation\Event\SessionCloture\SessionClotureEvent; use Formation\Provider\Event\EvenementProvider as FormationEvenementProvider; use Formation\Service\Evenement\NotificationFormationsOuvertesService; use Formation\Service\Evenement\RappelAgentAvantFormationService; Loading @@ -31,6 +33,8 @@ return [ FormationEvenementProvider::RAPPEL_FORMATION_AGENT_AVANT => RappelAgentAvantFormationService::class, FormationEvenementProvider::INSCRIPTION_CLOTURE => InscriptionClotureEvent::class, FormationEvenementProvider::CONVOCATION => ConvocationEvent::class, FormationEvenementProvider::DEMANDE_RETOUR => DemandeRetourEvent::class, FormationEvenementProvider::SESSION_CLOTURE => SessionClotureEvent::class, EntretienProfessionnelEvenementProvider::RAPPEL_CAMPAGNE_AVANCEMENT => RappelCampagneAvancementService::class, EntretienProfessionnelEvenementProvider::RAPPEL_ENTRETIEN_PROFESSIONNEL => RappelEntretienProfessionnelService::class, Loading module/Formation/config/module.config.php +6 −0 Changes for module/Formation/config/module.config.php: 6 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -6,8 +6,12 @@ use Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain; use Doctrine\ORM\Mapping\Driver\XmlDriver; use Formation\Event\Convocation\ConvocationEvent; use Formation\Event\Convocation\ConvocationEventFactory; use Formation\Event\DemandeRetour\DemandeRetourEvent; use Formation\Event\DemandeRetour\DemandeRetourEventFactory; use Formation\Event\DemandeRetour\SessionClotureEventFactory; use Formation\Event\InscriptionCloture\InscriptionClotureEvent; use Formation\Event\InscriptionCloture\InscriptionClotureEventFactory; use Formation\Event\SessionCloture\SessionClotureEvent; use Formation\Provider\Privilege\FormationPrivileges; use Formation\Service\Evenement\NotificationFormationsOuvertesService; use Formation\Service\Evenement\NotificationFormationsOuvertesServiceFactory; Loading Loading @@ -81,6 +85,8 @@ return [ RappelAgentAvantFormationService::class => RappelAgentAvantFormationServiceFactory::class, InscriptionClotureEvent::class => InscriptionClotureEventFactory::class, ConvocationEvent::class => ConvocationEventFactory::class, DemandeRetourEvent::class => DemandeRetourEventFactory::class, SessionClotureEvent::class => SessionClotureEventFactory::class, ], ], 'controllers' => [ Loading module/Formation/src/Formation/Event/DemandeRetour/DemandeRetourEvent.php 0 → 100644 +68 −0 Changes for module/Formation/src/Formation/Event/DemandeRetour/DemandeRetourEvent.php: 68 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Formation\Event\DemandeRetour; use DateInterval; use DateTime; use Exception; use Formation\Provider\Etat\SessionEtats; use Formation\Provider\Event\EvenementProvider; use Formation\Service\FormationInstance\FormationInstanceServiceAwareTrait; use UnicaenApp\Service\EntityManagerAwareTrait; use UnicaenEvenement\Entity\Db\Etat; use UnicaenEvenement\Entity\Db\Evenement; use UnicaenEvenement\Service\Evenement\EvenementService; class DemandeRetourEvent extends EvenementService { use EntityManagerAwareTrait; use FormationInstanceServiceAwareTrait; private ?string $deadline = null; public function setDeadline(string $deadline) { $this->deadline = $deadline; } /** * @param DateTime|null $dateTraitement * @return Evenement */ public function creer(DateTime $dateTraitement = null) : Evenement { $type = $this->getTypeService()->findByCode(EvenementProvider::DEMANDE_RETOUR); $etat = $this->getEtatEvenementService()->findByCode(Etat::EN_ATTENTE); $parametres = [ ]; $description = $type->getDescription(); $evenement = $this->createEvent($description, $description, $etat, $type, $parametres, $dateTraitement); $this->ajouter($evenement); return $evenement; } /** * @param Evenement $evenement * @return string */ public function traiter(Evenement $evenement) : string { $log = ""; $nbSession = 0; try { $sessions = $this->getFormationInstanceService()->getFormationsInstancesByEtat(SessionEtats::ETAT_FORMATION_CONVOCATION); $deadline = (new DateTime())->sub(new DateInterval($this->deadline)); foreach ($sessions as $session) { $dateFin = ($session->getFin() !== null)?DateTime::createFromFormat('d/m/Y', $session->getFin()):null; if ($dateFin < $deadline) { $this->getFormationInstanceService()->demanderRetour($session); $log .= "Traitement de la session ".$session->getInstanceCode()." ".$session->getInstanceLibelle()."<br>"; $nbSession++; } } } catch(Exception $e) { $evenement->setLog($e->getMessage()); return Etat::ECHEC; } $evenement->setLog($nbSession. " session·s traitée·s <br>" . $log); $this->update($evenement); return Etat::SUCCES; } } No newline at end of file module/Formation/src/Formation/Event/DemandeRetour/DemandeRetourEventFactory.php 0 → 100644 +43 −0 Changes for module/Formation/src/Formation/Event/DemandeRetour/DemandeRetourEventFactory.php: 43 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Formation\Event\DemandeRetour; use Doctrine\ORM\EntityManager; use Formation\Provider\Parametre\FormationParametres; use Formation\Service\FormationInstance\FormationInstanceService; use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerInterface; use Psr\Container\NotFoundExceptionInterface; use UnicaenApp\Exception\RuntimeException; use UnicaenParametre\Entity\Db\Parametre; use UnicaenParametre\Service\Parametre\ParametreService; class DemandeRetourEventFactory { /** * @param ContainerInterface $container * @return DemandeRetourEvent * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function __invoke(ContainerInterface $container) : DemandeRetourEvent { /** * @var EntityManager $entityManager * @var FormationInstanceService $sessionService */ $entityManager = $container->get('doctrine.entitymanager.orm_default'); $sessionService = $container->get(FormationInstanceService::class); $event = new DemandeRetourEvent(); $event->setEntityManager($entityManager); $event->setFormationInstanceService($sessionService); /** @var Parametre $deadline */ $deadline = $container->get(ParametreService::class)->getParametreByCode(FormationParametres::TYPE, FormationParametres::AUTO_RETOUR); if ($deadline === null) throw new RuntimeException("Parametre non défini [".FormationParametres::TYPE.",".FormationParametres::AUTO_RETOUR."]"); $event->setDeadline($deadline->getValeur()); return $event; } } No newline at end of file module/Formation/src/Formation/Event/SessionCloture/SessionClotureEvent.php 0 → 100644 +68 −0 Changes for module/Formation/src/Formation/Event/SessionCloture/SessionClotureEvent.php: 68 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Formation\Event\SessionCloture; use DateInterval; use DateTime; use Exception; use Formation\Provider\Etat\SessionEtats; use Formation\Provider\Event\EvenementProvider; use Formation\Service\FormationInstance\FormationInstanceServiceAwareTrait; use UnicaenApp\Service\EntityManagerAwareTrait; use UnicaenEvenement\Entity\Db\Etat; use UnicaenEvenement\Entity\Db\Evenement; use UnicaenEvenement\Service\Evenement\EvenementService; class SessionClotureEvent extends EvenementService { use EntityManagerAwareTrait; use FormationInstanceServiceAwareTrait; private ?string $deadline = null; public function setDeadline(string $deadline) { $this->deadline = $deadline; } /** * @param DateTime|null $dateTraitement * @return Evenement */ public function creer(DateTime $dateTraitement = null) : Evenement { $type = $this->getTypeService()->findByCode(EvenementProvider::SESSION_CLOTURE); $etat = $this->getEtatEvenementService()->findByCode(Etat::EN_ATTENTE); $parametres = [ ]; $description = $type->getDescription(); $evenement = $this->createEvent($description, $description, $etat, $type, $parametres, $dateTraitement); $this->ajouter($evenement); return $evenement; } /** * @param Evenement $evenement * @return string */ public function traiter(Evenement $evenement) : string { $log = ""; $nbSession = 0; try { $sessions = $this->getFormationInstanceService()->getFormationsInstancesByEtat(SessionEtats::ETAT_ATTENTE_RETOURS); $deadline = (new DateTime())->sub(new DateInterval($this->deadline)); foreach ($sessions as $session) { $dateFin = ($session->getFin() !== null)?DateTime::createFromFormat('d/m/Y', $session->getFin()):null; if ($dateFin < $deadline) { $this->getFormationInstanceService()->cloturer($session); $log .= "Traitement de la session ".$session->getInstanceCode()." ".$session->getInstanceLibelle()."<br>"; $nbSession++; } } } catch(Exception $e) { $evenement->setLog($e->getMessage()); return Etat::ECHEC; } $evenement->setLog($nbSession. " session·s traitée·s <br>" . $log); $this->update($evenement); return Etat::SUCCES; } } No newline at end of file Loading
config/autoload/unicaen-evenement.global.php +4 −0 Changes for config/autoload/unicaen-evenement.global.php: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -9,7 +9,9 @@ use EntretienProfessionnel\Service\Evenement\RappelCampagneAvancementService; use EntretienProfessionnel\Service\Evenement\RappelEntretienProfessionnelService; use EntretienProfessionnel\Service\Evenement\RappelPasObservationService; use Formation\Event\Convocation\ConvocationEvent; use Formation\Event\DemandeRetour\DemandeRetourEvent; use Formation\Event\InscriptionCloture\InscriptionClotureEvent; use Formation\Event\SessionCloture\SessionClotureEvent; use Formation\Provider\Event\EvenementProvider as FormationEvenementProvider; use Formation\Service\Evenement\NotificationFormationsOuvertesService; use Formation\Service\Evenement\RappelAgentAvantFormationService; Loading @@ -31,6 +33,8 @@ return [ FormationEvenementProvider::RAPPEL_FORMATION_AGENT_AVANT => RappelAgentAvantFormationService::class, FormationEvenementProvider::INSCRIPTION_CLOTURE => InscriptionClotureEvent::class, FormationEvenementProvider::CONVOCATION => ConvocationEvent::class, FormationEvenementProvider::DEMANDE_RETOUR => DemandeRetourEvent::class, FormationEvenementProvider::SESSION_CLOTURE => SessionClotureEvent::class, EntretienProfessionnelEvenementProvider::RAPPEL_CAMPAGNE_AVANCEMENT => RappelCampagneAvancementService::class, EntretienProfessionnelEvenementProvider::RAPPEL_ENTRETIEN_PROFESSIONNEL => RappelEntretienProfessionnelService::class, Loading
module/Formation/config/module.config.php +6 −0 Changes for module/Formation/config/module.config.php: 6 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -6,8 +6,12 @@ use Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain; use Doctrine\ORM\Mapping\Driver\XmlDriver; use Formation\Event\Convocation\ConvocationEvent; use Formation\Event\Convocation\ConvocationEventFactory; use Formation\Event\DemandeRetour\DemandeRetourEvent; use Formation\Event\DemandeRetour\DemandeRetourEventFactory; use Formation\Event\DemandeRetour\SessionClotureEventFactory; use Formation\Event\InscriptionCloture\InscriptionClotureEvent; use Formation\Event\InscriptionCloture\InscriptionClotureEventFactory; use Formation\Event\SessionCloture\SessionClotureEvent; use Formation\Provider\Privilege\FormationPrivileges; use Formation\Service\Evenement\NotificationFormationsOuvertesService; use Formation\Service\Evenement\NotificationFormationsOuvertesServiceFactory; Loading Loading @@ -81,6 +85,8 @@ return [ RappelAgentAvantFormationService::class => RappelAgentAvantFormationServiceFactory::class, InscriptionClotureEvent::class => InscriptionClotureEventFactory::class, ConvocationEvent::class => ConvocationEventFactory::class, DemandeRetourEvent::class => DemandeRetourEventFactory::class, SessionClotureEvent::class => SessionClotureEventFactory::class, ], ], 'controllers' => [ Loading
module/Formation/src/Formation/Event/DemandeRetour/DemandeRetourEvent.php 0 → 100644 +68 −0 Changes for module/Formation/src/Formation/Event/DemandeRetour/DemandeRetourEvent.php: 68 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Formation\Event\DemandeRetour; use DateInterval; use DateTime; use Exception; use Formation\Provider\Etat\SessionEtats; use Formation\Provider\Event\EvenementProvider; use Formation\Service\FormationInstance\FormationInstanceServiceAwareTrait; use UnicaenApp\Service\EntityManagerAwareTrait; use UnicaenEvenement\Entity\Db\Etat; use UnicaenEvenement\Entity\Db\Evenement; use UnicaenEvenement\Service\Evenement\EvenementService; class DemandeRetourEvent extends EvenementService { use EntityManagerAwareTrait; use FormationInstanceServiceAwareTrait; private ?string $deadline = null; public function setDeadline(string $deadline) { $this->deadline = $deadline; } /** * @param DateTime|null $dateTraitement * @return Evenement */ public function creer(DateTime $dateTraitement = null) : Evenement { $type = $this->getTypeService()->findByCode(EvenementProvider::DEMANDE_RETOUR); $etat = $this->getEtatEvenementService()->findByCode(Etat::EN_ATTENTE); $parametres = [ ]; $description = $type->getDescription(); $evenement = $this->createEvent($description, $description, $etat, $type, $parametres, $dateTraitement); $this->ajouter($evenement); return $evenement; } /** * @param Evenement $evenement * @return string */ public function traiter(Evenement $evenement) : string { $log = ""; $nbSession = 0; try { $sessions = $this->getFormationInstanceService()->getFormationsInstancesByEtat(SessionEtats::ETAT_FORMATION_CONVOCATION); $deadline = (new DateTime())->sub(new DateInterval($this->deadline)); foreach ($sessions as $session) { $dateFin = ($session->getFin() !== null)?DateTime::createFromFormat('d/m/Y', $session->getFin()):null; if ($dateFin < $deadline) { $this->getFormationInstanceService()->demanderRetour($session); $log .= "Traitement de la session ".$session->getInstanceCode()." ".$session->getInstanceLibelle()."<br>"; $nbSession++; } } } catch(Exception $e) { $evenement->setLog($e->getMessage()); return Etat::ECHEC; } $evenement->setLog($nbSession. " session·s traitée·s <br>" . $log); $this->update($evenement); return Etat::SUCCES; } } No newline at end of file
module/Formation/src/Formation/Event/DemandeRetour/DemandeRetourEventFactory.php 0 → 100644 +43 −0 Changes for module/Formation/src/Formation/Event/DemandeRetour/DemandeRetourEventFactory.php: 43 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Formation\Event\DemandeRetour; use Doctrine\ORM\EntityManager; use Formation\Provider\Parametre\FormationParametres; use Formation\Service\FormationInstance\FormationInstanceService; use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerInterface; use Psr\Container\NotFoundExceptionInterface; use UnicaenApp\Exception\RuntimeException; use UnicaenParametre\Entity\Db\Parametre; use UnicaenParametre\Service\Parametre\ParametreService; class DemandeRetourEventFactory { /** * @param ContainerInterface $container * @return DemandeRetourEvent * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function __invoke(ContainerInterface $container) : DemandeRetourEvent { /** * @var EntityManager $entityManager * @var FormationInstanceService $sessionService */ $entityManager = $container->get('doctrine.entitymanager.orm_default'); $sessionService = $container->get(FormationInstanceService::class); $event = new DemandeRetourEvent(); $event->setEntityManager($entityManager); $event->setFormationInstanceService($sessionService); /** @var Parametre $deadline */ $deadline = $container->get(ParametreService::class)->getParametreByCode(FormationParametres::TYPE, FormationParametres::AUTO_RETOUR); if ($deadline === null) throw new RuntimeException("Parametre non défini [".FormationParametres::TYPE.",".FormationParametres::AUTO_RETOUR."]"); $event->setDeadline($deadline->getValeur()); return $event; } } No newline at end of file
module/Formation/src/Formation/Event/SessionCloture/SessionClotureEvent.php 0 → 100644 +68 −0 Changes for module/Formation/src/Formation/Event/SessionCloture/SessionClotureEvent.php: 68 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Formation\Event\SessionCloture; use DateInterval; use DateTime; use Exception; use Formation\Provider\Etat\SessionEtats; use Formation\Provider\Event\EvenementProvider; use Formation\Service\FormationInstance\FormationInstanceServiceAwareTrait; use UnicaenApp\Service\EntityManagerAwareTrait; use UnicaenEvenement\Entity\Db\Etat; use UnicaenEvenement\Entity\Db\Evenement; use UnicaenEvenement\Service\Evenement\EvenementService; class SessionClotureEvent extends EvenementService { use EntityManagerAwareTrait; use FormationInstanceServiceAwareTrait; private ?string $deadline = null; public function setDeadline(string $deadline) { $this->deadline = $deadline; } /** * @param DateTime|null $dateTraitement * @return Evenement */ public function creer(DateTime $dateTraitement = null) : Evenement { $type = $this->getTypeService()->findByCode(EvenementProvider::SESSION_CLOTURE); $etat = $this->getEtatEvenementService()->findByCode(Etat::EN_ATTENTE); $parametres = [ ]; $description = $type->getDescription(); $evenement = $this->createEvent($description, $description, $etat, $type, $parametres, $dateTraitement); $this->ajouter($evenement); return $evenement; } /** * @param Evenement $evenement * @return string */ public function traiter(Evenement $evenement) : string { $log = ""; $nbSession = 0; try { $sessions = $this->getFormationInstanceService()->getFormationsInstancesByEtat(SessionEtats::ETAT_ATTENTE_RETOURS); $deadline = (new DateTime())->sub(new DateInterval($this->deadline)); foreach ($sessions as $session) { $dateFin = ($session->getFin() !== null)?DateTime::createFromFormat('d/m/Y', $session->getFin()):null; if ($dateFin < $deadline) { $this->getFormationInstanceService()->cloturer($session); $log .= "Traitement de la session ".$session->getInstanceCode()." ".$session->getInstanceLibelle()."<br>"; $nbSession++; } } } catch(Exception $e) { $evenement->setLog($e->getMessage()); return Etat::ECHEC; } $evenement->setLog($nbSession. " session·s traitée·s <br>" . $log); $this->update($evenement); return Etat::SUCCES; } } No newline at end of file