Commit dbb02cfc by Yvon Kerdoncuff

always send ccas mail to mlc_contact_email

parent fe5e0cde
......@@ -79,7 +79,9 @@ class SendCcasTransactionsExportToPrestatairesCommand extends Command
foreach ($users as $userTresorier) {
$copyTo[] = $userTresorier->getEmail();
}
$copyTo[] = $globalParamRepo->getMailOfGestionnaireDeGroupeOrDefaultContact($p);
foreach ($globalParamRepo->getMailOfGestionnaireDeGroupeAndDefaultContact($p) as $copyToEmail) {
$copyTo[] = $copyToEmail;
}
$mail = (new \Swift_Message($subject))
->setFrom($globalParamRepo->val(GlobalParameter::MLC_NOTIF_EMAIL))
->setTo($p->getGestionnairesEmailsArray())
......
......@@ -59,4 +59,15 @@ class GlobalParameterRepository extends ServiceEntityRepository
return $gestionnaires->first()->getEmail();
}
}
public function getMailOfGestionnaireDeGroupeAndDefaultContact($presta)
{
$emails = [];
$emails[] = $this->val(GlobalParameter::MLC_CONTACT_EMAIL);
$gestionnaires = $presta->getGroupe()->getGestionnaires();
if ($gestionnaires && !$gestionnaires->isEmpty() && $gestionnaires->first()->getEmail()) {
$emails[] = $gestionnaires->first()->getEmail();
}
return $emails;
}
}
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