Commit 32aeaad7 authored by Stefan Busemann's avatar Stefan Busemann
Browse files

[BUGFIX] Add right parameters for function getRenderedBody

parent df388433
......@@ -16,9 +16,12 @@ namespace TYPO3\Election\Utility;
use TYPO3\CMS\Core\Mail\MailMessage;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\Election\Domain\Model\Configuration;
use TYPO3\Election\Domain\Model\ElectionCircular;
use TYPO3\Election\Domain\Model\ElectionInvitation;
use TYPO3\Election\Domain\Model\Elector;
use TYPO3\Election\Domain\Repository\ElectionInvitationRepository;
/**
* Class MailUtility
......@@ -40,13 +43,24 @@ class MailUtility
$mail->setSubject($electionCircular->getSubject());
$mail->setFrom([$configuration->getFromEmail() => $configuration->getFromName()]);
$electionInvitation = new ElectionInvitation();
$electionInvitation->setElector($elector);
$electionInvitation->setElectionCircular($electionCircular);
$electionInvitation->setSecret(GeneralUtility::getRandomHexString(mt_rand(180, 220)));
$electionInvitationRepository = GeneralUtility::makeInstance(ObjectManager::class)->get(ElectionInvitationRepository::class);
$electionInvitationRepository->add($electionInvitation);
$electionInvitationRepository->persistAll();
if ($configuration->isDebug()) {
$mail->setTo([$configuration->getTestEmail() => $elector->getFullName()]);
} else {
$mail->setTo([$elector->getEmail() => $elector->getFullName()]);
}
$mail->setBody($electionCircular->getRenderedBody($elector));
$mail->setBody($electionCircular->getRenderedBody($configuration, $electionInvitation));
return $mail->send() === 1;
}
}
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