Mehrere Tickets 49, 50, 51, 52, 53

This commit is contained in:
Kevin Adametz 2021-10-08 17:07:28 +02:00
parent ae70577289
commit e3495be8b8
61 changed files with 1904 additions and 344 deletions

View file

@ -21,7 +21,17 @@ class Placeholder
'end_date' => '#Abreisedatum#',
'participants' => '#Teilnehmer#',
'booking_date' => '#Buchungsdatum#',
'airline' => '#Airline#'
'airline' => '#Airline#',
'extra_services' => '#zugebuchte_Leistungen#',
'net_price_travel' => '#Nettopreise_Rundreise#',
'net_price_extra_services' => '#Nettopreise_zugebuchte_Leistungen#',
'booked_rooms' => '#Gebuchte_Zimmer#',
'filekey' => "#Filekey#",
'flight_info' => "#Airline_Fluginfo#",
'check_in' => "#Airline_Checkin#",
'baggage' => "#Airline_Gepaeck#",
'country_visum' => '#Reiseland_Visum#',
'country_contact' => '#Reiseland_Kontakt#',
];
public static $placeholder_lead = [
@ -112,10 +122,24 @@ class Placeholder
$country = $booking->travel_country_id ? $booking->travel_country->name : "-";
$program = $booking->travelagenda_id ? $booking->travel_agenda->name : "-";
$salutation = isset($booking->customer->salutation) ? $booking->customer->salutation->name : '-';
$filekey = $booking->filekey;
$flight_info = "";
$check_in = "";
$baggage = "";
$country_visum = "";
$country_contact = "";
$start_date = $booking->getStartDateFormat();
$end_date = $booking->getEndDateFormat();
$booking_date = $booking->getBookingDateFormat();
$airline = $booking->airline ? $booking->airline->name_full : '-';
$extra_services = self::getBookingPlaceholdersBy('extra_services', $booking);
$net_price_travel = self::getBookingPlaceholdersBy('net_price_travel', $booking);
$net_price_extra_services = self::getBookingPlaceholdersBy('net_price_extra_services', $booking);
$booked_rooms = self::getBookingPlaceholdersBy('booked_rooms', $booking);
$participants = "Teilnehmer:<br>";
//first
if($booking->participant_firstname){
@ -140,8 +164,10 @@ class Placeholder
$replace = [];
foreach (self::$placeholder_booking as $key => $value) {
$search[] = $value;
$replace[] = ${$key};
if(isset(${$key})){
$search[] = $value;
$replace[] = ${$key};
}
}
$content = str_replace($search, $replace, $content);
$content = preg_replace('/<placeholder.*?>(.*?)<\/placeholder>/', '$1', $content);
@ -209,4 +235,58 @@ class Placeholder
}
private static function getBookingPlaceholdersBy($key, $booking){
if($booking->new_drafts){
$booked_rooms = '';
$extra_services = '';
$net_price_travel = 0;
$net_price_extra_services = 0;
foreach($booking->booking_draft_items as $booking_draft_item){
//41 zugebuchte Leistungen
//32 Aufpreis Kategorie
if(in_array($booking_draft_item->draft_type_id, [32, 41])){
}
//24 Rundreise
if($booking_draft_item->draft_type_id == 24){
}
//30 Grundpreis Reise (Zimmer)
if($booking_draft_item->draft_type_id == 30){
$booked_rooms .= self::cleanText($booking_draft_item->service)." | ".$booking_draft_item->adult." Erw. ".($booking_draft_item->children ? " | ".$booking_draft_item->children." Kin." : '')."<br>";
$prices = $booking_draft_item->getItemPrice();
$net_price_travel += $prices['adult'];
$net_price_travel += $prices['children'];
}
}
switch ($key) {
case 'extra_services':
return "zugebuchte Leistungen:<br>".$extra_services;
break;
case 'net_price_travel':
return "Nettopreis Rundreise: ".Util::_number_format($net_price_travel)." Euro";
break;
case 'net_price_extra_services':
return "Nettopreise zugebuchte Leistungen:<br>".$net_price_extra_services;
break;
case 'booked_rooms':
return "Gebuchte Zimmer:<br>".$booked_rooms;
break;
}
}
}
private static function cleanText($text){
$text = str_replace('pro Person im', '', $text);
return $text;
}
}