Commit f8d0c510 authored by Tino Goratsch's avatar Tino Goratsch

send the copy of the contact form to the sender by default

parent 37a567d7
......@@ -20,10 +20,6 @@ class Index extends Core\Controller\AbstractFrontendAction
* @var \ACP3\Modules\ACP3\Contact\Validation\FormValidation
*/
protected $formValidation;
/**
* @var \ACP3\Core\Helpers\Forms
*/
protected $formsHelper;
/**
* @var Contact\Model\ContactFormModel
*/
......@@ -39,7 +35,6 @@ class Index extends Core\Controller\AbstractFrontendAction
/**
* @param \ACP3\Core\Controller\Context\FrontendContext $context
* @param \ACP3\Core\Helpers\Forms $formsHelper
* @param \ACP3\Core\Helpers\FormToken $formTokenHelper
* @param \ACP3\Core\Helpers\Alerts $alertsHelper
* @param \ACP3\Modules\ACP3\Contact\Validation\FormValidation $formValidation
......@@ -48,7 +43,6 @@ class Index extends Core\Controller\AbstractFrontendAction
*/
public function __construct(
Core\Controller\Context\FrontendContext $context,
Core\Helpers\Forms $formsHelper,
Core\Helpers\FormToken $formTokenHelper,
Core\Helpers\Alerts $alertsHelper,
Contact\Validation\FormValidation $formValidation,
......@@ -57,7 +51,6 @@ class Index extends Core\Controller\AbstractFrontendAction
) {
parent::__construct($context);
$this->formsHelper = $formsHelper;
$this->formTokenHelper = $formTokenHelper;
$this->formValidation = $formValidation;
$this->contactFormModel = $contactFormModel;
......@@ -70,20 +63,17 @@ class Index extends Core\Controller\AbstractFrontendAction
*/
public function execute()
{
$copy = [
1 => $this->translator->t('contact', 'send_copy_to_sender'),
];
return [
'form' => \array_merge($this->getFormDefaults(), $this->request->getPost()->all()),
'copy' => $this->formsHelper->checkboxGenerator('copy', $copy, 0),
'contact' => $this->config->getSettings(Contact\Installer\Schema::MODULE_NAME),
'form_token' => $this->formTokenHelper->renderFormToken(),
];
}
/**
* @return \Symfony\Component\HttpFoundation\RedirectResponse
* @return array|string|\Symfony\Component\HttpFoundation\JsonResponse|\Symfony\Component\HttpFoundation\RedirectResponse
* @throws \Doctrine\DBAL\ConnectionException
* @throws \Doctrine\DBAL\DBALException
*/
public function executePost()
{
......@@ -95,10 +85,7 @@ class Index extends Core\Controller\AbstractFrontendAction
$this->contactsModel->save($formData);
$bool = $this->contactFormModel->sendContactFormEmail($formData);
if (isset($formData['copy'])) {
$this->contactFormModel->sendContactFormEmailCopy($formData);
}
$this->contactFormModel->sendContactFormEmailCopy($formData);
$this->setTemplate($this->alertsHelper->confirmBox(
$this->translator->t('contact', $bool === true ? 'send_mail_success' : 'send_mail_error'),
......
......@@ -4,7 +4,6 @@
{include file="asset:System/Partials/form_group.input_text.tpl" name="name" value=$form.name required=true maxlength=80 readonly=$form.name_disabled label={lang t="system|name"}}
{include file="asset:System/Partials/form_group.input_email.tpl" name="mail" value=$form.mail required=true readonly=$form.mail_disabled maxlength=120 label={lang t="system|email_address"}}
{include file="asset:System/Partials/form_group.textarea.tpl" name="message" value=$form.message required=true label={lang t="system|message"}}
{include file="asset:System/Partials/form_group.checkbox.tpl" options=$copy}
{event name="captcha.event.display_captcha"}
{include file="asset:System/Partials/form_group.submit.tpl" form_token=$form_token}
{/block}
......@@ -27,7 +27,6 @@ services:
class: ACP3\Modules\ACP3\Contact\Controller\Frontend\Index\Index
arguments:
- '@core.context.frontend'
- '@core.helpers.forms'
- '@core.helpers.formToken'
- '@core.helpers.alerts'
- '@contact.validation.form_validation'
......
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