Loading module/Application/src/Application/Controller/IndicateurController.php +20 Changes for module/Application/src/Application/Controller/IndicateurController.php: 20 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ use Application\Service\Traits\NotificationIndicateurServiceAwareTrait; use Application\Filter\IntervenantEmailFormatter; use Application\Service\Traits\PeriodeServiceAwareTrait; use Application\Service\Traits\TypeVolumeHoraireServiceAwareTrait; use Zend\Form\Element\Checkbox; use Zend\Router\Http\TreeRouteStack; use Zend\View\Renderer\PhpRenderer; use Exception; Loading Loading @@ -230,6 +231,7 @@ class IndicateurController extends AbstractController $form->add((new Text('nombre'))->setValue(count($emails))); $form->add((new Text('subject'))->setValue($subject)); $form->add((new Textarea('body'))->setValue($body)); $form->add((new Checkbox('copy'))->setValue(1)); $form->add((new Hidden('intervenants'))->setValue($intervenantsStringIds)); $form->getInputFilter()->get('subject')->setRequired(true); $form->getInputFilter()->get('body')->setRequired(true); Loading @@ -238,6 +240,13 @@ class IndicateurController extends AbstractController $post = $this->getRequest()->getPost(); if ($form->setData($post)->isValid()) { $mailer->send($emails, $post); if($post['copy']) { //envoi une copie du mail à l'utilisateur si il l'a demandé $utilisateur = $this->getServiceContext()->getUtilisateur(); $emailUtilisateur[ $utilisateur->getEmail()] = $utilisateur->getDisplayName(); $mailer->sendCopyEmail($emailUtilisateur, $post); } $count = count($intervenants); $pluriel = $count > 1 ? 's' : ''; $this->flashMessenger()->addSuccessMessage("Le mail a été envoyé à $count intervenant$pluriel"); Loading Loading @@ -455,4 +464,15 @@ class IndicateurIntervenantsMailer return $html; } public function sendCopyEmail($emails, $data) { $message = $this->createMessage($data); $message->setSubject('COPIE | ' . $data['subject']); foreach($emails as $email => $name) { $message->setTo($email, $name); } $this->controller->mail()->send($message); } } module/Application/view/application/indicateur/envoi-mail-intervenants.phtml +2 Changes for module/Application/view/application/indicateur/envoi-mail-intervenants.phtml: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ echo $this->form()->openTag($this->form->setAttribute('id', 'mail-form')); </div> <?= $this->formControlGroup($this->form->get('subject')->setLabel("Objet du mail")) ?> <?= $this->formControlGroup($this->form->get('body')->setLabel("Corps du mail")->setAttributes(['rows' => 15, 'id' => 'body'])) ?> <?= $this->formControlGroup($this->form->get('copy')->setLabel("Recevoir une copie de l'email envoyé")) ?> <?php if (!empty($sansMail)): ?> <div class="alert alert-warning"> Loading Loading
module/Application/src/Application/Controller/IndicateurController.php +20 Changes for module/Application/src/Application/Controller/IndicateurController.php: 20 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ use Application\Service\Traits\NotificationIndicateurServiceAwareTrait; use Application\Filter\IntervenantEmailFormatter; use Application\Service\Traits\PeriodeServiceAwareTrait; use Application\Service\Traits\TypeVolumeHoraireServiceAwareTrait; use Zend\Form\Element\Checkbox; use Zend\Router\Http\TreeRouteStack; use Zend\View\Renderer\PhpRenderer; use Exception; Loading Loading @@ -230,6 +231,7 @@ class IndicateurController extends AbstractController $form->add((new Text('nombre'))->setValue(count($emails))); $form->add((new Text('subject'))->setValue($subject)); $form->add((new Textarea('body'))->setValue($body)); $form->add((new Checkbox('copy'))->setValue(1)); $form->add((new Hidden('intervenants'))->setValue($intervenantsStringIds)); $form->getInputFilter()->get('subject')->setRequired(true); $form->getInputFilter()->get('body')->setRequired(true); Loading @@ -238,6 +240,13 @@ class IndicateurController extends AbstractController $post = $this->getRequest()->getPost(); if ($form->setData($post)->isValid()) { $mailer->send($emails, $post); if($post['copy']) { //envoi une copie du mail à l'utilisateur si il l'a demandé $utilisateur = $this->getServiceContext()->getUtilisateur(); $emailUtilisateur[ $utilisateur->getEmail()] = $utilisateur->getDisplayName(); $mailer->sendCopyEmail($emailUtilisateur, $post); } $count = count($intervenants); $pluriel = $count > 1 ? 's' : ''; $this->flashMessenger()->addSuccessMessage("Le mail a été envoyé à $count intervenant$pluriel"); Loading Loading @@ -455,4 +464,15 @@ class IndicateurIntervenantsMailer return $html; } public function sendCopyEmail($emails, $data) { $message = $this->createMessage($data); $message->setSubject('COPIE | ' . $data['subject']); foreach($emails as $email => $name) { $message->setTo($email, $name); } $this->controller->mail()->send($message); } }
module/Application/view/application/indicateur/envoi-mail-intervenants.phtml +2 Changes for module/Application/view/application/indicateur/envoi-mail-intervenants.phtml: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ echo $this->form()->openTag($this->form->setAttribute('id', 'mail-form')); </div> <?= $this->formControlGroup($this->form->get('subject')->setLabel("Objet du mail")) ?> <?= $this->formControlGroup($this->form->get('body')->setLabel("Corps du mail")->setAttributes(['rows' => 15, 'id' => 'body'])) ?> <?= $this->formControlGroup($this->form->get('copy')->setLabel("Recevoir une copie de l'email envoyé")) ?> <?php if (!empty($sansMail)): ?> <div class="alert alert-warning"> Loading