Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit d760e6c4 authored by Volker Krause's avatar Volker Krause

Decode reservation details for RCT2 IRT tickets too

parent 9d75f208
[
{
"@context": "http://schema.org",
"@type": "Rct2Ticket",
"coachNumber": "280",
"firstDayOfValidity": "2018-01-01",
"outboundArrivalStation": "NUERNBERG",
"outboundArrivalTime": "2018-12-29T02:37:00",
"outboundClass": "2",
"outboundDepartureStation": "SOMEWHERE HBF",
"outboundDepartureTime": "2018-12-29T01:37:00",
"passengerName": "Lastname Firs",
"trainNumber": "NJ 1",
"type": 1
}
]
U_TLAY010527RCT200100019022500034FAHRSCHEIN + RESERVIERUNG
Nightjet1352011900019PREIS EUR 99,900052021400028Lastname Firs
01 ERWACHSENER0801034000081ZUG 421 NJ WAGEN 280 Sitzplatz
ABTEILWAGEN 0460935010700007FENSTER0201021300022CIV 1181
Gültig: 2018120101480004801 SparSchiene Kein Umtausch/Storno BEFÖRDERER:13370104000041181060101680006829.12 01:37 SOMEWHERE HBF -> NUERNBERG 29.12 02:37 20703016600066* * * -> * * * *
\ No newline at end of file
......@@ -313,6 +313,7 @@ static const struct {
Rct2Ticket::Type type;
} rct2_ticket_type_map[] = {
{ "ticket + reservation", Rct2Ticket::TransportReservation },
{ "fahrschein + reservierung", Rct2Ticket::TransportReservation },
{ "ticket", Rct2Ticket::Transport },
{ "billet", Rct2Ticket::Transport },
{ "fahrkarte", Rct2Ticket::Transport },
......@@ -375,15 +376,22 @@ QString Rct2Ticket::outboundClass() const
QString Rct2Ticket::trainNumber() const
{
if (type() == Reservation) {
return d->fieldText(8, 7, 5).trimmed();
const auto t = type();
if (t == Reservation || t == TransportReservation) {
const auto cat = d->fieldText(8, 13, 3).trimmed();
const auto num = d->fieldText(8, 7, 5).trimmed();
if (!cat.isEmpty()) {
return cat + QLatin1Char(' ') + num;
}
return num;
}
return {};
}
QString Rct2Ticket::coachNumber() const
{
if (type() == Reservation) {
const auto t = type();
if (t == Reservation || t == TransportReservation) {
return d->fieldText(8, 26, 3).trimmed();
}
return {};
......@@ -391,7 +399,8 @@ QString Rct2Ticket::coachNumber() const
QString Rct2Ticket::seatNumber() const
{
if (type() == Reservation) {
const auto t = type();
if (t == Reservation || t == TransportReservation) {
return d->fieldText(8, 48, 23).trimmed();
}
return {};
......
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