From fd9509420d9a7e2af525762e8d05641aeec4573e Mon Sep 17 00:00:00 2001 From: adametz Date: Fri, 23 Feb 2018 16:25:10 +0000 Subject: [PATCH] Vaidator Booking E-Mail and traveler Date git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3373 f459cee4-fb09-11de-96c3-f9c5f16c3c76 --- .../AppBundle/Controller/BookingController.php | 1 + .../Export/BookingSternToursCrmExporter.php | 4 ++-- trunk/src/AppBundle/Form/BookingRequestType.php | 15 ++++++++++++++- trunk/src/AppBundle/Form/TravelerType.php | 5 ++++- .../assets/less/includes/color_schemes.less | 5 +++++ 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/trunk/src/AppBundle/Controller/BookingController.php b/trunk/src/AppBundle/Controller/BookingController.php index 1fe726ab..9cc14a8f 100644 --- a/trunk/src/AppBundle/Controller/BookingController.php +++ b/trunk/src/AppBundle/Controller/BookingController.php @@ -87,6 +87,7 @@ class BookingController extends Controller if ($request->getMethod() == 'POST' && $form->isValid()) { + $booking = $this->getDoctrine()->getRepository('AppBundle:TravelBooking')->createFromBookingRequest( $bookingRequest, $travelDate, $bookingPriceInfo); $em = $this->getDoctrine()->getManager(); diff --git a/trunk/src/AppBundle/Export/BookingSternToursCrmExporter.php b/trunk/src/AppBundle/Export/BookingSternToursCrmExporter.php index 13555e68..a5a3598f 100644 --- a/trunk/src/AppBundle/Export/BookingSternToursCrmExporter.php +++ b/trunk/src/AppBundle/Export/BookingSternToursCrmExporter.php @@ -28,14 +28,14 @@ class BookingSternToursCrmExporter extends SternToursCrmExporter $lead = $this->createLead($bookingRequest, $travelDate); if ($lead === null) { - $this->warn('Failed creating lead in CRM', $bookingRequest, $travelDate, Logger::ERROR); + $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']); if ($bookingUrl === false) { - $this->warn('Failed creating booking in CRM', $bookingRequest, $travelDate, Logger::ERROR); + $this->warn('Failed creating booking in CRM Booking', $bookingRequest, $travelDate, Logger::ERROR); return false; } diff --git a/trunk/src/AppBundle/Form/BookingRequestType.php b/trunk/src/AppBundle/Form/BookingRequestType.php index bcc46152..3e783a3a 100644 --- a/trunk/src/AppBundle/Form/BookingRequestType.php +++ b/trunk/src/AppBundle/Form/BookingRequestType.php @@ -20,12 +20,16 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\CollectionType; 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 BookingRequestType extends AbstractType { @@ -129,7 +133,16 @@ class BookingRequestType extends AbstractType ]) ->add('phone') ->add('fax') - ->add('email') + ->add('email', EmailType::class, [ + 'constraints' =>[ + new Email([ + 'message'=>'This is not the corect email format' + ]), + new NotBlank([ + 'message' => 'This field can not be blank' + ]) + ] + ]) ->add('rooms', CollectionType::class, [ 'entry_type' => RoomType::class, 'by_reference' => false, diff --git a/trunk/src/AppBundle/Form/TravelerType.php b/trunk/src/AppBundle/Form/TravelerType.php index f0cc41e7..21d7885f 100644 --- a/trunk/src/AppBundle/Form/TravelerType.php +++ b/trunk/src/AppBundle/Form/TravelerType.php @@ -50,7 +50,10 @@ class TravelerType extends AbstractType ]) ->add('firstName') ->add('lastName') - ->add('birthDate') + ->add('birthDate', StDateType::class, [ + 'format' => 'dd.MM.y' + ] + ) ; } } \ No newline at end of file diff --git a/trunk/src/AppBundle/Resources/assets/less/includes/color_schemes.less b/trunk/src/AppBundle/Resources/assets/less/includes/color_schemes.less index 9fcc1b73..c74db1b4 100644 --- a/trunk/src/AppBundle/Resources/assets/less/includes/color_schemes.less +++ b/trunk/src/AppBundle/Resources/assets/less/includes/color_schemes.less @@ -69,3 +69,8 @@ a, .c1 li:before { color: darken(@text-brand-color, 0%); } + + +.help-block { + color:#cd2929; +}