Commit 72fea37d authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Utilisation des parametres de session de formation

parent dad6417c
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -448,6 +448,8 @@ class FormationInstance implements HistoriqueAwareInterface, HasSourceInterface,
        $this->coutTtc = $coutTtc;
    }

    /** PARAMETRES ***************************************************************************************************/

    public function getParametre(): ?SessionParametre
    {
        return $this->parametre;
@@ -458,6 +460,24 @@ class FormationInstance implements HistoriqueAwareInterface, HasSourceInterface,
        $this->parametre = $parametre;
    }

    public function isMailActive() : bool
    {
        if ($this->parametre === null) return true;
        return $this->parametre->isMailActive();
    }

    public function isEvenementActive() : bool
    {
        if ($this->parametre === null) return true;
        return $this->parametre->isEvenementActive();
    }

    public function isEnqueteActive() : bool
    {
        if ($this->parametre === null) return true;
        return $this->parametre->isEnqueteActive();
    }

    /** PREDICAT D'ETAT *********************************************************************************************/

    public function estPreparation() : bool
+7 −5
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ class ConvocationEvent extends EvenementService
            $sessions = $this->getFormationInstanceService()->getFormationsInstancesByEtat(SessionEtats::ETAT_INSCRIPTION_FERMEE);
            $deadline = (new DateTime())->sub(new DateInterval($this->deadline));
            foreach ($sessions as $session) {
                if ($session->isEvenementActive()) {
                    $dateDebut = ($session->getDebut() !== null) ? DateTime::createFromFormat('d/m/Y', $session->getDebut()) : null;
                    if ($dateDebut >= $deadline) {
                        $this->getFormationInstanceService()->envoyerConvocation($session);
@@ -61,6 +62,7 @@ class ConvocationEvent extends EvenementService
                        $convocations[] = $session;
                    }
                }
            }
            $this->getNotificationService()->triggerNotifierConvocationAutomatique($convocations);
        } catch(Exception $e) {
            $evenement->setLog($e->getMessage());
+7 −5
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ class DemandeRetourEvent extends EvenementService
            $sessions = $this->getFormationInstanceService()->getFormationsInstancesByEtat(SessionEtats::ETAT_FORMATION_CONVOCATION);
            $deadline = (new DateTime())->sub(new DateInterval($this->deadline));
            foreach ($sessions as $session) {
                if ($session->isEvenementActive()) {
                    $dateFin = ($session->getFin() !== null) ? DateTime::createFromFormat('d/m/Y', $session->getFin()) : null;
                    if ($dateFin < $deadline) {
                        $this->getFormationInstanceService()->demanderRetour($session);
@@ -57,6 +58,7 @@ class DemandeRetourEvent extends EvenementService
                        $nbSession++;
                    }
                }
            }
        } catch(Exception $e) {
            $evenement->setLog($e->getMessage());
            return Etat::ECHEC;
+7 −5
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ class InscriptionClotureEvent extends EvenementService
            $sessions = $this->getFormationInstanceService()->getFormationsInstancesByEtat(SessionEtats::ETAT_INSCRIPTION_OUVERTE);
            $deadline = (new DateTime())->sub(new DateInterval($this->deadline));
            foreach ($sessions as $session) {
                if ($session->isEvenementActive()) {
                    $dateDebut = ($session->getDebut() !== null) ? DateTime::createFromFormat('d/m/Y', $session->getDebut()) : null;
                    if ($dateDebut >= $deadline) {
                        $this->getFormationInstanceService()->fermerInscription($session);
@@ -61,6 +62,7 @@ class InscriptionClotureEvent extends EvenementService
                        $closes[] = $session;
                    }
                }
            }
            $this->getNotificationService()->triggerNotifierInscriptionClotureAutomatique($closes);
        } catch(Exception $e) {
            $evenement->setLog($e->getMessage());
+7 −5
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ class SessionClotureEvent extends EvenementService
            $sessions = $this->getFormationInstanceService()->getFormationsInstancesByEtat(SessionEtats::ETAT_ATTENTE_RETOURS);
            $deadline = (new DateTime())->sub(new DateInterval($this->deadline));
            foreach ($sessions as $session) {
                if ($session->isEvenementActive()) {
                    $dateFin = ($session->getFin() !== null) ? DateTime::createFromFormat('d/m/Y', $session->getFin()) : null;
                    if ($dateFin < $deadline) {
                        $this->getFormationInstanceService()->cloturer($session);
@@ -57,6 +58,7 @@ class SessionClotureEvent extends EvenementService
                        $nbSession++;
                    }
                }
            }
        } catch(Exception $e) {
            $evenement->setLog($e->getMessage());
            return Etat::ECHEC;
Loading