Skip to content
Snippets Groups Projects
Commit c06e4686 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

7.2.2

parent 715602f5
No related branches found
No related tags found
No related merge requests found
Pipeline #36029 passed
7.2.2
-----
- Correction du bug lié à la réexpédition d'un mail
- Ajout d'une action pour controler la configuration du module
7.2.1
-----
- Bug Fixe pour les actions console
......
......@@ -56,6 +56,7 @@ return array(
[
'controller' => MailController::class,
'action' => [
'afficher-configuration',
'supprimer',
],
'privileges' => [
......@@ -122,6 +123,16 @@ return array(
],
],
],
'afficher-configuration' => [
'type' => Literal::class,
'options' => [
'route' => '/afficher-configuration',
'defaults' => [
/** @see MailController::afficherConfigurationAction() */
'action' => 'afficher-configuration',
],
],
],
],
],
],
......
......@@ -26,6 +26,16 @@ class MailController extends AbstractActionController
}
public function afficherConfigurationAction(): ViewModel
{
$config = $this->getMailService()->getConfig();
return new ViewModel([
'title' => 'Configuration du module',
'config' => $config,
]);
}
public function afficherAction(): ViewModel
{
$mail = $this->getMailService()->getRequestedMail($this);
......
......@@ -2,8 +2,8 @@
namespace UnicaenMail\Controller;
use Interop\Container\ContainerInterface;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
use UnicaenMail\Service\Mail\MailService;
......@@ -11,8 +11,6 @@ class MailControllerFactory
{
/**
* @param ContainerInterface $container
* @return MailController
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
......
......@@ -77,6 +77,10 @@ EOS;
$this->config = $config;
}
public function getConfig(): array
{
return $this->config;
}
public function createMailEntity(): object
{
......@@ -356,9 +360,9 @@ EOS;
$precedenteDateEnvoi = $mail->getDateEnvoi();
$supplement = "<p><strong>Ce courrier électronique est une ré-expédition du courrier envoyé initialement le " . $precedenteDateEnvoi->format('d/m/Y à H:i') . "</strong></p>";
//todo les pieces jointes
$nMail = $this->sendMail($mail->getDestinataires(), $mail->getSujet(), $mail->getCorps(), null, null, null, $supplement);
$nMail = $this->sendMail($mail->getDestinataires(), $mail->getSujet(), ($supplement. $mail->getCorps()), null, $mail->getAttachmentPaths(), $mail->getReplyTo());
$nMail->setMotsClefs(explode(Mail::MOTCLEF_SEPARATEUR, $mail->getMotsClefs()));
$nMail->setCorps($mail->getCorps());
$this->update($nMail);
return $mail;
......
......@@ -3,8 +3,8 @@
namespace UnicaenMail\Service\Mail;
use Doctrine\ORM\EntityManager;
use Interop\Container\ContainerInterface;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
use Symfony\Component\Mailer\Mailer;
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
......
<?php
/**
* @see \UnicaenMail\Controller\MailController::afficherConfigurationAction()
* @var array $config
*/
?>
<?php foreach ($config as $key => $value): ?>
<h2> <?php echo $key; ?> </h2>
<?php var_dump($value); ?>
<?php endforeach; ?>
......@@ -14,6 +14,7 @@ $this->headTitle($title);
$canTest = $this->isAllowed(MailPrivileges::getResourceId(MailPrivileges::MAIL_AFFICHER));
$canAfficherConfiguration = $this->isAllowed(MailPrivileges::getResourceId(MailPrivileges::MAIL_SUPPRIMER));
?>
......@@ -23,11 +24,22 @@ $canTest = $this->isAllowed(MailPrivileges::getResourceId(MailPrivileges::MAIL_A
<div class="row mb-3">
<div class="col-md-12">
<?php if ($canTest): ?>
<?php /** @see \UnicaenMail\Controller\MailController::testAction() */ ?>
<a href="<?php echo $this->url('mail/test', [], [], true); ?>"
class="btn btn-primary action ajax-modal" data-event="modification">
class="btn btn-primary ajax-modal" data-event="modification">
<span class="icon icon-notifier"></span>
Envoi d'un mail de test
</a>
<?php endif; ?>
<?php if ($canAfficherConfiguration) : ?>
<?php /** @see \UnicaenMail\Controller\MailController::afficherConfigurationAction() */ ?>
<a href="<?php echo $this->url('mail/afficher-configuration', [], [], true); ?>"
class="btn btn-secondary ajax-modal">
<span class="icon icon-gerer"></span>
Vérification de la configuration
</a>
<?php endif; ?>
</div>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment