diff --git a/module/Formation/src/Formation/Controller/SeanceController.php b/module/Formation/src/Formation/Controller/SeanceController.php index 967965b7a64d35e11e51e16fe60d74173a6809e1..72ee77fc7962c64b2d3bd4712a097b1a5f8b977e 100644 --- a/module/Formation/src/Formation/Controller/SeanceController.php +++ b/module/Formation/src/Formation/Controller/SeanceController.php @@ -151,12 +151,14 @@ class SeanceController extends AbstractActionController public function gererEvenement(Seance $seance): void { - if ($seance->isPremiereSeance()) { + $first = $seance->isPremiereSeance(); + $last = $seance->isDerniereSeance(); + if ($first) { $this->getInscriptionClotureEvent()->updateEvent($seance); $this->getConvocationEvent()->updateEvent($seance); $this->getRappelAgentEvent()->updateEvent($seance); } - if ($seance->isDerniereSeance()) { + if ($last) { $this->getDemandeRetourEvent()->updateEvent($seance); $this->getSessionClotureEvent()->updateEvent($seance); } diff --git a/module/Formation/src/Formation/Entity/Db/Seance.php b/module/Formation/src/Formation/Entity/Db/Seance.php index fd11532bc90dd087071ab63016a49940b8830bd7..c8e9044cee8db658cecf0e9747c7b79d7523a60e 100644 --- a/module/Formation/src/Formation/Entity/Db/Seance.php +++ b/module/Formation/src/Formation/Entity/Db/Seance.php @@ -149,7 +149,7 @@ class Seance implements HistoriqueAwareInterface, HasSourceInterface $asString = $this->getJour()->format('d/m/Y') . " " . $this->getFin(); return DateTime::createFromFormat('d/m/Y H:i', $asString); case Seance::TYPE_VOLUME : - $asString = $this->getVolumeFin()->format('d/m/Y') . " 08:00"; + $asString = $this->getVolumeFin()->format('d/m/Y') . " 18:00"; return DateTime::createFromFormat('d/m/Y H:i', $asString); } throw new RuntimeException("Le type de seance est inconnu"); @@ -222,7 +222,11 @@ class Seance implements HistoriqueAwareInterface, HasSourceInterface public function isDerniereSeance(): bool { $session = $this->getInstance(); - $res = ($session->getSeances() === null OR $session->getSeances() === [] OR $this->getDateFin()->format('d/m/Y H:i') === $session->getFin()); + $isNull = ($session->getSeances() === null); + $isEmpty = ($session->getSeances() === []); + $isLast = ($this->getDateFin()->format('d/m/Y H:i') === $session->getFin()); + + $res = ($isNull OR $isEmpty OR $isLast); return $res; }