Commit 2ba87c61 authored by Volker Krause's avatar Volker Krause
Browse files

More consistent event description for rental car reservations

This follows the same pattern of the other types of only adding information
we actually have, and uses the same terms as everywhere else.
parent 4f80b585
Pipeline #62858 passed with stages
in 12 minutes and 36 seconds
BEGIN:VCALENDAR
PRODID:-//K Desktop Environment//NONSGML libkcal 4.3//EN
VERSION:2.0
X-KDE-ICAL-IMPLEMENTATION-VERSION:1.0
BEGIN:VTIMEZONE
TZID:UTC-07:00
END:VTIMEZONE
BEGIN:VEVENT
DTSTAMP:20171227T111649Z
X-KDE-KITINERARY-RESERVATION:[{"@context":"http://schema.org"\,"@type":
"RentalCarReservation"\,"dropoffLocation":{"@type":"Place"\,"address":
{"@type":"PostalAddress"\,"addressCountry":"US"\,"addressLocality":"Los
Angeles"\,"addressRegion":"CA"\,"postalCode":"94043"\,"streetAddress":
"1234 First Street"}\,"name":"Hertz LAX"}\,"dropoffTime":"2027-08-06T20:
00:00-07:00"\,"pickupLocation":{"@type":"Place"\,"address":{"@type":
"PostalAddress"\,"addressCountry":"US"\,"addressLocality":"San
Diego"\,"addressRegion":"CA"\,"postalCode":"94043"\,"streetAddress":"1500
Orange Avenue"}\,"name":"Hertz San Diego Airport"}\,"pickupTime":
"2027-08-05T16:00:00-07:00"\,"reservationFor":{"@type":
"RentalCar"\,"brand":{"@type":"Brand"\,"name":"Honda"}\,"model":
"Civic"\,"name":"Economy Class Car"\,"rentalCompany":{"@type":
"Organization"\,"name":"Hertz"}}\,"reservationNumber":
"546323"\,"reservationStatus":"http:
//schema.org/ReservationConfirmed"\,"underName":{"@type":"Person"\,"name":
"John Smith"}}]
CREATED:20171227T111649Z
UID:KIT-1234567890-1b22236a-21ff-4885-8c99-b3b2bbca062c
LAST-MODIFIED:20171227T111649Z
DESCRIPTION:Pickup location: Hertz San Diego Airport\n1500 Orange
Avenue\nSan Diego\, 94043\n\nUNITED STATES\n\nDropoff location: Hertz
LAX\n1234 First Street\nLos Angeles\, 94043\n\nUNITED STATES\n\nBooking
reference: 546323\nUnder name: John Smith
SUMMARY:Rental car reservation: Economy Class Car
LOCATION:Hertz San Diego Airport
DTSTART;TZID="UTC-07:00":20270805T160000
DTEND;TZID="UTC-07:00":20270806T200000
TRANSP:TRANSPARENT
END:VEVENT
END:VCALENDAR
[{
"@context": "http://schema.org",
"@type": "RentalCarReservation",
"reservationNumber": "546323",
"reservationStatus": "http://schema.org/Confirmed",
"underName": {
"@type": "Person",
"name": "John Smith"
},
"reservationFor": {
"@type": "RentalCar",
"name": "Economy Class Car",
"model": "Civic",
"brand": {
"@type": "Brand",
"name": "Honda"
},
"rentalCompany": {
"@type": "Organization",
"name": "Hertz"
}
},
"pickupLocation": {
"@type": "Place",
"name": "Hertz San Diego Airport",
"address": {
"@type": "PostalAddress",
"streetAddress": "1500 Orange Avenue",
"addressLocality": "San Diego",
"addressRegion": "CA",
"postalCode": "94043",
"addressCountry": "US"
}
},
"pickupTime": "2027-08-05T16:00:00-07:00",
"dropoffLocation": {
"@type": "Place",
"name": "Hertz LAX",
"address": {
"@type": "PostalAddress",
"streetAddress": "1234 First Street",
"addressLocality": "Los Angeles",
"addressRegion": "CA",
"postalCode": "94043",
"addressCountry": "US"
}
},
"potentialAction": {
"@type": "ConfirmAction",
"target": "http://cheapcar.com/confirm?id=546323"
},
"dropoffTime": "2027-08-06T20:00:00-07:00"
}]
......@@ -464,7 +464,7 @@ static void fillFoodReservation(const FoodEstablishmentReservation &reservation,
desc.push_back(i18n("Number of people: %1", reservation.partySize()));
}
if (!reservation.reservationNumber().isEmpty()) {
desc.push_back(i18n("Reservation reference: %1", reservation.reservationNumber()));
desc.push_back(i18n("Booking reference: %1", reservation.reservationNumber()));
}
const auto person = reservation.underName().value<KItinerary::Person>();
if (!person.name().isEmpty()) {
......@@ -479,7 +479,7 @@ static void fillRentalCarReservation(const RentalCarReservation &reservation, co
const auto addressPickUp = rentalCalPickup.address();
const auto rentalCar = reservation.reservationFor().value<RentalCar>();
event->setSummary(i18n("Rental car reservation: %1", rentalCar.name()));
event->setLocation(formatAddressSingleLine(addressPickUp));
event->setLocation(rentalCalPickup.name());
fillGeoPosition(rentalCalPickup, event);
event->setDtStart(reservation.pickupTime());
......@@ -487,18 +487,23 @@ static void fillRentalCarReservation(const RentalCarReservation &reservation, co
event->setAllDay(false);
event->setTransparency(KCalendarCore::Event::Transparent);
const QString pickUpAddress = formatAddress(addressPickUp);
const auto rentalCalDropOff = reservation.dropoffLocation();
const auto addressDropOff = rentalCalDropOff.address();
const QString dropAddress = formatAddress(addressDropOff);
const QString description = i18n("Reservation reference: %1\nUnder name: %2\n\nPickup location: %3\n\nDropoff location: %4",
reservation.reservationNumber(),
reservation.underName().value<KItinerary::Person>().name(),
pickUpAddress,
dropAddress);
QStringList desc;
if (!addressPickUp.isEmpty()) {
desc.push_back(i18n("Pickup location: %1\n%2\n", rentalCalPickup.name(), formatAddress(addressPickUp)));
}
const auto dropOff = reservation.dropoffLocation();
if (!dropOff.name().isEmpty()) {
desc.push_back(i18n("Dropoff location: %1\n%2\n", dropOff.name(), formatAddress(dropOff.address())));
}
if (!reservation.reservationNumber().isEmpty()) {
desc.push_back(i18n("Booking reference: %1", reservation.reservationNumber()));
}
const auto person = reservation.underName().value<KItinerary::Person>();
if (!person.name().isEmpty()) {
desc.push_back(i18n("Under name: %1", person.name()));
}
event->setDescription(description);
event->setDescription(desc.join(QLatin1Char('\n')));
}
static void fillTaxiReservation(const TaxiReservation &reservation, const KCalendarCore::Event::Ptr &event)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment