update a contact if it exists
restore a contact from the deleted, with history and custom field values preserved, name overwritten with what was transferred from the pop-up, non-transmitted fields are not changed, but their values are restored.
if a contact's e-mail and phone number are passed and both identifiers are not in the contacts base - create a new contact with e-mail and phone number.
if a contact's e-mail and phone number are passed, and there is already a passed e-mail in the contacts base - create a new contact with e-mail and phone number:
if the sessions of the existing and new contact coincide, the phone will be added to the contact with e-mail
if the sessions of the existing and new contact do not match, a new contact will be created with the phone only, the e-mail will be saved for the existing contact.
if a contact's e-mail and phone number are transferred, and there is already a transferred phone number in the contacts base, then:
if the sessions of the existing and new contact match, the e-mail will be added to the contact with the phone number
if the sessions of the existing and new contact do not match, a new contact will be created with e-mail only, the phone number will remain with the existing contact.
if e-mail, phone number and session are transferred, and the database already has both identifiers but different contacts, the phone number and session will be assigned to the existing contact with e-mail (if the existing contact already had a session and it is different from the new one, the contact will have two sessions).
if the e-mail and phone number of a contact are passed, and both identifiers already exist in the contacts base, but for different contacts, the passed main fields of the contact and mailing groups will be assigned to the contact with the e-mail address