Commit 7b1bcef0 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Nouveau template et Notification SOUTENANCE_FEU_VERT

parent bc9ea9b5
Loading
Loading
Loading
Loading
+30 −1
Changes for doc/release-notes/v6.0.7.md: 30 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -28,7 +28,9 @@ INSERT INTO unicaen_renderer_macro (code, description, variable_name, methode_na
('Avis#Justification', null, 'Avis', 'getMotif'),
('String#ToString', null, 'stringelement', 'getTexte'),
('Role#getLibelle', null, 'role', 'getLibelle'),
('Individu#getDenomination', null, 'individu', 'getNomComplet')
('Individu#getDenomination', null, 'individu', 'getNomComplet'),
('Soutenance#Date', '<p>Retourne la date de soutenance inscrite dans la proposition</p>', 'soutenance', 'toStringDateSoutenance'),
('Soutenance#Lieu', '<p>Retourne le lieu inscrit dans la proposition</p>', 'soutenance', 'toStringLieu')
;

-- Nouveaux templates
@@ -112,6 +114,33 @@ INSERT INTO unicaen_renderer_template (code, description, document_type, documen
<li>tous les avis de soutenance de la thèse de VAR[Doctorant#Denomination] ont été rendus ;</li>
<li>vous êtes membre de la direction de la thèse de VAR[Doctorant#Denomination]. <br /><br /></li>
</ul>', null, 'Soutenance\Provider\Template');
INSERT INTO unicaen_renderer_template (code, description, document_type, document_sujet, document_corps, document_css, namespace) VALUES ('DEMANDE_PRERAPPORT', '<p>Courrier électronique envoyé au rapport pour leur demander leur pré-rapport de soutenance</p>', 'mail', 'Demande de l''avis de soutenance de la thèse de VAR[Doctorant#Denomination]', e'<p><em>-- Version française----------------------------------------------------</em><br /><br />Bonjour,</p>
<p>Vous pouvez commencer à examiner les travaux thèse de <strong>VAR[Doctorant#Denomination]</strong> ayant pour titre VAR[These#Titre].</p>
<p>Par la suite, vous devez établir un rapport incluant votre avis sur la soutenance et votre signature au moins 14 jours avant la date de soutenance, puis le déposer sur la plateforme ESUP-SyGAL à l’adresse suivante : VAR[Url#RapporteurDashboard].</p>
<p>Si votre avis est négatif, pourriez-vous indiquer brièvement les raisons de ce choix puis déposer votre rapport.</p>
<p><span style="text-decoration: underline;">Rappel :</span> <strong>Le rapport est attendu pour le VAR[Soutenance#DateRetourRapport].</strong><br />Au delà de cette date, vous ne pourrez plus rendre votre rapport.</p>
<p>Cordialement,</p>
<p><em>-- English version -----------------------------------------------------</em><br /><br />Dear Mrs/Mr,</p>
<p>Since you have signed the "impartiality commitment", you can start the evaluation of the PhD thesis presented by <strong>VAR[Doctorant#Denomination]</strong>, entitled VAR[These#Titre].<br />Then, you must give your opinion about the PhD thesis and upload your signed PhD report at least 14 days before the date of the PhD defense at : VAR[Url#RapporteurDashboard].</p>
<p>In case of a negative opinion, please indicate briefly the main reasons for the rejection and upload your signed PhD report.</p>
<p><strong>Keep in mind that your report must be uploaded before VAR[Soutenance#DateRetourRapport].</strong><br />After the deadline, you won\'t be able to upload your report.</p>
<p>Best regards,</p>
<p> </p>', null, 'Soutenance\Provider\Template');
INSERT INTO unicaen_renderer_template (code, description, document_type, document_sujet, document_corps, document_css, namespace) VALUES ('SOUTENANCE_FEU_VERT', null, 'mail', 'La soutenance de VAR[Doctorant#Denomination] a été acceptée par votre établissement.', e'<p>Bonjour,</p>
<p>La soutenance de VAR[Doctorant#Denomination] a été acceptée par votre établissement.<br />Conformément aux informations que vous avez fournies celle-ci se tiendra le VAR[Soutenance#Date] dans VAR[Soutenance#Lieu].</p>
<p>Vous pouvez consulter les rapports de pré-soutenance sur en bas de la page de la proposition de soutenance : VAR[Url#SoutenanceProposition]</p>
<p><em>-- Justification ---------------------------------------------------------------------------</em></p>
<p>Vous avez reçu ce mail car :</p>
<ul>
<li>la maison du doctorat vient de donner son feu vert pour la soutenance</li>
<li>vous êtes soit :<br />
<ul>
<li>un·e acteur·trice direct·e de la thèse de  VAR[Doctorant#Denomination] ;</li>
<li>un·e responsable de l\'école de doctorale gérant la thèse ;</li>
<li>un·e responsable de l\'unité de recherche encadrant la thèse.</li>
</ul>
</li>
</ul>', null, 'Soutenance\Provider\Template');



+2 −7
Changes for module/Soutenance/src/Soutenance/Controller/PresoutenanceController.php: 2 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -332,11 +332,8 @@ class PresoutenanceController extends AbstractController
        foreach ($rapporteurs as $rapporteur) {
            $hasRapport = ($this->getAvisService()->getAvisByMembre($rapporteur) !== null);
            if ($hasRapport === false) {
                $token = $this->getMembreService()->retrieveOrCreateToken($rapporteur);
                $url_rapporteur = $this->url()->fromRoute("soutenance/index-rapporteur", ['these' => $these->getId()], ['force_canonical' => true], true);
                $url = $this->url()->fromRoute('zfcuser/login', ['type' => 'token'], ['query' => ['token' => $token->getToken(), 'redirect' => $url_rapporteur, 'role' => $rapporteur->getActeur()->getRole()->getRoleId()], 'force_canonical' => true], true);
                try {
                    $notif = $this->soutenanceNotificationFactory->createNotificationDemandeAvisSoutenance($these, $proposition, $rapporteur, $url);
                    $notif = $this->soutenanceNotificationFactory->createNotificationDemandeAvisSoutenance($these, $rapporteur);
                    $this->notifierService->trigger($notif);
                } catch (\Notification\Exception\RuntimeException $e) {
                    // aucun destinataire, todo : cas à gérer !
@@ -380,10 +377,8 @@ class PresoutenanceController extends AbstractController
        $proposition->setEtat($etat);
        $this->getPropositionService()->update($proposition);

        $avis = $this->getAvisService()->getAvisByThese($these);

        try {
            $notif = $this->soutenanceNotificationFactory->createNotificationFeuVertSoutenance($these, $proposition, $avis);
            $notif = $this->soutenanceNotificationFactory->createNotificationFeuVertSoutenance($these);
            $this->notifierService->trigger($notif);
        } catch (\Notification\Exception\RuntimeException $e) {
            // aucun destinataire, todo : cas à gérer !
+17 −1
Changes for module/Soutenance/src/Soutenance/Entity/Proposition.php: 17 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -390,7 +390,23 @@ class Proposition implements HistoriqueAwareInterface, HasHorodatagesInterface {
    public function toStringDateRetourRapport() : string
    {
        $date = $this->getRenduRapport();
        if ($date) return $date->format('d/M/Y');
        if ($date) return $date->format('d/m/Y');
        return "<span style='color:darkorange;'>Aucune date de rendu de précisée</span>";
    }

    /** @noinspection  PhpUnused */
    public function toStringDateSoutenance() : string
    {
        $date = $this->getDate();
        if ($date) return $date->format('d/m/Y');
        return "<span style='color:darkorange;'>Aucune date de rendu de précisée</span>";
    }

    /** @noinspection  PhpUnused */
    public function toStringLieu() : string
    {
        $lieu = $this->getLieu();
        if ($lieu) return $lieu;
        return "<span style='color:darkorange;'>Aucun lieu de précisé</span>";
    }
}
 No newline at end of file
+2 −0
Changes for module/Soutenance/src/Soutenance/Provider/Template/MailTemplates.php: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -25,7 +25,9 @@ class MailTemplates
    const ANNULATION_ENGAGEMENT_IMPARTIALITE            = 'ANNULATION_ENGAGEMENT_IMPARTIALITE';

    const CONNEXION_RAPPORTEUR                          = 'CONNEXION_RAPPORTEUR';
    const DEMANDE_PRERAPPORT                            = 'DEMANDE_PRERAPPORT';
    const DEMANDE_RAPPORT_SOUTENANCE                    = 'DEMANDE_RAPPORT_SOUTENANCE';
    const SOUTENANCE_AVIS_FAVORABLE                     = 'SOUTENANCE_AVIS_FAVORABLE';
    const SOUTENANCE_AVIS_DEFAVORABLE                   = 'SOUTENANCE_AVIS_DEFAVORABLE';
    const SOUTENANCE_FEU_VERT                           = 'SOUTENANCE_FEU_VERT';
}
 No newline at end of file
+22 −36
Changes for module/Soutenance/src/Soutenance/Service/Notification/SoutenanceNotificationFactory.php: 22 added lines, 36 removed lines.
Original line number Diff line number Diff line
@@ -406,62 +406,48 @@ class SoutenanceNotificationFactory extends NotificationFactory

    /**************************** présoutenance ***************************/

    /**
     * TODO
     */
    public function createNotificationDemandeAvisSoutenance(These $these, Proposition $proposition, Membre $rapporteur, string $url): Notification
    public function createNotificationDemandeAvisSoutenance(These $these, Membre $rapporteur): Notification
    {
        $email = $rapporteur->getEmail();
        if ($email === null) {
            throw new RuntimeException("Aucune adresse mail trouvée pour la notification [" . MailTemplates::DEMANDE_PRERAPPORT . "] la thèse {$these->getId()}");
        }

        if ($email !== null) {
        $vars = ['these' => $these, 'doctorant' => $these->getDoctorant(), 'rapporteur' => $rapporteur];
        $url = $this->getUrlService()->setVariables($vars);
        $vars['Url'] = $url;

        $rendu = $this->getRenduService()->generateRenduByTemplateCode(MailTemplates::DEMANDE_PRERAPPORT, $vars);
        $notif = new Notification();
        $notif
                ->setSubject("Demande de l'avis de soutenance de la thèse de " . $these->getDoctorant()->getIndividu())
            ->setSubject($rendu->getSujet())
            ->setTo($email)
                ->setTemplatePath('soutenance/notification/demande-avis-soutenance')
                ->setTemplateVariables([
                    'these' => $these,
                    'proposition' => $proposition,
                    'membre' => $rapporteur,
                    'url' => $url,
                ]);

            ->setBody($rendu->getCorps());
        return $notif;
        } else {
            throw new RuntimeException("Aucun mail de disponible (" . __METHOD__ . "::TheseId#" . $these->getId() . ")");
        }
    }

    /**
     * TODO
     */
    public function createNotificationFeuVertSoutenance($these, $proposition, $avis): Notification
    public function createNotificationFeuVertSoutenance(These $these): Notification
    {
        $emailsActeurs = $this->emailTheseService->fetchEmailActeursDirects($these);
        $emailsED = $this->emailTheseService->fetchEmailEcoleDoctorale($these);
        $emailsUR = $this->emailTheseService->fetchEmailUniteRecherche($these);
        $emails = array_merge($emailsActeurs, $emailsED, $emailsUR);

        $emails = array_filter($emails, function ($s) {
            return $s !== null;
        });
        if (empty($emails)) {
            throw new RuntimeException("Aucune adresse mail trouvée pour la notification [" . MailTemplates::SOUTENANCE_FEU_VERT . "] la thèse {$these->getId()}");
        }

        if (!empty($emails)) {
        $vars = ['these' => $these, 'doctorant' => $these->getDoctorant()];
        $url = $this->getUrlService()->setVariables($vars);
        $vars['Url'] = $url;

        $rendu = $this->getRenduService()->generateRenduByTemplateCode(MailTemplates::DEMANDE_PRERAPPORT, $vars);
        $notif = new Notification();
        $notif
                ->setSubject("La soutenance de " . $these->getDoctorant()->getIndividu() . " a été acceptée par votre établissement.")
            ->setSubject($rendu->getSujet())
            ->setTo($emails)
                ->setTemplatePath('soutenance/notification/feu-vert-soutenance')
                ->setTemplateVariables([
                    'these' => $these,
                    'proposition' => $proposition,
                    'avis' => $avis,
                ]);

            ->setBody($rendu->getCorps());
        return $notif;
        } else {
            throw new RuntimeException("Aucun mail de disponible (" . __METHOD__ . "::TheseId#" . $these->getId() . ")");
        }
    }

    /**
Loading