*/
function _civicrm_api3_activity_get_extraFilters(&$params, &$sql) {
// Filter by activity contacts
- $recordTypes = civicrm_api3('ActivityContact', 'getoptions', array('field' => 'record_type_id'));
- $recordTypes = $recordTypes['values'];
$activityContactOptions = array(
'contact_id' => NULL,
- 'target_contact_id' => array_search('Activity Targets', $recordTypes),
- 'source_contact_id' => array_search('Activity Source', $recordTypes),
- 'assignee_contact_id' => array_search('Activity Assignees', $recordTypes),
+ 'target_contact_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_ActivityContact', 'record_type_id', 'Activity Targets'),
+ 'source_contact_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_ActivityContact', 'record_type_id', 'Activity Source'),
+ 'assignee_contact_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_ActivityContact', 'record_type_id', 'Activity Assignees'),
);
foreach ($activityContactOptions as $activityContactName => $activityContactValue) {
if (!empty($params[$activityContactName])) {
$contact2 = $this->individualCreate($contact2Params);
+ $this->callAPISuccess('OptionValue', 'get', ['name' => 'Activity Targets', 'api.OptionValue.create' => ['label' => 'oh so creative']]);
+
$params['assignee_contact_id'] = array($contact1, $contact2);
$params['target_contact_id'] = array($contact2 => $contact2);
$activity = $this->callAPISuccess('Activity', 'Create', $params);
- $activityget = $this->callAPISuccess('Activity', 'get', array(
+ $activityGet = $this->callAPISuccess('Activity', 'get', array(
'id' => $activity['id'],
'target_contact_id' => $contact2,
'return.target_contact_id' => 1,
));
- $this->assertEquals($activity['id'], $activityget['id']);
- $this->assertEquals($contact2, $activityget['values'][$activityget['id']]['target_contact_id'][0]);
+ $this->assertEquals($activity['id'], $activityGet['id']);
+ $this->assertEquals($contact2, $activityGet['values'][$activityGet['id']]['target_contact_id'][0]);
- $activityget = $this->callAPISuccess('activity', 'get', array(
+ $activityGet = $this->callAPISuccess('activity', 'get', array(
'target_contact_id' => $this->_contactID,
'return.target_contact_id' => 1,
'id' => $activity['id'],
));
- if ($activityget['count'] > 0) {
- $this->assertNotEquals($contact2, $activityget['values'][$activityget['id']]['target_contact_id'][0]);
+ if ($activityGet['count'] > 0) {
+ $this->assertNotEquals($contact2, $activityGet['values'][$activityGet['id']]['target_contact_id'][0]);
}
}