CRM-19131. Only set source contact ID if we got a value for it.
authorChris Burgess <chris@giantrobot.co.nz>
Tue, 26 Jul 2016 04:19:20 +0000 (16:19 +1200)
committerChris Burgess <chris@giantrobot.co.nz>
Tue, 26 Jul 2016 04:19:20 +0000 (16:19 +1200)
CRM/Utils/DeprecatedUtils.php

index 93f9b37829a1401edbb0209bff517da2a7dcc091..39c04d0f7bbf545a55feeeb85fb6ab98337385e5 100644 (file)
@@ -1527,7 +1527,9 @@ function _civicrm_api3_deprecated_activity_buildmailparams($result, $activityTyp
   $params['activity_type_id'] = $activityTypeID;
 
   $params['status_id'] = 2;
-  $params['source_contact_id'] = $params['assignee_contact_id'] = $result['from']['id'];
+  if (!empty($result['from']['id'])) {
+    $params['source_contact_id'] = $params['assignee_contact_id'] = $result['from']['id'];
+  }
   $params['target_contact_id'] = array();
   $keys = array('to', 'cc', 'bcc');
   foreach ($keys as $key) {