Commit fa2e2b40 authored by Volker Krause's avatar Volker Krause
Browse files

Extract traveler name from ERA FCB data if present

parent 16d3e15b
Pipeline #254114 passed with stage
in 3 minutes and 35 seconds
......@@ -772,6 +772,9 @@ Fcb::UicRailTicketData::UicRailTicketData() = default;
Fcb::UicRailTicketData::UicRailTicketData(const Uic9183Block &block)
: m_block(block)
{
if (block.isNull()) {
return;
}
UPERDecoder decoder(BitVectorView(std::string_view(block.content(), block.contentSize())));
decode(decoder);
if (decoder.hasError()) {
......
......@@ -252,9 +252,19 @@ QDateTime Uic9183Parser::validUntil() const
Person Uic9183Parser::person() const
{
// ERA FCB
if (const auto fcb = findBlock<Fcb::UicRailTicketData>(); fcb.isValid() && fcb.travelerDetailIsSet() && fcb.travelerDetail.traveler.size() == 1) {
const auto traveler = fcb.travelerDetail.traveler.at(0);
Person p;
p.setGivenName(QString(traveler.firstName + QLatin1Char(' ') + traveler.secondName).trimmed());
p.setFamilyName(traveler.lastName);
if (traveler.firstNameIsSet() || traveler.lastNameIsSet()) {
return p;
}
}
// Deutsche Bahn vendor block
const auto b = findBlock<Vendor0080BLBlock>();
if (b.isValid()) {
if (const auto b = findBlock<Vendor0080BLBlock>(); b.isValid()) {
// S028 contains family and given name separated by a '#', UTF-8 encoded
auto sblock = b.findSubBlock("028");
if (!sblock.isNull()) {
......
Supports Markdown
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