* 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:
uli 2017-02-21 16:54:37 +00:00
parent ff9c159297
commit 353b758bcd
12 changed files with 741 additions and 34 deletions

View file

@ -94,6 +94,7 @@ class BookingController extends Controller
$em->flush();
$crmBookingUrl = $this->get('app.booking_exporter')->process($bookingRequest, $travelDate, $bookingPriceInfo);
$crmBookingUrl = preg_replace('/\\/api/', '', $crmBookingUrl) .'/edit';
$this->get('mailer')->send(\Swift_Message::newInstance()
->setSubject('Ihr Buchungsauftrag bei STERN TOURS')
@ -118,7 +119,7 @@ class BookingController extends Controller
->setBody(
$this->renderView('default/email/bookingServiceEmail.txt.twig', [
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
'crm_url' => $crmBookingUrl .'/edit',
'crm_url' => $crmBookingUrl,
'travel_program_url' => Util::getBaseUrl() . $travelProgramPage->getUrlPath(),
'booking_request' => $bookingRequest,
'booking_price_info' => $bookingPriceInfo,

View file

@ -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();