Loading module/Atelier/src/Entity/Db/Seance.php +7 −3 Original line number Diff line number Diff line Loading @@ -155,7 +155,10 @@ class Seance implements HistoriqueAwareInterface public function isPremiereSeance(): bool { $session = $this->getSession(); return ($session->getSeances() === null OR $session->getSeances() === [] OR $this->getDateTimeDebut()->format('d/m/Y H:i') === $session->getDebut()); $premiere = $session->getPremiereSeance(); $res = ($session->getSeances() === null OR $session->getSeances() === [] OR $this->getDateTimeDebut() <= $premiere->getDateTimeDebut()); return $res; } public function isDerniereSeance(): bool Loading @@ -163,8 +166,9 @@ class Seance implements HistoriqueAwareInterface $session = $this->getSession(); $derniere = $session->getDerniereSeance(); if ($derniere === null) return true; return ($session->getSeances() === null OR $session->getSeances() === [] OR $derniere->getDateTimeFin() >= $session->getDateTimeFin()); $res = ($session->getSeances() === null OR $session->getSeances() === [] OR $this->getDateTimeFin() >= $derniere->getDateTimeFin()); return $res; } Loading module/Atelier/src/Entity/Db/Session.php +21 −0 Original line number Diff line number Diff line Loading @@ -204,6 +204,27 @@ class Session implements HistoriqueAwareInterface, HasEtatsInterface, HasEveneme return $maximum; } public function getDateTimeDebut(bool $datetime = false): string|DateTime|null { $minimum = null; foreach ($this->seances as $seance) { if ($seance->estNonHistorise()) { if ($seance->getType() === Seance::TYPE_SEANCE) { $date = $seance->getDateTimeDebut(); if ($date !== null and ($minimum === null or $date < $minimum)) $minimum = $date; } if ($seance->getType() === Seance::TYPE_VOLUME) { if ($seance->getVolumeFin()) { $debut = $seance->getVolumeDebut(); if ($minimum === null or $debut < $minimum) $minimum = $debut; } } } } if ($minimum === null) return null; if ($datetime) return $minimum; return $minimum->format('d/m/Y H:i'); } public function getDateTimeFin(bool $datetime = false): string|DateTime|null { Loading module/Atelier/src/Event/ConvoquerSession/ConvoquerSessionEvenement.php +4 −4 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ class ConvoquerSessionEvenement extends EvenementService public function creer(Session $session, DateTime $dateTraitement = null) : Evenement { $type = $this->getTypeService()->findByCode(SessionEvenements::CLOTURER_EVENEMENT); $type = $this->getTypeService()->findByCode(SessionEvenements::CONVOQUER_EVENEMENT); $etat = $this->getEtatEvenementService()->findByCode(Etat::EN_ATTENTE); $parametres = [ Loading @@ -48,8 +48,8 @@ class ConvoquerSessionEvenement extends EvenementService $session = $this->getSessionService()->getSession($parametres['session']); if ($session AND $session->estNonHistorise() AND $session->getEtatActif() AND $session->getEtatActif()->getType()->getCode() === SessionEtats::ETAT_ATTENTE_RETOURS) { $this->getSessionService()->cloturer($session); AND $session->getEtatActif() AND $session->getEtatActif()->getType()->getCode() === SessionEtats::ETAT_INSCRIPTION_FERMEE) { $this->getSessionService()->envoyerConvocation($session); $log = "Session #".$session->getId()." ".$session->getAtelier()->getLibelle()." : Convocation "; } Loading Loading @@ -89,7 +89,7 @@ class ConvoquerSessionEvenement extends EvenementService } } if (!$dateTraitement instanceof DateTime) { throw new RuntimeException("La date de traitement de l'evenement [".SessionEvenements::CLOTURER_EVENEMENT."] n'a pas pu être déterminée."); throw new RuntimeException("La date de traitement de l'evenement [".SessionEvenements::CONVOQUER_EVENEMENT."] n'a pas pu être déterminée."); } $event = $this->creer($session, $dateTraitement); $session->addEvenement($event); Loading module/Atelier/src/Event/RetourSession/RetourSessionEvenement.php +1 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ class RetourSessionEvenement extends EvenementService { //NETTOYAGE $evenements = $session->getEvenements()->toArray(); $evenements = array_filter($evenements, function (Evenement $e) { return $e->getType()->getCode() === SessionEvenements::CLOTURER_EVENEMENT;}); $evenements = array_filter($evenements, function (Evenement $e) { return $e->getType()->getCode() === SessionEvenements::RETOUR_EVENEMENT;}); foreach ($evenements as $evenement) { $session->removeEvenement($evenement); $this->getSessionService()->update($session); Loading module/Atelier/src/Service/Seance/SeanceService.php +3 −1 Original line number Diff line number Diff line Loading @@ -164,6 +164,7 @@ class SeanceService $message = ""; $session = $seance->getSession(); if ($seance->isPremiereSeance() OR $seance->isDerniereSeance()) $message .= "<strong>Modification des événements </strong><br><br>"; if ($seance->isPremiereSeance()) { $message .= "<strong>Modification de la première séance</strong><br>"; $event = $this->getConvoquerSessionEvenement()->updateEvent($session); Loading Loading @@ -191,8 +192,9 @@ class SeanceService $message .= "Plus de séance : retrait de la cloture automatique"; } $message .= "<br>"; $flashMessenger?->addInfoMessage($message); } if ($seance->isPremiereSeance() OR $seance->isDerniereSeance()) $flashMessenger?->addInfoMessage($message); } } No newline at end of file Loading
module/Atelier/src/Entity/Db/Seance.php +7 −3 Original line number Diff line number Diff line Loading @@ -155,7 +155,10 @@ class Seance implements HistoriqueAwareInterface public function isPremiereSeance(): bool { $session = $this->getSession(); return ($session->getSeances() === null OR $session->getSeances() === [] OR $this->getDateTimeDebut()->format('d/m/Y H:i') === $session->getDebut()); $premiere = $session->getPremiereSeance(); $res = ($session->getSeances() === null OR $session->getSeances() === [] OR $this->getDateTimeDebut() <= $premiere->getDateTimeDebut()); return $res; } public function isDerniereSeance(): bool Loading @@ -163,8 +166,9 @@ class Seance implements HistoriqueAwareInterface $session = $this->getSession(); $derniere = $session->getDerniereSeance(); if ($derniere === null) return true; return ($session->getSeances() === null OR $session->getSeances() === [] OR $derniere->getDateTimeFin() >= $session->getDateTimeFin()); $res = ($session->getSeances() === null OR $session->getSeances() === [] OR $this->getDateTimeFin() >= $derniere->getDateTimeFin()); return $res; } Loading
module/Atelier/src/Entity/Db/Session.php +21 −0 Original line number Diff line number Diff line Loading @@ -204,6 +204,27 @@ class Session implements HistoriqueAwareInterface, HasEtatsInterface, HasEveneme return $maximum; } public function getDateTimeDebut(bool $datetime = false): string|DateTime|null { $minimum = null; foreach ($this->seances as $seance) { if ($seance->estNonHistorise()) { if ($seance->getType() === Seance::TYPE_SEANCE) { $date = $seance->getDateTimeDebut(); if ($date !== null and ($minimum === null or $date < $minimum)) $minimum = $date; } if ($seance->getType() === Seance::TYPE_VOLUME) { if ($seance->getVolumeFin()) { $debut = $seance->getVolumeDebut(); if ($minimum === null or $debut < $minimum) $minimum = $debut; } } } } if ($minimum === null) return null; if ($datetime) return $minimum; return $minimum->format('d/m/Y H:i'); } public function getDateTimeFin(bool $datetime = false): string|DateTime|null { Loading
module/Atelier/src/Event/ConvoquerSession/ConvoquerSessionEvenement.php +4 −4 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ class ConvoquerSessionEvenement extends EvenementService public function creer(Session $session, DateTime $dateTraitement = null) : Evenement { $type = $this->getTypeService()->findByCode(SessionEvenements::CLOTURER_EVENEMENT); $type = $this->getTypeService()->findByCode(SessionEvenements::CONVOQUER_EVENEMENT); $etat = $this->getEtatEvenementService()->findByCode(Etat::EN_ATTENTE); $parametres = [ Loading @@ -48,8 +48,8 @@ class ConvoquerSessionEvenement extends EvenementService $session = $this->getSessionService()->getSession($parametres['session']); if ($session AND $session->estNonHistorise() AND $session->getEtatActif() AND $session->getEtatActif()->getType()->getCode() === SessionEtats::ETAT_ATTENTE_RETOURS) { $this->getSessionService()->cloturer($session); AND $session->getEtatActif() AND $session->getEtatActif()->getType()->getCode() === SessionEtats::ETAT_INSCRIPTION_FERMEE) { $this->getSessionService()->envoyerConvocation($session); $log = "Session #".$session->getId()." ".$session->getAtelier()->getLibelle()." : Convocation "; } Loading Loading @@ -89,7 +89,7 @@ class ConvoquerSessionEvenement extends EvenementService } } if (!$dateTraitement instanceof DateTime) { throw new RuntimeException("La date de traitement de l'evenement [".SessionEvenements::CLOTURER_EVENEMENT."] n'a pas pu être déterminée."); throw new RuntimeException("La date de traitement de l'evenement [".SessionEvenements::CONVOQUER_EVENEMENT."] n'a pas pu être déterminée."); } $event = $this->creer($session, $dateTraitement); $session->addEvenement($event); Loading
module/Atelier/src/Event/RetourSession/RetourSessionEvenement.php +1 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ class RetourSessionEvenement extends EvenementService { //NETTOYAGE $evenements = $session->getEvenements()->toArray(); $evenements = array_filter($evenements, function (Evenement $e) { return $e->getType()->getCode() === SessionEvenements::CLOTURER_EVENEMENT;}); $evenements = array_filter($evenements, function (Evenement $e) { return $e->getType()->getCode() === SessionEvenements::RETOUR_EVENEMENT;}); foreach ($evenements as $evenement) { $session->removeEvenement($evenement); $this->getSessionService()->update($session); Loading
module/Atelier/src/Service/Seance/SeanceService.php +3 −1 Original line number Diff line number Diff line Loading @@ -164,6 +164,7 @@ class SeanceService $message = ""; $session = $seance->getSession(); if ($seance->isPremiereSeance() OR $seance->isDerniereSeance()) $message .= "<strong>Modification des événements </strong><br><br>"; if ($seance->isPremiereSeance()) { $message .= "<strong>Modification de la première séance</strong><br>"; $event = $this->getConvoquerSessionEvenement()->updateEvent($session); Loading Loading @@ -191,8 +192,9 @@ class SeanceService $message .= "Plus de séance : retrait de la cloture automatique"; } $message .= "<br>"; $flashMessenger?->addInfoMessage($message); } if ($seance->isPremiereSeance() OR $seance->isDerniereSeance()) $flashMessenger?->addInfoMessage($message); } } No newline at end of file