diff --git a/trunk/app/Resources/views/default/pages/booking.html.twig b/trunk/app/Resources/views/default/pages/booking.html.twig index 8e758f87..82f4bf37 100644 --- a/trunk/app/Resources/views/default/pages/booking.html.twig +++ b/trunk/app/Resources/views/default/pages/booking.html.twig @@ -42,6 +42,8 @@ {{ form_errors(form) }} + {{ form_errors(form.email) }} +
diff --git a/trunk/app/Resources/views/default/pages/fewoBooking.html.twig b/trunk/app/Resources/views/default/pages/fewoBooking.html.twig index 80970026..324bfe43 100644 --- a/trunk/app/Resources/views/default/pages/fewoBooking.html.twig +++ b/trunk/app/Resources/views/default/pages/fewoBooking.html.twig @@ -37,6 +37,7 @@
{{ form_errors(form) }} + {{ form_errors(form.email) }}
diff --git a/trunk/src/AppBundle/Controller/BookingController.php b/trunk/src/AppBundle/Controller/BookingController.php index bed97107..df40a903 100644 --- a/trunk/src/AppBundle/Controller/BookingController.php +++ b/trunk/src/AppBundle/Controller/BookingController.php @@ -106,7 +106,6 @@ class BookingController extends Controller $crmBookingUrl = preg_replace('/\\/api/', '', $crmBookingUrl).'/edit'; } - $this->get('mailer')->send(\Swift_Message::newInstance() ->setSubject('Ihr Buchungsauftrag bei STERN TOURS') ->setFrom('stern@stern-tours.de', 'STERN TOURS') diff --git a/trunk/src/AppBundle/Entity/TravelBooking.php b/trunk/src/AppBundle/Entity/TravelBooking.php index 876de463..2032e5a7 100644 --- a/trunk/src/AppBundle/Entity/TravelBooking.php +++ b/trunk/src/AppBundle/Entity/TravelBooking.php @@ -898,11 +898,16 @@ class TravelBooking for ($i = 0; $i < count($travelers); ++$i) { $traveler = $travelers[$i]; + + $birthdate = $traveler->getBirthDate(); + if(!strtotime($birthdate)){ + $birthdate = '01.01.1900'; + } $participants[''. ($i+1)] = [ 'gender' => $traveler->getSex(), 'first_name' => $traveler->getFirstName(), 'last_name' => $traveler->getLastName(), - 'birthday' => $traveler->getBirthDate() + 'birthday' => $birthdate, ]; } @@ -930,6 +935,9 @@ class TravelBooking $traveler->setSex(intval($participant['gender'])); $traveler->setFirstName($participant['first_name']); $traveler->setLastName($participant['last_name']); + if(!strtotime($participant['birthday'])){ + $participant['birthday'] = '01.01.1900'; + } $traveler->setBirthDate(\DateTime::createFromFormat('d.m.Y', $participant['birthday'])); $ret[] = $traveler; } diff --git a/trunk/src/AppBundle/Entity/Traveler.php b/trunk/src/AppBundle/Entity/Traveler.php index 76f099fb..ad2038a9 100644 --- a/trunk/src/AppBundle/Entity/Traveler.php +++ b/trunk/src/AppBundle/Entity/Traveler.php @@ -88,6 +88,9 @@ class Traveler */ public function getBirthDate() { + if(($this->birthDate instanceof String) && !strtotime($this->birthDate)){ + return '01.01.1900'; + } return $this->birthDate; } @@ -96,6 +99,7 @@ class Traveler */ public function setBirthDate($birthDate) { + $this->birthDate = $birthDate; } diff --git a/trunk/src/AppBundle/Export/BookingSternToursCrmExporter.php b/trunk/src/AppBundle/Export/BookingSternToursCrmExporter.php index a5a3598f..2ba42567 100644 --- a/trunk/src/AppBundle/Export/BookingSternToursCrmExporter.php +++ b/trunk/src/AppBundle/Export/BookingSternToursCrmExporter.php @@ -31,8 +31,7 @@ class BookingSternToursCrmExporter extends SternToursCrmExporter $this->warn('Failed creating lead in CRM Lead', $bookingRequest, $travelDate, Logger::ERROR); return false; } - $bookingUrl = $this->createBooking($bookingRequest, $travelDate, $bookingPriceInfo, $lead['customer_id'], - $lead['id']); + $bookingUrl = $this->createBooking($bookingRequest, $travelDate, $bookingPriceInfo, $lead['customer_id'], $lead['id']); if ($bookingUrl === false) { $this->warn('Failed creating booking in CRM Booking', $bookingRequest, $travelDate, Logger::ERROR); @@ -268,7 +267,6 @@ class BookingSternToursCrmExporter extends SternToursCrmExporter 'participant_firstname' => $bookingRequest->getTravelers()[0]->getFirstName(), 'participant_birthdate' => $bookingRequest->getTravelers()[0]->getBirthDate(), ]]); - if (!$resp['success']) { return false; diff --git a/trunk/src/AppBundle/Form/BookingRequestType.php b/trunk/src/AppBundle/Form/BookingRequestType.php index ee4b6914..409b4133 100644 --- a/trunk/src/AppBundle/Form/BookingRequestType.php +++ b/trunk/src/AppBundle/Form/BookingRequestType.php @@ -133,17 +133,17 @@ class BookingRequestType extends AbstractType ]) ->add('phone') ->add('fax') - ->add('email') - /*EmailType::class, [ + ->add('email', + EmailType::class, [ 'constraints' =>[ new Email([ - 'message'=>'This is not the corect email format' + 'message'=>'Dies ist nicht das richtige E-Mail-Format, bitte korrigieren.' ]), new NotBlank([ - 'message' => 'This field can not be blank' + 'message' => 'Das Feld E-Mail darf nicht leer sein.' ]) ] - ])*/ + ]) ->add('rooms', CollectionType::class, [ 'entry_type' => RoomType::class, 'by_reference' => false, diff --git a/trunk/src/AppBundle/Form/FewoBookingRequestType.php b/trunk/src/AppBundle/Form/FewoBookingRequestType.php index 2772b031..2610056b 100644 --- a/trunk/src/AppBundle/Form/FewoBookingRequestType.php +++ b/trunk/src/AppBundle/Form/FewoBookingRequestType.php @@ -19,12 +19,15 @@ use Symfony\Component\Form\Extension\Core\Type\CollectionType; use Symfony\Component\Form\Extension\Core\Type\RangeType; use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\Extension\Core\Type\TextType; +use Symfony\Component\Form\Extension\Core\Type\EmailType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Validator\Constraints\Choice; use Symfony\Component\Validator\Constraints\NotNull; +use Symfony\Component\Validator\Constraints\Email; +use Symfony\Component\Validator\Constraints\NotBlank; class FewoBookingRequestType extends AbstractType { @@ -117,7 +120,17 @@ class FewoBookingRequestType extends AbstractType ->add('city') ->add('phone') ->add('fax') - ->add('email') + ->add('email', + EmailType::class, [ + 'constraints' =>[ + new Email([ + 'message'=>'Dies ist nicht das richtige E-Mail-Format, bitte korrigieren.' + ]), + new NotBlank([ + 'message' => 'Das Feld E-Mail darf nicht leer sein.' + ]) + ] + ]) ->add('notes', TextareaType::class, ['required' => false]) ->add('acceptTerms', CheckboxType::class, ['required' => true]) ->add('acceptPrivacy', CheckboxType::class, ['required' => true])