* Behoben: Falsche CRM-URL in Buchungs-Service-E-Mail
* Kontaktformular git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3300 f459cee4-fb09-11de-96c3-f9c5f16c3c76
This commit is contained in:
parent
ff9c159297
commit
353b758bcd
12 changed files with 741 additions and 34 deletions
|
|
@ -3,8 +3,10 @@
|
|||
namespace AppBundle\Controller;
|
||||
|
||||
use AppBundle\Entity\BreadcrumbEntry;
|
||||
use AppBundle\Entity\ContactRequest;
|
||||
use AppBundle\Entity\Page;
|
||||
use AppBundle\Entity\TravelProgram;
|
||||
use AppBundle\Form\ContactRequestType;
|
||||
use AppBundle\Form\SearchRequestType;
|
||||
use AppBundle\Form\TtSearchRequestType;
|
||||
use AppBundle\Util;
|
||||
|
|
@ -224,6 +226,62 @@ class DefaultController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/kontakt")
|
||||
*/
|
||||
public function contactAction(Request $request)
|
||||
{
|
||||
$form = $this->createForm(ContactRequestType::class);
|
||||
$breadcrumbEntries = [new BreadcrumbEntry('Kontaktformular')];
|
||||
|
||||
if ($request->getMethod() == 'POST')
|
||||
{
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isValid())
|
||||
{
|
||||
/** @var ContactRequest $contactRequest */
|
||||
$contactRequest = $form->getData();
|
||||
|
||||
$crmLeadUrl = $this->get('app.contact_exporter')->process($contactRequest);
|
||||
if ($crmLeadUrl)
|
||||
{
|
||||
$crmLeadUrl = preg_replace('/\\/api\\/lead/', '/leads', $crmLeadUrl) .'/edit';
|
||||
}
|
||||
else
|
||||
{
|
||||
$crmLeadUrl = '[Übertragung zum CRM fehlgeschlagung]';
|
||||
}
|
||||
|
||||
$this->get('mailer')->send(\Swift_Message::newInstance()
|
||||
->setSubject('Kontaktformular (stern-tours.de)')
|
||||
->setFrom('stern@stern-tours.de', 'STERN TOURS')
|
||||
->setTo('ulrich.hecht@hecht-software.de')
|
||||
->setBody(
|
||||
$this->renderView('default/email/contactServiceEmail.txt.twig', [
|
||||
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
|
||||
'crm_url' => $crmLeadUrl,
|
||||
'contact_request' => $contactRequest,
|
||||
]),
|
||||
'text/plain', 'utf-8'
|
||||
)
|
||||
);
|
||||
|
||||
// #TODO This will lead to multiple submissions. Redirect instead!
|
||||
return $this->render('default/pages/contactConfirmation.html.twig', [
|
||||
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
|
||||
'breadcrumb_entries' => $breadcrumbEntries,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('default/pages/contact.html.twig', [
|
||||
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
|
||||
'breadcrumb_entries' => $breadcrumbEntries,
|
||||
'contact_form' => $form->createView(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function headerAction()
|
||||
{
|
||||
$qb = $this->getEntityManager()->createQueryBuilder();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue