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

Notification 'DEMANDE_ENGAGEMENT_IMPARTIALITE' via unicaen-renderer

parent 9e6be249
Loading
Loading
Loading
Loading
+5 −6
Changes for composer.lock: 5 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -10104,26 +10104,25 @@
        },
        {
            "name": "unicaen/renderer",
            "version": "5.0.3",
            "version": "5.0.5",
            "source": {
                "type": "git",
                "url": "https://git.unicaen.fr/lib/unicaen/renderer.git",
                "reference": "2fac10cd89dbd5d36a64411f7e44df9ca9a831c8"
                "reference": "15e07cff3dbb4f3a083bb5af245fc1cc5acc92af"
            },
            "require": {
                "laminas/laminas-dependency-plugin": "^2.1",
                "unicaen/app": "^5.0",
                "php": "^7.0",
                "unicaen/privilege": "^5.0"
            },
            "type": "library",
            "autoload": {
                "psr-0": [],
                "classmap": [
                    "./Module.php"
                ]
            },
            "description": "Module de rendu de texte avec templates et macros",
            "time": "2022-09-16T14:21:27+00:00"
            "time": "2023-01-20T19:42:17+00:00"
        },
        {
            "name": "unicaen/zfc-user",
@@ -12098,5 +12097,5 @@
        "ext-zip": "*"
    },
    "platform-dev": [],
    "plugin-api-version": "2.3.0"
    "plugin-api-version": "2.1.0"
}
+11 −1
Changes for doc/release-notes/v5.2.9.md: 11 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -15,4 +15,14 @@ git fetch --tags && git checkout --force 5.2.9 && bash ./install.sh

## 2. Dans la base de données

RAS
 No newline at end of file
```sql
-- MAJ RENDERER --------------------
alter table unicaen_renderer_template  add namespace varchar(256);

-- MACROS --------------------------


-- TEMPLATES -----------------------


```
 No newline at end of file
+2 −2
Changes for module/Soutenance/src/Soutenance/Controller/EngagementImpartialiteController.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ class EngagementImpartialiteController extends AbstractController
                    $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' => $membre->getActeur()->getRole()->getRoleId()], 'force_canonical' => true], true);
                    try {
                        $notif = $this->soutenanceNotificationFactory->createNotificationDemandeSignatureEngagementImpartialite($these, $proposition, $membre, $url);
                        $notif = $this->soutenanceNotificationFactory->createNotificationDemandeSignatureEngagementImpartialite($these, $membre);
                        $this->notifierService->trigger($notif);
                    } catch (RuntimeException $e) {
                        // aucun destintaire, todo : cas à gérer !
@@ -101,7 +101,7 @@ class EngagementImpartialiteController extends AbstractController
            $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' => $membre->getActeur()->getRole()->getRoleId()], 'force_canonical' => true], true);
            try {
                $notif = $this->soutenanceNotificationFactory->createNotificationDemandeSignatureEngagementImpartialite($these, $proposition, $membre, $url);
                $notif = $this->soutenanceNotificationFactory->createNotificationDemandeSignatureEngagementImpartialite($these, $membre);
                $this->notifierService->trigger($notif);
            } catch (RuntimeException $e) {
                // aucun destintaire, todo : cas à gérer !
+3 −0
Changes for module/Soutenance/src/Soutenance/Provider/Template/MailTemplates.php: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -5,4 +5,7 @@ namespace Soutenance\Provider\Template;
class MailTemplates
{
    const TRANSMETTRE_DOCUMENTS_DIRECTION = "TRANSMETTRE_DOCUMENTS_DIRECTION";

    /** ENGAGEMENT D'IMPARTIALITE *************************************************************************************/
    const DEMANDE_ENGAGEMENT_IMPARTIALITE = 'DEMANDE_ENGAGEMENT_IMPARTIALITE';
}
 No newline at end of file
+13 −18
Changes for module/Soutenance/src/Soutenance/Service/Notification/SoutenanceNotificationFactory.php: 13 added lines, 18 removed lines.
Original line number Diff line number Diff line
@@ -345,33 +345,28 @@ class SoutenanceNotificationFactory extends NotificationFactory

    /**
     * @param These $these
     * @param Proposition $proposition
     * @param Membre $membre
     * @param string $url
     * @return \Notification\Notification
     */
    public function createNotificationDemandeSignatureEngagementImpartialite(These $these, Proposition $proposition, Membre $membre, string $url): Notification
    public function createNotificationDemandeSignatureEngagementImpartialite(These $these, Membre $membre): Notification
    {
        $email = $membre->getEmail();
        $vars = ['these' => $these, 'doctorant' => $these->getDoctorant(), 'rapporteur' => $membre];
        $url = $this->getUrlService()->setVariables($vars);
        $vars['Url'] = $url;

        $rendu = $this->getRenduService()->generateRenduByTemplateCode(MailTemplates::DEMANDE_ENGAGEMENT_IMPARTIALITE, $vars);
        $mail = $membre->getEmail();
        if ($mail === null) {
            throw new RuntimeException("Aucun mail trouvé pour le rapporteur");
        }

        if ($email !== null) {
        $notif = new Notification();
        $notif
                ->setSubject("Demande de signature de l'engagement d'impartialité de la thèse de " . $these->getDoctorant()->getIndividu())
                ->setTo($email)
                ->setTemplatePath('soutenance/notification/engagement-impartialite-demande')
                ->setTemplateVariables([
                    'these' => $these,
                    'proposition' => $proposition,
                    'membre' => $membre,
                    'url' => $url,
                ]);
            ->setSubject($rendu->getSujet())
            ->setTo($mail)
            ->setBody($rendu->getCorps());

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

    }

    /**
Loading