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

preparation de la notification

parent ab87206f
Loading
Loading
Loading
Loading
+4 −4
Changes for module/Application/src/Application/Controller/FichierTheseController.php: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -498,10 +498,10 @@ class FichierTheseController extends AbstractController

        if ($notifier) {
            $destinataires = $notifier;
//            $notif = $this->notifierService->getNotificationFactory()->createNotificationForRetraitementFini($destinataires, $fichierRetraite, $validite);
//            $this->notifierService->trigger($notif);
//            echo "Destinataires du courriel envoyé: " . $notif->getTo();
//            echo PHP_EOL;
            $notif = $this->notifierService->getNotificationFactory()->createNotificationFusionFini($destinataires, $outputFilePath);
            $this->notifierService->trigger($notif);
            echo "Destinataires du courriel envoyé: " . $notif->getTo();
            echo PHP_EOL;
        }

        $this->eventRouterReplacer->restoreEventRouter();
+15 −15
Changes for module/Application/src/Application/Controller/TheseController.php: 15 added lines, 15 removed lines.
Original line number Diff line number Diff line
@@ -1473,20 +1473,20 @@ class TheseController extends AbstractController
            // erreur prévue
        }

//        /** Retourner un PDF ...  */
//        $contenu     = file_get_contents($outputFilePath);
//        $content     = is_resource($contenu) ? stream_get_contents($contenu) : $contenu;
//
//        header('Content-Description: File Transfer');
//        header('Content-Type: ' . 'application/pdf');
//        header('Content-Disposition: attachment; filename=' . trim(strrchr($outputFilePath, '/'), '/'));
//        header('Content-Transfer-Encoding: binary');
//        header('Content-Length: ' . strlen($content));
//        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
//        header('Expires: 0');
//        header('Pragma: public');
//
//        echo $content;
//        exit;
        /** Retourner un PDF ...  */
        $contenu     = file_get_contents($outputFilePath);
        $content     = is_resource($contenu) ? stream_get_contents($contenu) : $contenu;

        header('Content-Description: File Transfer');
        header('Content-Type: ' . 'application/pdf');
        header('Content-Disposition: attachment; filename=' . trim(strrchr($outputFilePath, '/'), '/'));
        header('Content-Transfer-Encoding: binary');
        header('Content-Length: ' . strlen($content));
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Expires: 0');
        header('Pragma: public');

        echo $content;
        exit;
    }
}
 No newline at end of file
+2 −0
Changes for module/Application/src/Application/Service/Fichier/FichierService.php: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -809,5 +809,7 @@ class FichierService extends BaseService
        $runner = new ShellScriptRunner($scriptPath, 'bash');
        $runner->setAsync();
        $runner->run($args);


    }
}
 No newline at end of file
+26 −0
Changes for module/Application/src/Application/Service/Notification/NotificationFactory.php: 26 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -503,4 +503,30 @@ class NotificationFactory extends \Notification\Service\NotificationFactory
    {
        $this->appModuleOptions = $options;
    }

    /**
     * Notifie que le retraitement automatique du fichier PDF est terminé.
     *
     * @param string $destinataires Emails séparés par une virgule
     * @param string $outputFilePath Chemin vers le fichier stocké en local
     * @param ValiditeFichier|null $validite Résultat du test d'archivabilité éventuel
     * @return Notification
     * @return Notification
     */
    public function createNotificationFusionFini($destinataires, $outputFilePath)
    {
        $to = array_map('trim', explode(',', $destinataires));

        $notif = $this->createNotification();
        $notif
            ->setSubject("Retraitement terminé")
            ->setTo($to)
            ->setTemplatePath('application/these/mail/notif-fusion-fini')
            ->setTemplateVariables([
                'outputFilePath' => $outputFilePath,
                'url' => '',
            ]);

        return $notif;
    }
}
 No newline at end of file
+27 −0
Changes for module/Application/view/application/these/mail/notif-fusion-fini.phtml: 27 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

use Application\Entity\Db\Fichier;
use Application\Entity\Db\ValiditeFichier;
use Application\View\Renderer\PhpRenderer;

/**
 * @var PhpRenderer $this
 * @var Fichier $fichierRetraite
 * @var string $outputFilePath
 * @var string $url
 */
?>

<p>
    Bonjour,
</p>
<p>
    Ceci est un mail envoyé automatiquement par l'application <?php echo $this->appInfos()->nom ?>.
</p>
<p>
    L'ajout de la page de couverture est maintenant terminé.
</p>
<p>
    <?php $url = $this->urlThese()->setForceCanonical()->telechargerFusion($outputFilePath) ?>
    Cliquez <a href="<?php echo $url ?>">ici</a> pour accéder à la page correspondante au téléchargement de votre manuscrit.
</p>
 No newline at end of file