do not update contact organization, if there is none
This commit is contained in:
parent
8449b00b7d
commit
f1aa4e96d7
|
@ -154,7 +154,7 @@ class ContactsHelper(val context: Context) {
|
||||||
val mimetype = cursor.getStringValue(Data.MIMETYPE)
|
val mimetype = cursor.getStringValue(Data.MIMETYPE)
|
||||||
|
|
||||||
// ignore names at Organization type contacts
|
// ignore names at Organization type contacts
|
||||||
if (cursor.getStringValue(Data.MIMETYPE) == StructuredName.CONTENT_ITEM_TYPE) {
|
if (mimetype == StructuredName.CONTENT_ITEM_TYPE) {
|
||||||
prefix = cursor.getStringValue(StructuredName.PREFIX) ?: ""
|
prefix = cursor.getStringValue(StructuredName.PREFIX) ?: ""
|
||||||
firstName = cursor.getStringValue(StructuredName.GIVEN_NAME) ?: ""
|
firstName = cursor.getStringValue(StructuredName.GIVEN_NAME) ?: ""
|
||||||
middleName = cursor.getStringValue(StructuredName.MIDDLE_NAME) ?: ""
|
middleName = cursor.getStringValue(StructuredName.MIDDLE_NAME) ?: ""
|
||||||
|
@ -1012,14 +1012,16 @@ class ContactsHelper(val context: Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// add organization
|
// add organization
|
||||||
ContentProviderOperation.newInsert(Data.CONTENT_URI).apply {
|
if (contact.organization.isNotEmpty()) {
|
||||||
withValue(Data.RAW_CONTACT_ID, contact.id)
|
ContentProviderOperation.newInsert(Data.CONTENT_URI).apply {
|
||||||
withValue(Data.MIMETYPE, CommonDataKinds.Organization.CONTENT_ITEM_TYPE)
|
withValue(Data.RAW_CONTACT_ID, contact.id)
|
||||||
withValue(CommonDataKinds.Organization.COMPANY, contact.organization.company)
|
withValue(Data.MIMETYPE, CommonDataKinds.Organization.CONTENT_ITEM_TYPE)
|
||||||
withValue(CommonDataKinds.Organization.TYPE, DEFAULT_ORGANIZATION_TYPE)
|
withValue(CommonDataKinds.Organization.COMPANY, contact.organization.company)
|
||||||
withValue(CommonDataKinds.Organization.TITLE, contact.organization.jobPosition)
|
withValue(CommonDataKinds.Organization.TYPE, DEFAULT_ORGANIZATION_TYPE)
|
||||||
withValue(CommonDataKinds.Organization.TYPE, DEFAULT_ORGANIZATION_TYPE)
|
withValue(CommonDataKinds.Organization.TITLE, contact.organization.jobPosition)
|
||||||
operations.add(build())
|
withValue(CommonDataKinds.Organization.TYPE, DEFAULT_ORGANIZATION_TYPE)
|
||||||
|
operations.add(build())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete websites
|
// delete websites
|
||||||
|
|
Loading…
Reference in New Issue