$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
+ $defaults['source_contact'] = CRM_Activity_BAO_ActivityContact::retrieveContactIdsByActivityId($activity->id, $sourceID);
+
// TODO: at some stage we'll have to deal
// TODO: with multiple values for assignees and targets, but
// TODO: for now, let's just fetch first row
}
$sourceContactId = self::getActivityContact($activity->id, $sourceID);
+ $activity->source_contact_id = $sourceContactId;
if ($sourceContactId &&
!CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
*/
static function &getActivities($input) {
//step 1: Get the basic activity data
- $bulkActivityTypeID = CRM_Core_OptionGroup::getValue('activity_type',
+ $bulkActivityTypeID = CRM_Core_OptionGroup::getValue(
+ 'activity_type',
'Bulk Email',
'name'
);
"civicrm_option_group.name = 'activity_type'",
"civicrm_activity.is_deleted = 0",
"civicrm_activity.is_current_revision = 1",
- "civicrm_activity.is_test = 0",
+ "civicrm_activity.is_test= 0",
);
if ($input['context'] != 'activity') {
$activity = CRM_Activity_BAO_Activity::retrieve($params, $defaults);
$this->assertEquals($activity->subject, 'Scheduling Meeting', 'Verify activity subject is correct.');
- $this->assertEquals($activity->source_contact_id, $contactId, 'Verify source contact id is correct.');
$this->assertEquals($activity->activity_type_id, 2, 'Verify activity type id is correct.');
+ $this->assertEquals($activity->source_contact_id, $contactId, 'Verify source contact id is correct.');
$this->assertEquals($defaults['subject'], 'Scheduling Meeting', 'Verify activity subject is correct.');
- $this->assertEquals($defaults['source_contact_id'], $contactId, 'Verify source contact id is correct.');
$this->assertEquals($defaults['activity_type_id'], 2, 'Verify activity type id is correct.');
$this->assertEquals($defaults['target_contact'][0], $targetContactId, 'Verify target contact id is correct.');
'Database check for created activity target.'
);
- CRM_Activity_BAO_Activity::deleteActivityTarget($activityId);
+ CRM_Activity_BAO_Activity::deleteActivityContact($activityId, 3);
$this->assertDBNull('CRM_Activity_DAO_ActivityContact', $targetContactId, 'id',
'contact_id', 'Database check for deleted activity target.'
'Database check for created activity assignment.'
);
- CRM_Activity_BAO_Activity::deleteActivityAssignment($activityId);
+ CRM_Activity_BAO_Activity::deleteActivityContact($activityId, 1);
$this->assertDBNull('CRM_Activity_DAO_ActivityContact', $assigneeContactId, 'id',
'contact_id', 'Database check for deleted activity assignment.'
first_name="Test"
last_name="Contact 17"
/>
- <!-- Assignee Contact: 2,3 Target Contact: 4,5 -->
+ <!-- Source Contact: 1, Assignee Contact: 2,3 Target Contact: 4,5 -->
<civicrm_activity
id="1"
- source_contact_id="1"
subject="subject 1"
activity_type_id="2"
status_id="1"
/>
- <!-- Assignee Contact: 4,5 Target: 6,7 -->
+ <!-- Source Contact: 2, Assignee Contact: 4,5 Target: 6,7 -->
<civicrm_activity
id="2"
- source_contact_id="2"
subject="subject 2"
activity_type_id="2"
status_id="1"
/>
- <!-- Assignee Contact: 6,7 Target Contact: 8,9 -->
+ <!-- Source Contact: 3, Assignee Contact: 6,7 Target Contact: 8,9 -->
<civicrm_activity
id="3"
- source_contact_id="3"
subject="subject 3"
activity_type_id="2"
status_id="1"
/>
- <!-- Assignee Contact: 8, 9 Target Contact: 10,11 -->
+ <!-- Source Contact: 4, Assignee Contact: 8, 9 Target Contact: 10,11 -->
<civicrm_activity
id="4"
- source_contact_id="4"
subject="subject 4"
activity_type_id="2"
status_id="1"
/>
- <!-- Assignee Contact: 10, 11 Target Contact: 12, 13 -->
+ <!-- Source Contact: 5, Assignee Contact: 10, 11 Target Contact: 12, 13 -->
<civicrm_activity
id="5"
- source_contact_id="5"
subject="subject 5"
activity_type_id="2"
status_id="1"
/>
- <!-- Assignee Contact: 12, 13 Target Contact: 14, 15 -->
+ <!-- Source Contact: 6, Assignee Contact: 12, 13 Target Contact: 14, 15 -->
<civicrm_activity
id="6"
- source_contact_id="6"
subject="subject 6"
activity_type_id="2"
status_id="1"
/>
- <!-- Assignee Contact: 14, 15 Target Contact: 16, 1 -->
+ <!-- Source Contact: 7, Assignee Contact: 14, 15 Target Contact: 16, 1 -->
<civicrm_activity
id="7"
- source_contact_id="7"
subject="subject 7"
activity_type_id="2"
status_id="1"
/>
- <!-- Assignee Contact: 16, 1 Target Contact: 2, 3 -->
+ <!-- Source Contact: 8, Assignee Contact: 16, 1 Target Contact: 2, 3 -->
<civicrm_activity
id="8"
- source_contact_id="8"
subject="subject 8"
activity_type_id="2"
status_id="1"
/>
- <!-- Assignee Contact: 2, 3 Target Contact: 4, 5 -->
+ <!-- Source Contact: 9, Assignee Contact: 2, 3 Target Contact: 4, 5 -->
<civicrm_activity
id="9"
- source_contact_id="9"
subject="subject 9"
activity_type_id="1"
status_id="2"
/>
- <!-- Assignee Contact: 4, 5 Target Contact: 6,7 -->
+ <!-- Source Contact: 10, Assignee Contact: 4, 5 Target Contact: 6,7 -->
<civicrm_activity
id="10"
- source_contact_id="10"
subject="subject 10"
activity_type_id="1"
status_id="2"
/>
- <!-- Assignee Contact: 6, 7 Target Contact: 8, 9 -->
+ <!-- Source Contact: 11, Assignee Contact: 6, 7 Target Contact: 8, 9 -->
<civicrm_activity
id="11"
- source_contact_id="11"
subject="subject 11"
activity_type_id="1"
status_id="2"
/>
- <!-- Assignee Contact: 8, 9 Target Contact: 10, 11 -->
+ <!-- Source Contact: 12, Assignee Contact: 8, 9 Target Contact: 10, 11 -->
<civicrm_activity
id="12"
- source_contact_id="12"
subject="subject 12"
activity_type_id="1"
status_id="2"
/>
- <!-- Assignee Contact: 10, 11 Target Contact: none -->
+ <!-- Source Contact: 13, Assignee Contact: 10, 11 Target Contact: none -->
<civicrm_activity
id="13"
- source_contact_id="13"
subject="subject 13"
activity_type_id="1"
status_id="2"
/>
- <!-- Assignee Contact: none Target Contact: 12, 13 -->
+ <!-- Source Contact: 14, Assignee Contact: none Target Contact: 12, 13 -->
<civicrm_activity
id="14"
- source_contact_id="14"
subject="subject 14"
activity_type_id="1"
status_id="2"
/>
- <!-- Assignee Contact: 13 Target Contact: 14 -->
+ <!-- Source Contact: 15, Assignee Contact: 13 Target Contact: 14 -->
<civicrm_activity
id="15"
- source_contact_id="15"
subject="subject 15"
activity_type_id="1"
status_id="2"
/>
- <!-- Assignee Contact: none Target Contact: none -->
+ <!-- Source Contact: 16, Assignee Contact: none Target Contact: none -->
<civicrm_activity
id="16"
- source_contact_id="16"
subject="subject 16"
activity_type_id="1"
status_id="2"
/>
+ <!-- Source Contacts -->
<civicrm_activity_contact
activity_id="1"
+ contact_id="1"
+ record_type_id="2"
+ />
+ <civicrm_activity_contact
+ activity_id="2"
contact_id="2"
- record_type_id="1"
+ record_type_id="2"
+ />
+ <civicrm_activity_contact
+ activity_id="3"
+ contact_id="3"
+ record_type_id="2"
+ />
+ <civicrm_activity_contact
+ activity_id="4"
+ contact_id="4"
+ record_type_id="2"
+ />
+ <civicrm_activity_contact
+ activity_id="5"
+ contact_id="5"
+ record_type_id="2"
+ />
+ <civicrm_activity_contact
+ activity_id="6"
+ contact_id="6"
+ record_type_id="2"
+ />
+ <civicrm_activity_contact
+ activity_id="7"
+ contact_id="7"
+ record_type_id="2"
+ />
+ <civicrm_activity_contact
+ activity_id="8"
+ contact_id="8"
+ record_type_id="2"
+ />
+ <civicrm_activity_contact
+ activity_id="9"
+ contact_id="9"
+ record_type_id="2"
+ />
+ <civicrm_activity_contact
+ activity_id="10"
+ contact_id="10"
+ record_type_id="2"
+ />
+ <civicrm_activity_contact
+ activity_id="11"
+ contact_id="11"
+ record_type_id="2"
+ />
+ <civicrm_activity_contact
+ activity_id="12"
+ contact_id="12"
+ record_type_id="2"
+ />
+ <civicrm_activity_contact
+ activity_id="13"
+ contact_id="13"
+ record_type_id="2"
+ />
+ <civicrm_activity_contact
+ activity_id="14"
+ contact_id="14"
+ record_type_id="2"
+ />
+ <civicrm_activity_contact
+ activity_id="15"
+ contact_id="15"
+ record_type_id="2"
+ />
+ <civicrm_activity_contact
+ activity_id="16"
+ contact_id="16"
+ record_type_id="2"
/>
<civicrm_activity_contact
activity_id="1"