Loading CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ Journal des modifications ------ - Compte utilisateur : mapping de la date de création et affichage de celle-ci dans la page de recherche/consultation. - Individu : les comptes utilisateurs liés à un individu sont désormais requêtés du plus récent au plus ancien. - [FIX] Notif 'Validation du dépôt de la thèse corrigée' : l'email du PJ était choisie de façon inappropriée parmi les comptes utilisateurs. - [FIX] Annuaire des thèses inaccessible à certains profils - [FIX] Sessions de formations devenaient invisibles lorsque celles-ci passaient à l'état imminent Loading module/Depot/src/Depot/Notification/ValidationDepotTheseCorrigeeNotification.php +0 −5 Original line number Diff line number Diff line Loading @@ -46,9 +46,4 @@ class ValidationDepotTheseCorrigeeNotification extends Notification return $this; } public function setDestinataire($utilisateur): void { $this->destinataire = $utilisateur; } } No newline at end of file module/Depot/src/Depot/Service/Notification/DepotNotificationFactory.php +1 −4 Original line number Diff line number Diff line Loading @@ -279,7 +279,7 @@ class DepotNotificationFactory extends \Notification\Factory\NotificationFactory /** * Notification pour inviter à valider les corrections. */ public function createNotificationValidationDepotTheseCorrigee(These $these, ?Utilisateur $presidentJury = null): Notification public function createNotificationValidationDepotTheseCorrigee(These $these): Notification { $targetedUrl = $this->urlService->fromRoute( 'these/validation-these-corrigee', ['these' => $these->getId()], ['force_canonical' => true]); $president = $this->getApplicationRoleService()->getRepository()->findOneByCodeAndStructureConcrete(Role::CODE_PRESIDENT_JURY, $these->getEtablissement()); Loading @@ -294,9 +294,6 @@ class DepotNotificationFactory extends \Notification\Factory\NotificationFactory 'these' => $these, 'url' => $url, ]); if ($presidentJury !== null) { $notif->setDestinataire($presidentJury); } return $notif; } Loading module/Depot/src/Depot/Service/These/DepotService.php +46 −33 Original line number Diff line number Diff line Loading @@ -503,47 +503,60 @@ EOS; { $president = $these->getPresidentJury(); if ($president === null) { return ['error', "Aucune action réalisée car aucun aucun président du jury n'a été trouvé pour la thèse."]; return [ 'error', "Aucune action réalisée car aucun Président du jury n'a été déclaré pour la thèse.", ]; } //Recherche de l'utilisateur associé à l'individu $individu = $president->getIndividu(); // Recherche si un compte utilisateur existe pour l'individu président du jury $utilisateurs = $this->getUtilisateurService()->getRepository()->findByIndividu($individu); // Notification directe de l'utilisateur déjà existant if (!empty($utilisateurs)) { $notification = $this->depotNotificationFactory->createNotificationValidationDepotTheseCorrigee($these, end($utilisateurs)); // Un compte utilisateur existe donc pas besoin d'en créer un, on peut envoyer la notif. if (count($utilisateurs) > 0) { $notification = $this->depotNotificationFactory->createNotificationValidationDepotTheseCorrigee($these); $result = $this->notifierService->trigger($notification); return ['success', $result->getSuccessMessages()[0], $result]; return [ 'success', $result->getSuccessMessages()[0], $result, ]; } else { // Recupération du "meilleur" email $email = null; if ($email === null and $president->getIndividu() !== null and $president->getIndividu()->getEmailPro()) $email = $president->getIndividu()->getEmailPro(); if ($email === null and $president->getMembre() !== null and $president->getMembre()->getEmail()) $email = $president->getMembre()->getEmail(); // Création d'un compte utilisateur local $email = $these->getPresidentJuryEmail(); if ($email) { // Creation du compte local puis notification (si mail) // On a trouvé une adresse mail : on est en mesure de créer un compte utilisateur // Creation du compte local puis notification $individu->setEmailPro($email); $username = ($individu->getNomUsuel() ?: $individu->getNomPatronymique()) . "_" . $president->getId(); $user = $this->utilisateurService->createFromIndividu($individu, $username, 'none'); $token = $this->userService->updateUserPasswordResetToken($user); $this->userService->updateUserPasswordResetToken($user); $notification = $this->applicationNotificationFactory->createNotificationInitialisationCompte($user); $this->notifierService->trigger($notification); $notification = $this->depotNotificationFactory->createNotificationValidationDepotTheseCorrigee($these); $result = $this->notifierService->trigger($notification); return ['success', "Création de compte initialisée. " . ($result->getSuccessMessages()[0] ?? '')]; } else { return [ 'success', "Création de compte initialisée pour le Président du jury. " . ($result->getSuccessMessages()[0] ?? ''), ]; } // Echec (si aucun mail, faudra le renseigner dans un membre fictif par exemple) $notif = $this->theseNotificationFactory->createNotificationPasDeMailPresidentJury($these, $president); $result = $this->notifierService->trigger($notif); return ['error', "Aucune action réalisée car aucun email n'a été trouvé. " . ($result->getSuccessMessages()[0] ?? '')]; } } return [ 'error', "Aucune action réalisée car aucune adresse mail n'a été trouvée pour le Président du jury. " . ($result->getSuccessMessages()[0] ?? ''), ]; } /** Loading Loading
CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ Journal des modifications ------ - Compte utilisateur : mapping de la date de création et affichage de celle-ci dans la page de recherche/consultation. - Individu : les comptes utilisateurs liés à un individu sont désormais requêtés du plus récent au plus ancien. - [FIX] Notif 'Validation du dépôt de la thèse corrigée' : l'email du PJ était choisie de façon inappropriée parmi les comptes utilisateurs. - [FIX] Annuaire des thèses inaccessible à certains profils - [FIX] Sessions de formations devenaient invisibles lorsque celles-ci passaient à l'état imminent Loading
module/Depot/src/Depot/Notification/ValidationDepotTheseCorrigeeNotification.php +0 −5 Original line number Diff line number Diff line Loading @@ -46,9 +46,4 @@ class ValidationDepotTheseCorrigeeNotification extends Notification return $this; } public function setDestinataire($utilisateur): void { $this->destinataire = $utilisateur; } } No newline at end of file
module/Depot/src/Depot/Service/Notification/DepotNotificationFactory.php +1 −4 Original line number Diff line number Diff line Loading @@ -279,7 +279,7 @@ class DepotNotificationFactory extends \Notification\Factory\NotificationFactory /** * Notification pour inviter à valider les corrections. */ public function createNotificationValidationDepotTheseCorrigee(These $these, ?Utilisateur $presidentJury = null): Notification public function createNotificationValidationDepotTheseCorrigee(These $these): Notification { $targetedUrl = $this->urlService->fromRoute( 'these/validation-these-corrigee', ['these' => $these->getId()], ['force_canonical' => true]); $president = $this->getApplicationRoleService()->getRepository()->findOneByCodeAndStructureConcrete(Role::CODE_PRESIDENT_JURY, $these->getEtablissement()); Loading @@ -294,9 +294,6 @@ class DepotNotificationFactory extends \Notification\Factory\NotificationFactory 'these' => $these, 'url' => $url, ]); if ($presidentJury !== null) { $notif->setDestinataire($presidentJury); } return $notif; } Loading
module/Depot/src/Depot/Service/These/DepotService.php +46 −33 Original line number Diff line number Diff line Loading @@ -503,47 +503,60 @@ EOS; { $president = $these->getPresidentJury(); if ($president === null) { return ['error', "Aucune action réalisée car aucun aucun président du jury n'a été trouvé pour la thèse."]; return [ 'error', "Aucune action réalisée car aucun Président du jury n'a été déclaré pour la thèse.", ]; } //Recherche de l'utilisateur associé à l'individu $individu = $president->getIndividu(); // Recherche si un compte utilisateur existe pour l'individu président du jury $utilisateurs = $this->getUtilisateurService()->getRepository()->findByIndividu($individu); // Notification directe de l'utilisateur déjà existant if (!empty($utilisateurs)) { $notification = $this->depotNotificationFactory->createNotificationValidationDepotTheseCorrigee($these, end($utilisateurs)); // Un compte utilisateur existe donc pas besoin d'en créer un, on peut envoyer la notif. if (count($utilisateurs) > 0) { $notification = $this->depotNotificationFactory->createNotificationValidationDepotTheseCorrigee($these); $result = $this->notifierService->trigger($notification); return ['success', $result->getSuccessMessages()[0], $result]; return [ 'success', $result->getSuccessMessages()[0], $result, ]; } else { // Recupération du "meilleur" email $email = null; if ($email === null and $president->getIndividu() !== null and $president->getIndividu()->getEmailPro()) $email = $president->getIndividu()->getEmailPro(); if ($email === null and $president->getMembre() !== null and $president->getMembre()->getEmail()) $email = $president->getMembre()->getEmail(); // Création d'un compte utilisateur local $email = $these->getPresidentJuryEmail(); if ($email) { // Creation du compte local puis notification (si mail) // On a trouvé une adresse mail : on est en mesure de créer un compte utilisateur // Creation du compte local puis notification $individu->setEmailPro($email); $username = ($individu->getNomUsuel() ?: $individu->getNomPatronymique()) . "_" . $president->getId(); $user = $this->utilisateurService->createFromIndividu($individu, $username, 'none'); $token = $this->userService->updateUserPasswordResetToken($user); $this->userService->updateUserPasswordResetToken($user); $notification = $this->applicationNotificationFactory->createNotificationInitialisationCompte($user); $this->notifierService->trigger($notification); $notification = $this->depotNotificationFactory->createNotificationValidationDepotTheseCorrigee($these); $result = $this->notifierService->trigger($notification); return ['success', "Création de compte initialisée. " . ($result->getSuccessMessages()[0] ?? '')]; } else { return [ 'success', "Création de compte initialisée pour le Président du jury. " . ($result->getSuccessMessages()[0] ?? ''), ]; } // Echec (si aucun mail, faudra le renseigner dans un membre fictif par exemple) $notif = $this->theseNotificationFactory->createNotificationPasDeMailPresidentJury($these, $president); $result = $this->notifierService->trigger($notif); return ['error', "Aucune action réalisée car aucun email n'a été trouvé. " . ($result->getSuccessMessages()[0] ?? '')]; } } return [ 'error', "Aucune action réalisée car aucune adresse mail n'a été trouvée pour le Président du jury. " . ($result->getSuccessMessages()[0] ?? ''), ]; } /** Loading