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

Parametrage Notifier service

parent 0dbef8ea
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -5,6 +5,8 @@ namespace Application\Service\Notification;
use Application\Service\Agent\AgentService;
use Application\Service\Url\UrlService;
use Interop\Container\ContainerInterface;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use UnicaenMail\Service\Mail\MailService;
use UnicaenParametre\Service\Parametre\ParametreService;
use UnicaenRenderer\Service\Rendu\RenduService;
@@ -12,6 +14,10 @@ use UnicaenRenderer\Service\Rendu\RenduService;
class NotificationServiceFactory
{

    /**
     * @throws NotFoundExceptionInterface
     * @throws ContainerExceptionInterface
     */
    public function __invoke(ContainerInterface $container): NotificationService
    {
        /**
@@ -27,6 +33,13 @@ class NotificationServiceFactory
        $renduService = $container->get(RenduService::class);
        $urlService = $container->get(UrlService::class);

        $config = $container->get('Configuration')['unicaen-mail'];
        if (isset($config['redirect_to'])) $mailService->setRedirectTo($config['redirect_to']);
        if (isset($config['do_not_send'])) $mailService->setDoNotSend($config['do_not_send']);
        if (isset($config['subject_prefix'])) $mailService->setSubjectPrefix($config['subject_prefix']);
        if (isset($config['from_name'])) $mailService->setFromName($config['from_name']);
        if (isset($config['from_email'])) $mailService->setFromEmail($config['from_email']);

        $service = new NotificationService();
        $service->setAgentService($agentService);
        $service->setMailService($mailService);
+8 −1
Original line number Diff line number Diff line
@@ -24,7 +24,14 @@ use Application\Entity\Db\Agent;
                <ul>
                    <?php foreach ($affectations as $affectation) : ?>
                        <li>
                            <?php if ($affectation->getStructure()) : ?>
                                <?php echo $affectation->getStructure()->getLibelleCourt(); ?>
                            <?php else : ?>
                                <span class="text-warning">
                                    <span class="icon icon-attention"></span>
                                    Aucune structure d'affectation
                                </span>
                            <?php endif; ?>
                        </li>
                    <?php endforeach; ?>
                </ul>
+13 −0
Original line number Diff line number Diff line
@@ -6,6 +6,8 @@ use Application\Service\Agent\AgentService;
use EntretienProfessionnel\Service\Campagne\CampagneService;
use EntretienProfessionnel\Service\Url\UrlService;
use Interop\Container\ContainerInterface;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Structure\Service\Structure\StructureService;
use UnicaenMail\Service\Mail\MailService;
use UnicaenParametre\Service\Parametre\ParametreService;
@@ -14,6 +16,10 @@ use UnicaenRenderer\Service\Rendu\RenduService;
class NotificationServiceFactory
{

    /**
     * @throws NotFoundExceptionInterface
     * @throws ContainerExceptionInterface
     */
    public function __invoke(ContainerInterface $container): NotificationService
    {
        /**
@@ -33,6 +39,13 @@ class NotificationServiceFactory
        $structureService = $container->get(StructureService::class);
        $urlService = $container->get(UrlService::class);

        $config = $container->get('Configuration')['unicaen-mail'];
        if (isset($config['redirect_to'])) $mailService->setRedirectTo($config['redirect_to']);
        if (isset($config['do_not_send'])) $mailService->setDoNotSend($config['do_not_send']);
        if (isset($config['subject_prefix'])) $mailService->setSubjectPrefix($config['subject_prefix']);
        if (isset($config['from_name'])) $mailService->setFromName($config['from_name']);
        if (isset($config['from_email'])) $mailService->setFromEmail($config['from_email']);

        $service = new NotificationService();
        $service->setAgentService($agentService);
        $service->setCampagneService($campagneService);
+1 −1
Original line number Diff line number Diff line
@@ -88,7 +88,7 @@ return [
             * Adresses des redirections si do_not_send est à true
             */
            'redirect_to' => ['jean-philippe.metivier@unicaen.fr', ],
            'do_not_send' => true,
            'do_not_send' => false,

            'subject_prefix' => 'Mes formations (test)',
            'from_name' => 'mes-formations.unicaen.fr | Application de gestion des formations du personnel',