Diverse ticketlose Änderungen

- E-Mail-Link im Header
- Raumnummer und -typ sowie Aufteilung der Reisenden für die Bestätigungsmail
- Es werden nur noch die Raumtypen zur Auswahl angeboten, die für die gewählte Reise verfügbar sind
- PDF-Herunterladen an entsprechenden Stellen angefügt
- Vorauswahl von Räumen und Abflugort entfernt
- Geburtstage werden nicht mehr validiert

git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3344 f459cee4-fb09-11de-96c3-f9c5f16c3c76
This commit is contained in:
valentin.wacker 2017-08-17 13:59:03 +00:00
parent dc0a69413f
commit 0246f5b2ff
15 changed files with 207 additions and 94 deletions

View file

@ -64,9 +64,7 @@ class BookingController extends Controller
$bookingRequest = new BookingRequest();
if ($request->getMethod() != 'POST')
{
$bookingRequest->setDoubleRoomCount(1);
$bookingRequest->setRoomCount(2);
$bookingRequest->setDeparture($travelDate->getDepartures()[0]);
$bookingRequest->setRoomCount(0);
}
$form = $this->createForm(BookingRequestType::class, $bookingRequest, [
'travel_date' => $travelDate,
@ -86,8 +84,6 @@ class BookingController extends Controller
$breadcrumbEntries = Util::createBreadcrumb($travelProgramPage);
$breadcrumbEntries[] = new BreadcrumbEntry('Buchen');
if ($request->getMethod() == 'POST' && $form->isValid())
{
$booking = $this->getDoctrine()->getRepository('AppBundle:TravelBooking')->createFromBookingRequest(
@ -95,7 +91,6 @@ class BookingController extends Controller
$em = $this->getDoctrine()->getManager();
$em->persist($booking);
$em->flush();
$crmBookingUrl = $this->get('app.booking_exporter')->process($bookingRequest, $travelDate, $bookingPriceInfo);
$crmBookingUrl = preg_replace('/\\/api/', '', $crmBookingUrl) .'/edit';
@ -133,7 +128,6 @@ class BookingController extends Controller
'text/plain', 'utf-8'
)
);
// #TODO This will lead to multiple bookings due to multiple form submission. Redirect instead!
return $this->render('default/pages/bookingConfirmation.html.twig', [
@ -185,6 +179,15 @@ class BookingController extends Controller
throw new \Exception('Unknow BookingController action: '. $action);
}
private function calcNumTravelerLabel($number)
{
$ret = 0;
if($number > 0)
$ret = 1;
return $ret;
}
public function calculatePrice(TravelDate $travelDate, BookingRequest $bookingRequest, &$outHtmlSummary = null,
&$outPriceInfo = null)
{
@ -207,29 +210,33 @@ class BookingController extends Controller
$outPriceInfo['classOptions'] = [];
}
$departure = Util\DepartureUtil::limitIndividualArrivalPrice($bookingRequest->getDeparture(),
$travelDate->getFlightPrice());
if (isset($outPriceInfo))
if($bookingRequest->getDeparture() != null)
{
$outPriceInfo['departure'] = $departure;
}
if ($departure->getExtraCharge() != 0)
{
$insuranceAssessmentBasis += $departure->getExtraCharge();
$a = $travelerCount * $departure->getExtraCharge();
$ret += $a;
if (isset($outHtmlSummary))
$departure = Util\DepartureUtil::limitIndividualArrivalPrice($bookingRequest->getDeparture(),
$travelDate->getFlightPrice());
if (isset($outPriceInfo))
{
$outHtmlSummary[] = [
'value' => $a,
'label' => ($departure->getExtraCharge() > 0 ? 'Aufschlag' : 'Abzug') .
' für Abfahrts-/Abflugort "'. $departure->getName() .'" <strong>['. $travelerCount .' x '.
Util::formatPrice($departure->getExtraCharge()) .' pro Person]</strong>'
];
$outPriceInfo['departure'] = $departure;
}
if ($departure->getExtraCharge() != 0)
{
$insuranceAssessmentBasis += $departure->getExtraCharge();
$a = $travelerCount * $departure->getExtraCharge();
$ret += $a;
if (isset($outHtmlSummary))
{
$outHtmlSummary[] = [
'value' => $a,
'label' => ($departure->getExtraCharge() > 0 ? 'Aufschlag' : 'Abzug') .
' für Abfahrts-/Abflugort "'. $departure->getName() .'" <strong>['. $this->calcNumTravelerLabel($travelerCount) .' x '.
Util::formatPrice($departure->getExtraCharge()) .' pro Person]</strong>'
];
}
}
}
foreach ($bookingRequest->getTravelOptions() as $travelOption)
{
$insuranceAssessmentBasis += $travelOption->getPrice();
@ -239,7 +246,7 @@ class BookingController extends Controller
{
$outHtmlSummary[] = [
'value' => $a,
'label' => $travelOption->getName() .' <strong>['. $travelerCount .' x '.
'label' => $travelOption->getName() .' <strong>['. $this->calcNumTravelerLabel($travelerCount) .' x '.
Util::formatPrice($travelOption->getPrice()) .' pro Person]</strong>'
];
}
@ -274,7 +281,7 @@ class BookingController extends Controller
{
$outHtmlSummary[] = [
'value' => $a,
'label' => 'Komfort-Kategorie <strong>['. $travelerCount .' x '.
'label' => 'Komfort-Kategorie <strong>['. $this->calcNumTravelerLabel($travelerCount) .' x '.
Util::formatPrice($room['price']->getEffectiveComfortPrice()) .' pro Person]</strong>'
];
}
@ -315,14 +322,14 @@ class BookingController extends Controller
if (isset($outHtmlSummary))
{
$label = $room['priceType']->getName() .' <strong>['. $adultCount .' x '.
$label = $room['priceType']->getName() .' <strong>['. $this->calcNumTravelerLabel($adultCount) .' x '.
Util::formatPrice($singleFullPrice) .' pro Person]</strong>';
if ($room['persons']['children'] != 0)
{
$label .= ', Kinder: '. $room['persons']['children'] .' x <strong>'.
$label .= ', Kinder: '. $this->calcNumTravelerLabel($room['persons']['children']) .' x <strong>'.
Util::formatPrice($room['price']->getEffectiveChildPrice()) .'</strong>';
$label .= ']';
}
$label .= ']';
$outHtmlSummary[] = [
'value' => $roomPrice,
'label' => $label
@ -331,7 +338,7 @@ class BookingController extends Controller
{
$outHtmlSummary[] = [
'value' => $discount,
'label' => 'Rabatt <strong>['. $adultCount .'x '.
'label' => 'Rabatt <strong>['. $this->calcNumTravelerLabel($adultCount) .'x '.
Util::formatPrice($singleFullPrice - $singleDiscountPrice) .' pro Person]</strong>'
];
}
@ -351,7 +358,7 @@ class BookingController extends Controller
$insuranceHtmlSummary[] = [
'value' => $a,
'label' => 'RV '. $bookingRequest->getInsurance()->getName() .' ('.
$insurancePrice->getCode() .') <strong>['. $adultCount .' x '.
$insurancePrice->getCode() .') <strong>['. $this->calcNumTravelerLabel($adultCount) .' x '.
Util::formatPrice($insurancePriceValue) . ' pro Person]</strong>'
];
}
@ -398,47 +405,56 @@ class BookingController extends Controller
if($priceTypeId == 1 && $persons['singleRoomPersons'] > 0)
{
$currentPersons = [
'total' => $persons['singleRoomPersons'],
'adults' => $persons['singleRoomPersons'],
'children' => 0 //TODO
];
for($i = 0; $i < $persons['singleRoomPersons']; $i++)
{
$currentPersons = [
'total' => 1,
'adults' => 1,
'children' => 0 //TODO
];
$ret[] = [
'priceType' => $priceType,
'persons' => $currentPersons,
'price' => $price
];
$ret[] = [
'priceType' => $priceType,
'persons' => $currentPersons,
'price' => $price
];
}
}
if($priceTypeId == 3 && $persons['doubleRoomPersons'] > 0)
{
$currentPersons = [
'total' => $persons['doubleRoomPersons'],
'adults' => $persons['doubleRoomPersons'],
'children' => 0
];
for($j = 0; $j < ($persons['doubleRoomPersons'] / 2); $j++)
{
$currentPersons = [
'total' => 2,
'adults' => 2,
'children' => 0
];
$ret[] = [
'priceType' => $priceType,
'persons' => $currentPersons,
'price' => $price
];
$ret[] = [
'priceType' => $priceType,
'persons' => $currentPersons,
'price' => $price
];
}
}
if($priceTypeId == 5 && $persons['tripleRoomPersons'] > 0)
{
$currentPersons = [
'total' => $persons['tripleRoomPersons'],
'adults' => $persons['tripleRoomPersons'],
'children' => 0
];
for($k = 0; $k < ($persons['tripleRoomPersons'] / 3); $k++)
{
$currentPersons = [
'total' => 3,
'adults' => 3,
'children' => 0
];
$ret[] = [
'priceType' => $priceType,
'persons' => $currentPersons,
'price' => $price
];
$ret[] = [
'priceType' => $priceType,
'persons' => $currentPersons,
'price' => $price
];
}
}
}