feat: additional email notifications
This commit is contained in:
@@ -53,8 +53,9 @@ class EmailNotificationSubscriber implements EventSubscriberInterface
|
||||
public function onDocumentUploaded(DocumentUploadedEvent $event): void
|
||||
{
|
||||
$document = $event->getDocument();
|
||||
$documentType = $document->getType();
|
||||
|
||||
if (Upload::TYPE_INVOICE === $document->getType()) {
|
||||
if (in_array($documentType, [Upload::TYPE_INVOICE, Upload::TYPE_CONTRACT])) {
|
||||
$disposition = $document->getDisposition();
|
||||
$hotelCode = $disposition
|
||||
->getAssignment()
|
||||
@@ -67,16 +68,25 @@ class EmailNotificationSubscriber implements EventSubscriberInterface
|
||||
->getUsersByRoleAndHotelCode('ROLE_MANAGER', $hotelCode)
|
||||
;
|
||||
|
||||
if (Upload::TYPE_INVOICE === $documentType) {
|
||||
$subject = 'Honorarnote hochgeladen';
|
||||
$template = 'email/invoice_uploaded.html.twig';
|
||||
} else {
|
||||
$subject = 'Honorarvertrag hochgeladen';
|
||||
$template = 'email/contract_uploaded.html.twig';
|
||||
}
|
||||
|
||||
foreach ($managers as $manager) {
|
||||
if (true === $manager->isMuteNotifications()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->mailer->createAndSendEmail([
|
||||
'disposition' => $disposition,
|
||||
], [
|
||||
'to' => $manager->getEmail(),
|
||||
'subject' => 'Honorarnote hochgeladen',
|
||||
'template' => 'email/invoice_uploaded.html.twig',
|
||||
'subject' => $subject,
|
||||
'template' => $template,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user