<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
+ | CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
$hasAccessToAllCases = CRM_Core_Permission::check('access all cases and activities');
$managerRoleId = $xmlProcessor->getCaseManagerRoleId($caseTypeName);
- if (!empty($managerRoleId)) {
- $caseRoles[$managerRoleId] = $caseRoles[$managerRoleId] . '<br />' . '(' . ts('Case Manager') . ')';
- }
-
- $relationships = array();
foreach ($caseRelationships as $key => $value) {
- //calculate roles that don't have relationships
- if (!empty($caseRoles[$value['relation_type']])) {
- //keep naming from careRoles array
- $caseRelationships[$key]['relation'] = $caseRoles[$value['relation_type']];
- unset($caseRoles[$value['relation_type']]);
- }
+ // This role has been filled
+ unset($caseRoles[$value['relation_type']]);
// mark original case relationships record to use on setting edit links below
$caseRelationships[$key]['source'] = 'caseRel';
}
// set user name, email and edit columns links
foreach ($caseRelationships as $key => &$row) {
- // Get rid of the "<br />(Case Manager)" from label
- list($typeLabel) = explode('<', $row['relation']);
+ $typeLabel = $row['relation'];
+ // Add "<br />(Case Manager)" to label
+ if ($row['relation_type'] == $managerRoleId) {
+ $row['relation'] .= '<br />' . '(' . ts('Case Manager') . ')';
+ }
// view user links
if (!empty($row['cid'])) {
$row['name'] = '<a class="view-contact" title="' . ts('View Contact') . '" href=' . CRM_Utils_System::url('civicrm/contact/view',
$contactType = $contactType == 'Contact' ? '' : $contactType;
switch ($row['source']) {
case 'caseRel':
- $row['actions'] = '<a href="#editCaseRoleDialog" title="' . ts('Reassign %1', array(1 => $typeLabel)) . '" class="crm-hover-button case-miniform" data-contact_type="' . $contactType . '" data-rel_type="' . $row['relation_type'] . '" data-rel_id="' . $row['rel_id'] . '"data-key="' . CRM_Core_Key::get('civicrm/ajax/relation') . '">' .
+ $row['actions'] = '<a href="#editCaseRoleDialog" title="' . ts('Reassign %1', array(1 => $typeLabel)) . '" class="crm-hover-button case-miniform" data-contact_type="' . $contactType . '" data-rel_type="' . $row['relation_type'] . '_' . $row['relationship_direction'] . '" data-cid="' . '" data-rel_id="' . $row['rel_id'] . '"data-key="' . CRM_Core_Key::get('civicrm/ajax/relation') . '">' .
'<span class="icon ui-icon-pencil"></span>' .
'</a>' .
- '<a href="#deleteCaseRoleDialog" title="' . ts('Remove %1', array(1 => $typeLabel)) . '" class="crm-hover-button case-miniform" data-contact_type="' . $contactType . '" data-rel_type="' . $row['relation_type'] . '" data-key="' . CRM_Core_Key::get('civicrm/ajax/delcaserole') . '">' .
+ '<a href="#deleteCaseRoleDialog" title="' . ts('Remove %1', array(1 => $typeLabel)) . '" class="crm-hover-button case-miniform" data-contact_type="' . $contactType . '" data-rel_type="' . $row['relation_type'] . '_' . $row['relationship_direction'] . '" data-cid="' . $row['cid'] . '" data-key="' . CRM_Core_Key::get('civicrm/ajax/delcaserole') . '">' .
'<span class="icon delete-icon"></span>' .
'</a>';
break;
case 'caseRoles':
- $row['actions'] = '<a href="#editCaseRoleDialog" title="' . ts('Assign %1', array(1 => $typeLabel)) . '" class="crm-hover-button case-miniform" data-contact_type="' . $contactType . '" data-rel_type="' . $row['relation_type'] . '" data-key="' . CRM_Core_Key::get('civicrm/ajax/relation') . '">' .
+ $row['actions'] = '<a href="#editCaseRoleDialog" title="' . ts('Assign %1', array(1 => $typeLabel)) . '" class="crm-hover-button case-miniform" data-contact_type="' . $contactType . '" data-rel_type="' . $row['relation_type'] . '_b_a" data-key="' . CRM_Core_Key::get('civicrm/ajax/relation') . '">' .
'<span class="icon ui-icon-pencil"></span>' .
'</a>';
break;
$session = CRM_Core_Session::singleton();
$userID = $session->get('userID');
if ($userID) {
- //flush cache before setting filter to account for global cache (memcache)
- $domainID = CRM_Core_Config::domainID();
- $cacheKey = CRM_Core_BAO_Setting::inCache(
- CRM_Core_BAO_Setting::PERSONAL_PREFERENCES_NAME,
- 'activity_tab_filter',
- NULL,
- $userID,
- TRUE,
- $domainID,
- TRUE
- );
- if ($cacheKey) {
- CRM_Core_BAO_Setting::flushCache($cacheKey);
- }
-
$activityFilter = array(
'activity_type_filter_id' => empty($params['activity_type_id']) ? '' : CRM_Utils_Type::escape($params['activity_type_id'], 'Integer'),
'activity_type_exclude_filter_id' => empty($params['activity_type_exclude_id']) ? '' : CRM_Utils_Type::escape($params['activity_type_exclude_id'], 'Integer'),
);
- CRM_Core_BAO_Setting::setItem(
- $activityFilter,
- CRM_Core_BAO_Setting::PERSONAL_PREFERENCES_NAME,
- 'activity_tab_filter',
- NULL,
- $userID,
- $userID
- );
+ /** @var \Civi\Core\SettingsBag $cSettings */
+ $cSettings = Civi::service('settings_manager')->getBagByContact(CRM_Core_Config::domainID(), $userID);
+ $cSettings->set('activity_tab_filter', $activityFilter);
}
CRM_Utils_JSON::output($activities);