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

Nouveau template et Notification SOUTENANCE_STOP_DEMARCHE

parent 7b1bcef0
Loading
Loading
Loading
Loading
+1 −1
Changes for module/Soutenance/src/Soutenance/Controller/PresoutenanceController.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -405,7 +405,7 @@ class PresoutenanceController extends AbstractController
                $this->getPropositionService()->update($proposition);

                try {
                    $notif = $this->soutenanceNotificationFactory->createNotificationStopperDemarcheSoutenance($these, $proposition);
                    $notif = $this->soutenanceNotificationFactory->createNotificationStopperDemarcheSoutenance($these);
                    $this->notifierService->trigger($notif);
                } catch (\Notification\Exception\RuntimeException $e) {
                    // aucun destinataire, todo : cas à gérer !
+1 −0
Changes for module/Soutenance/src/Soutenance/Provider/Template/MailTemplates.php: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -30,4 +30,5 @@ class MailTemplates
    const SOUTENANCE_AVIS_FAVORABLE                     = 'SOUTENANCE_AVIS_FAVORABLE';
    const SOUTENANCE_AVIS_DEFAVORABLE                   = 'SOUTENANCE_AVIS_DEFAVORABLE';
    const SOUTENANCE_FEU_VERT                           = 'SOUTENANCE_FEU_VERT';
    const SOUTENANCE_STOP_DEMARCHE                      = 'SOUTENANCE_STOP_DEMARCHE';
}
 No newline at end of file
+11 −18
Changes for module/Soutenance/src/Soutenance/Service/Notification/SoutenanceNotificationFactory.php: 11 added lines, 18 removed lines.
Original line number Diff line number Diff line
@@ -450,35 +450,28 @@ class SoutenanceNotificationFactory extends NotificationFactory
        return $notif;
    }

    /**
     * TODO
     */
    public function createNotificationStopperDemarcheSoutenance($these, $proposition): Notification
    public function createNotificationStopperDemarcheSoutenance($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_STOP_DEMARCHE . "] la thèse {$these->getId()}");
        }

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

        if (!empty($emails)) {
        $rendu = $this->getRenduService()->generateRenduByTemplateCode(MailTemplates::SOUTENANCE_STOP_DEMARCHE, $vars);
        $notif = new Notification();
        $notif
                ->setSubject("Les démarches de soutenance de " . $these->getDoctorant()->getIndividu() . " ont été stoppées par la maison du doctorats de votre établissement.")
            ->setSubject($rendu->getSujet())
            ->setTo($emails)
                ->setTemplatePath('soutenance/notification/stopper-demarche-soutenance')
                ->setTemplateVariables([
                    'these' => $these,
                    'proposition' => $proposition,
                ]);

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

    /** Mail concernants les rapporteur·trices ************************************************************************/
+0 −70
Changes for module/Soutenance/view/soutenance/notification/stopper-demarche-soutenance.phtml: 0 added lines, 70 removed lines.
Original line number Diff line number Diff line
<?php

use These\Entity\Db\These;
use Application\View\Renderer\PhpRenderer;
use Soutenance\Entity\Avis;
use Soutenance\Entity\Proposition;

/**
 * @see \Soutenance\Service\Notification\SoutenanceNotificationFactory::createNotificationStopperDemarcheSoutenance()
 *
 * @var PhpRenderer $this
 * @var These $these
 * @var Proposition $proposition
 * @var Avis[] $avis
 * @var bool $justification
 */

?>

<p>
    Bonjour,
</p>
<p>
    Les démarches associées à la soutenance de <?php echo $these->getDoctorant()->getIndividu(); ?> ont été stoppé par la maison du doctorats de votre établissement.
    Veuillez consulter celle-ci pour obtenir plus d'information.
</p>
<p>
    Vous pouvez consulter les rapports de présoutenance en utilisant les liens suivant :
</p>
<ul>
    <?php foreach ($avis as $avi) : ?>
        <?php $url = $this->url('fichier/these/telecharger', [
            'these'      => $these->getId(),
            'fichier'    => $avi->getFichier()->getUuid(),
            'fichierNom' => $avi->getFichier()->getNom(),
        ], [
            'force_canonical'=>true
        ],true);
        ?>
    <li>
        <?php echo  $avi->getRapporteur(); ?>
        :

        <a href="<?php echo $url; ?>">
            rapport de pré-soutenance
        </a>
    </li>
    <?php endforeach; ?>
</ul>

<?php
//    $emailsActeurs      = $this->fetchEmailActeursDirects($these);
//    $emailsED           = $this->fetchEmailEcoleDoctorale($these);
//    $emailsUR           = $this->fetchEmailUniteRecherche($these);
?>
<?php if ($justification) : ?>
    <p>
        Vous avez reçu ce mail car :
    <ol>
        <li> la soutenance de thèse de <?php echo $these->getDoctorant()->getIndividu()->getNomComplet(); ?> ne peut pas avoit lieu dans l'état actuel ;</li>
        <li> vous êtes :
            <ul>
                <li> un des acteurs directs de la thèse de <?php echo $these->getDoctorant()->getIndividu()->getNomComplet(); ?>, </li>
                <li> un&middot;e responsable de l'école de doctorale gérant la thèse, </li>
                <li> un&middot;e responsable de l'unité de recherche encadrant la thèse. </li>
            </ul>
        </li>
    </ol>
    </p>
<?php endif; ?>