$activityId = NULL,
$key = NULL,
$compContext = NULL) {
- static $activityActTypes = NULL;
- //CRM-14277 added addtitional param to handle activity search
+
+ //CRM-14277 added additional param to handle activity search
$extraParams = "&searchContext=activity";
$extraParams .= ($key) ? "&key={$key}" : NULL;
$showView = TRUE;
$showUpdate = $showDelete = FALSE;
$qsUpdate = NULL;
+ $url = NULL;
+ $qsView = NULL;
- if (!$activityActTypes) {
- $activeActTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'name', TRUE);
- }
- $activityTypeName = CRM_Utils_Array::value($activityTypeId, $activeActTypes);
+ $activityTypeName = CRM_Core_PseudoConstant::getName('CRM_Activity_BAO_Activity', 'activity_type_id', $activityTypeId);
// CRM-7607
// Lets allow to have normal operation for only activity types.
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
- // Get all activity types
- $activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'name', TRUE);
+ $bulkActivityTypeID = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Bulk Email');
while ($result->fetch()) {
$row = array();
if ($row['activity_is_test']) {
$row['activity_type'] = $row['activity_type'] . " (test)";
}
- $bulkActivityTypeID = CRM_Utils_Array::key('Bulk Email', $activityTypes);
$row['mailingId'] = '';
if (
$accessCiviMail &&
$caseCount = CRM_Core_DAO::singleValueQuery('SELECT FOUND_ROWS()');
$activityTypes = CRM_Case_PseudoConstant::caseActivityType(FALSE, TRUE);
- $activityStatuses = CRM_Core_PseudoConstant::activityStatus();
$url = CRM_Utils_System::url("civicrm/case/activity",
"reset=1&cid={$contactID}&caseid={$caseID}", FALSE, NULL, FALSE
$caseActivities = array();
while ($dao->fetch()) {
- $caseActivity = array();
$caseActivityId = $dao->id;
$allowView = self::checkPermission($caseActivityId, 'view', $dao->activity_type_id, $userID);
}
}
- //Activity Status
- $caseActivities[$caseActivityId]['status_id'] = $activityStatuses[$dao->status];
+ // Activity Status Label for Case activities list
+ $caseActivities[$caseActivityId]['status_id'] = CRM_Core_PseudoConstant::getLabel('CRM_Activity_BAO_Activity', 'activity_status_id', $dao->status);
// FIXME: Why are we not using CRM_Core_Action for these links? This is too much manual work and likely to get out-of-sync with core markup.
$url = "";
return array();
}
- $linkActType = array_search('Link Cases',
- CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'name')
- );
+ $linkActType = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Link Cases');
if (!$linkActType) {
return array();
}
return $mainCaseIds;
}
- $activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'name');
- $activityStatuses = CRM_Core_PseudoConstant::activityStatus('name');
+ $activityTypes = CRM_Activity_BAO_Activity::buildOptions('activity_type_id', 'validate');
+ $completedActivityStatus = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_status_id', 'Completed');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
}
}
- //Create merge activity record. Source for merge activity is the logged in user's contact ID ($currentUserId).
+ // Create merge activity record. Source for merge activity is the logged in user's contact ID ($currentUserId).
$activityParams = array(
'subject' => $mergeActSubject,
'details' => $mergeActSubjectDetails,
- 'status_id' => array_search('Completed', $activityStatuses),
+ 'status_id' => $completedActivityStatus,
'activity_type_id' => $mergeActType,
'source_contact_id' => $currentUserId,
'activity_date_time' => date('YmdHis'),
//do further only when operation is granted.
if ($allow) {
- $activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'name');
-
- //get the activity type name.
- $actTypeName = CRM_Utils_Array::value($actTypeId, $activityTypes);
+ $actTypeName = CRM_Core_PseudoConstant::getName('CRM_Activity_BAO_Activity', 'activity_type_id', $actTypeId);
//do not allow multiple copy / edit action.
$singletonNames = array(
/**
* Get a single activity record by type.
+ * This function is only used by SequenceListenerTest
*
* @param string $type
* @throws \Civi\CCase\Exception\MultipleActivityException
*/
public function getSingleActivity($type) {
$idx = $this->getActivityIndex(array('activity_type_id', 'id'));
- $actTypes = array_flip(\CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'name'));
+ $actTypes = array_flip(\CRM_Activity_BAO_Activity::buildOptions('activity_type_id', 'validate'));
$typeId = $actTypes[$type];
$count = isset($idx[$typeId]) ? count($idx[$typeId]) : 0;