Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 3.1.5, 3.1.6, 3.2
-
Fix Version/s: 3.2.2
-
Component/s: Core CiviCRM
-
Labels:None
Description
There's a bug that occurs if you try to send messages to two separate email addresses for the same contact. If you accidentally type the same contact twice, it catches the issue, sends one email to the one address, and records the activity as having the one target. On the other hand, if it's going to two separate addresses, it sends to both but attempts to record the contact IDs for each as targets of the activity. Since they're the same, it causes an error saying that you're trying to set a duplicate record for the link between the activity and the target contact. Both addresses do get the email. I don't know if it's preferable to:
A. Send only one email to the contact, using the primary address (or at least the first of the ones listed), or
B. Send an email to each address but only save a single civicrm_activity_target record.
I lean towards B, since I could imagine a situation where you're trying to reach someone who's on vacation by trying both their work address and their personal one.
Error Details:
Array
(
[callback] => Array
(
[0] => CRM_Core_Error
[1] => handle
)
[code] => -5
[message] => DB Error: already exists
[mode] => 16
[debug_info] => INSERT INTO civicrm_activity_target (activity_id , target_contact_id ) VALUES ( 6104 , 8 ) [nativecode=1062 ** Duplicate entry '8-6104' for key 'UI_activity_target_contact_id']
[type] => DB_Error
[user_info] => INSERT INTO civicrm_activity_target (activity_id , target_contact_id ) VALUES ( 6104 , 8 ) [nativecode=1062 ** Duplicate entry '8-6104' for key 'UI_activity_target_contact_id']
[to_string] => [db_error: message="DB Error: already exists" code=-5 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_activity_target (activity_id , target_contact_id ) VALUES ( 6104 , 8 ) [nativecode=1062 ** Duplicate entry '8-6104' for key 'UI_activity_target_contact_id']"]
)