diff --git a/application/modules/admin/controllers/admin/Emails.php b/application/modules/admin/controllers/admin/Emails.php index 9bc585e04..5b619b919 100644 --- a/application/modules/admin/controllers/admin/Emails.php +++ b/application/modules/admin/controllers/admin/Emails.php @@ -143,7 +143,15 @@ public function treatAction() ->to(['action' => 'treat', 'key' => $this->getRequest()->getParam('key'), 'type' => $this->getRequest()->getParam('type'), 'locale' => $this->getRequest()->getParam('locale')]); } - $this->getView()->set('moduleMapper', $moduleMapper) - ->set('emailContent', $emailsMapper->getEmail($this->getRequest()->getParam('key'), $this->getRequest()->getParam('type'), $locale)); + $emailContent = $emailsMapper->getEmail($this->getRequest()->getParam('key'), $this->getRequest()->getParam('type'), $locale); + + if (!$emailContent) { + $this->redirect() + ->withMessage('emailTemplateNotFound', 'danger') + ->to(['action' => 'index']); + } + + $this->getView()->set('modules', $moduleMapper->getModulesByKey($this->getRequest()->getParam('key'), $this->getTranslator()->getLocale())) + ->set('emailContent', $emailContent); } } diff --git a/application/modules/admin/translations/de.php b/application/modules/admin/translations/de.php index cc2eba5e8..891f4570d 100644 --- a/application/modules/admin/translations/de.php +++ b/application/modules/admin/translations/de.php @@ -417,6 +417,7 @@ 'emailDesc' => 'Beschreibung', 'emailLocale' => 'Sprache', 'emailText' => 'Text', + 'emailTemplateNotFound' => 'E-Mail-Vorlage nicht gefunden.', 'menuMail' => 'Mail Einstellungen', 'smtpModeEnabledDescription' => 'Versende E-Mails über einen SMTP-Server.', diff --git a/application/modules/admin/translations/en.php b/application/modules/admin/translations/en.php index ccbb175cf..8246e23b5 100644 --- a/application/modules/admin/translations/en.php +++ b/application/modules/admin/translations/en.php @@ -417,6 +417,7 @@ 'emailDesc' => 'Description', 'emailLocale' => 'Language', 'emailText' => 'Text', + 'emailTemplateNotFound' => 'E-Mail template not found.', 'menuMail' => 'Mail settings', 'smtpModeEnabledDescription' => 'Sending emails through a SMTP server.', diff --git a/application/modules/admin/views/admin/emails/index.php b/application/modules/admin/views/admin/emails/index.php index 039f67168..5b137d767 100644 --- a/application/modules/admin/views/admin/emails/index.php +++ b/application/modules/admin/views/admin/emails/index.php @@ -22,7 +22,7 @@ - + @@ -34,7 +34,7 @@ getEmailsByKey($modules->getModuleKey(), $this->getTranslator()->getLocale()); ?>