From 12c5f520925bce0f78c567d5c1a39ace8799f06f Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 27 Sep 2018 12:16:39 +0200 Subject: [PATCH] fix #254, if there is no N and ORG fields at the given contact, only FN, treat it as an organization --- .../com/simplemobiletools/contacts/helpers/VcfImporter.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/VcfImporter.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/VcfImporter.kt index f186505b..9cc27af8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/VcfImporter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/VcfImporter.kt @@ -138,6 +138,11 @@ class VcfImporter(val activity: SimpleActivity) { val contact = Contact(0, prefix, firstName, middleName, surname, suffix, nickname, photoUri, phoneNumbers, emails, addresses, events, targetContactSource, starred, contactId, thumbnailUri, photo, notes, groups, organization, websites, cleanPhoneNumbers, IMs) + // if there is no N and ORG fields at the given contact, only FN, treat it as an organization + if (contact.getFullName().isEmpty() && contact.organization.isEmpty() && ezContact.formattedName.value.isNotEmpty()) { + contact.organization.company = ezContact.formattedName.value + } + if (ContactsHelper(activity).insertContact(contact)) { contactsImported++ }