From 28cd003bcc974410856c8671e09eb1635fb40b5e Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 21 Sep 2017 09:55:59 +0300 Subject: [PATCH] Improve converting customer name. --HG-- branch : develop --- src/libs/ifc/xml/vvitconverter.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/libs/ifc/xml/vvitconverter.cpp b/src/libs/ifc/xml/vvitconverter.cpp index 00b3d91a0..4086620b8 100644 --- a/src/libs/ifc/xml/vvitconverter.cpp +++ b/src/libs/ifc/xml/vvitconverter.cpp @@ -344,7 +344,25 @@ void VVITConverter::ConverCustomerNameToV0_4_0() } QDomElement customer = createElement(strCustomer); - customer.appendChild(createTextNode(givenName + QLatin1Char(' ') + familyName)); + + QString customerName; + if (not givenName.isEmpty() && not familyName.isEmpty()) + { + customerName = givenName + QLatin1Char(' ') + familyName; + } + else if (not givenName.isEmpty() && familyName.isEmpty()) + { + customerName = givenName; + } + else if (givenName.isEmpty() && not familyName.isEmpty()) + { + customerName = familyName; + } + + if (not customerName.isEmpty()) + { + customer.appendChild(createTextNode(customerName)); + } personal.insertBefore(customer, personal.firstChild()); }