Commit 6a72ef72 by Yvon

send mail to tresorier as well

parent f201d4ee
...@@ -7,6 +7,7 @@ namespace App\Command; ...@@ -7,6 +7,7 @@ namespace App\Command;
use App\Entity\Flux; use App\Entity\Flux;
use App\Entity\GlobalParameter; use App\Entity\GlobalParameter;
use App\Entity\Prestataire; use App\Entity\Prestataire;
use App\Entity\User;
use App\Utils\CustomEntityManager; use App\Utils\CustomEntityManager;
use App\Utils\OperationUtils; use App\Utils\OperationUtils;
use IntlDateFormatter; use IntlDateFormatter;
...@@ -71,10 +72,18 @@ class SendCcasTransactionsExportToPrestatairesCommand extends Command ...@@ -71,10 +72,18 @@ class SendCcasTransactionsExportToPrestatairesCommand extends Command
$this->io->text('Envoi du mail pour le prestataire ' . $p->getRaison()); $this->io->text('Envoi du mail pour le prestataire ' . $p->getRaison());
$subject = "Expérimentation de Sécurité Sociale de l’Alimentation en Gironde – Facture CCAS $monthYearStr"; $subject = "Expérimentation de Sécurité Sociale de l’Alimentation en Gironde – Facture CCAS $monthYearStr";
$globalParamRepo = $this->em->getRepository(GlobalParameter::class); $globalParamRepo = $this->em->getRepository(GlobalParameter::class);
//Send to prestataire
//Send copy to tresoriers + gestionnaire de groupe (or default contact if linked gestionnaire de groupe does not exists)
$copyTo = array();
$users = $this->em->getRepository(User::class)->findByRole('ROLE_TRESORIER');
foreach ($users as $userTresorier) {
$copyTo[] = $userTresorier->getEmail();
}
$copyTo[] = $globalParamRepo->getMailOfGestionnaireDeGroupeOrDefaultContact($p);
$mail = (new \Swift_Message($subject)) $mail = (new \Swift_Message($subject))
->setFrom($globalParamRepo->val(GlobalParameter::MLC_NOTIF_EMAIL)) ->setFrom($globalParamRepo->val(GlobalParameter::MLC_NOTIF_EMAIL))
->setTo($p->getGestionnairesEmailsArray()) ->setTo($p->getGestionnairesEmailsArray())
->setCc($globalParamRepo->getMailOfGestionnaireDeGroupeOrDefaultContact($p)) ->setCc($copyTo)
->setBody( ->setBody(
$this->templating->render( $this->templating->render(
'@kohinos/email/tav/ccas_transactions.html.twig', '@kohinos/email/tav/ccas_transactions.html.twig',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment