mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
flip company and job position at getting full business contact name
This commit is contained in:
@ -38,16 +38,18 @@ data class Contact(val id: Int, var prefix: String, var firstName: String, var m
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (firstString.isEmpty() && firstName.isEmpty() && middleName.isEmpty() && surname.isEmpty()) {
|
if (firstString.isEmpty() && firstName.isEmpty() && middleName.isEmpty() && surname.isEmpty()) {
|
||||||
if (organization.company.isNotEmpty()) {
|
val fullCompany = getFullCompany()
|
||||||
firstString = organization.company.normalizeString()
|
if (fullCompany.isNotEmpty()) {
|
||||||
|
firstString = fullCompany.normalizeString()
|
||||||
} else if (emails.isNotEmpty()) {
|
} else if (emails.isNotEmpty()) {
|
||||||
firstString = emails.first().value
|
firstString = emails.first().value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (secondString.isEmpty() && other.firstName.isEmpty() && other.middleName.isEmpty() && other.surname.isEmpty()) {
|
if (secondString.isEmpty() && other.firstName.isEmpty() && other.middleName.isEmpty() && other.surname.isEmpty()) {
|
||||||
if (other.organization.company.isNotEmpty()) {
|
val otherFullCompany = other.getFullCompany()
|
||||||
secondString = other.organization.company.normalizeString()
|
if (otherFullCompany.isNotEmpty()) {
|
||||||
|
secondString = otherFullCompany.normalizeString()
|
||||||
} else if (other.emails.isNotEmpty()) {
|
} else if (other.emails.isNotEmpty()) {
|
||||||
secondString = other.emails.first().value
|
secondString = other.emails.first().value
|
||||||
}
|
}
|
||||||
@ -95,9 +97,7 @@ data class Contact(val id: Int, var prefix: String, var firstName: String, var m
|
|||||||
val fullName = "$prefix $firstPart $lastPart$suffixComma".trim()
|
val fullName = "$prefix $firstPart $lastPart$suffixComma".trim()
|
||||||
return if (fullName.isEmpty()) {
|
return if (fullName.isEmpty()) {
|
||||||
if (organization.isNotEmpty()) {
|
if (organization.isNotEmpty()) {
|
||||||
var fullOrganization = if (organization.jobPosition.isEmpty()) "" else "${organization.jobPosition}, "
|
getFullCompany()
|
||||||
fullOrganization += organization.company
|
|
||||||
fullOrganization.trim().trimEnd(',')
|
|
||||||
} else {
|
} else {
|
||||||
emails.firstOrNull()?.value?.trim() ?: ""
|
emails.firstOrNull()?.value?.trim() ?: ""
|
||||||
}
|
}
|
||||||
@ -118,6 +118,12 @@ data class Contact(val id: Int, var prefix: String, var firstName: String, var m
|
|||||||
|
|
||||||
fun getHashToCompare() = getStringToCompare().hashCode()
|
fun getHashToCompare() = getStringToCompare().hashCode()
|
||||||
|
|
||||||
|
fun getFullCompany(): String {
|
||||||
|
var fullOrganization = if (organization.company.isEmpty()) "" else "${organization.company}, "
|
||||||
|
fullOrganization += organization.jobPosition
|
||||||
|
return fullOrganization.trim().trimEnd(',')
|
||||||
|
}
|
||||||
|
|
||||||
fun isABusinessContact() = prefix.isEmpty() && firstName.isEmpty() && middleName.isEmpty() && surname.isEmpty() && suffix.isEmpty() && organization.isNotEmpty()
|
fun isABusinessContact() = prefix.isEmpty() && firstName.isEmpty() && middleName.isEmpty() && surname.isEmpty() && suffix.isEmpty() && organization.isNotEmpty()
|
||||||
|
|
||||||
// do a more advanced phone number check here, compare numbers and and search query with dashes, spaces and everything but numbers removed
|
// do a more advanced phone number check here, compare numbers and and search query with dashes, spaces and everything but numbers removed
|
||||||
|
Reference in New Issue
Block a user