Updating contact (with no email) via import adding email doesn't set email as primary
Have replicated on dmaster running 5.15.alpha1
To reproduce:
In Civicrm Create a new contact with no email address.
On your computer: Create a CSV with one row and two columns - Contact ID,email address
In Civicrm Contacts-> Import Contacts Select the csv created above, Change the "For Duplicate contacts" option to "Update" or "Fill". Step through rest of the import - mapping the contact ID and email to the appropriate fields.
Using the api explorer (or via the database/drush etc) check the email for this contact
drush cvapi Email.get sequential=1 return="is_primary" contact_id=209
{
"is_error": 0,
"version": 3,
"count": 1,
"id": 191,
"values": [
{
"id": "191",
"is_primary": "0"
}
]
}
Impact:
If a contact has only one email it should be set to primary. If it's not set to primary they are not emailable. They will not be included in bulk mailings. If attempting to use action mail from their profile you will get a warning "Selected contact(s) do not have a valid email address, or communication preferences specify DO NOT EMAIL, or they are deceased or Primary email address is On Hold".
Clicking on the email to edit shows it marked as primary - you can see however in the database or using the api explorer it's not set as primary.
This is possibly a wider data integrity issue - is there ever a case whereby a contact has one email and it shouldn't be set to primary?