* ID of the case.
*
* @param int $contactID
+ * @param int $startArrayAt This is to support legacy calls to Case.Get API which may rely on the first array index being set to 1
*
* @return array
*/
- public static function retrieveContactIdsByCaseId($caseId, $contactID = NULL) {
+ public static function retrieveContactIdsByCaseId($caseId, $contactID = NULL, $startArrayAt = 0) {
$caseContact = new CRM_Case_DAO_CaseContact();
$caseContact->case_id = $caseId;
$caseContact->find();
$contactArray = array();
- // FIXME: Why does this return a 1-based array?
- $count = 1;
+ $count = $startArrayAt;
while ($caseContact->fetch()) {
if ($contactID != $caseContact->contact_id) {
$contactArray[$count] = $caseContact->contact_id;
$casesList[$key]['activity_list'] = sprintf('<a title="%s" class="crm-expand-row" href="%s"></a>',
ts('Activities'),
- CRM_Utils_System::url('civicrm/case/details', array('caseid' => $case['case_id'], 'cid' => $case['contact_id'], 'type' => $type))
+ CRM_Utils_System::url('civicrm/case/details', array('caseId' => $case['case_id'], 'cid' => $case['contact_id'], 'type' => $type))
);
$phone = empty($case['phone']) ? '' : '<br /><span class="description">' . $case['phone'] . '</span>';
}
if (self::checkPermission($actId, 'edit', $case['activity_type_id'], $userID)) {
$casesList[$key]['date'] .= sprintf('<a class="action-item crm-hover-button" href="%s" title="%s"><i class="crm-i fa-pencil"></i></a>',
- CRM_Utils_System::url('civicrm/case/activity', array('reset' => 1, 'cid' => $case['contact_id'], 'caseid' => $case['case_id'], 'action' => 'update')),
+ CRM_Utils_System::url('civicrm/case/activity', array('reset' => 1, 'cid' => $case['contact_id'], 'caseid' => $case['case_id'], 'action' => 'update', 'id' => $actId)),
ts('Edit activity')
);
}
$contactViewUrl = CRM_Utils_System::url("civicrm/contact/view", "reset=1&cid=", FALSE, NULL, FALSE);
$hasViewContact = CRM_Core_Permission::giveMeAllACLs();
- $clientIds = self::retrieveContactIdsByCaseId($caseID);
if (!$userID) {
$session = CRM_Core_Session::singleton();
AND civicrm_case.id IN( {$caseID})
AND civicrm_case.is_deleted = {$cases['case_deleted']}";
- $query = self::getCaseActivityQuery($type, $userID, $condition, $cases['case_deleted']);
+ $query = self::getCaseActivityQuery($type, $userID, $condition);
$res = CRM_Core_DAO::executeQuery($query);
//allow edit operation.
$allowEditNames = array('Open Case');
+ if (CRM_Core_Permission::check('edit inbound email basic information') ||
+ CRM_Core_Permission::check('edit inbound email basic information and content')
+ ) {
+ $allowEditNames[] = 'Inbound Email';
+ }
+
// do not allow File on Case
$doNotFileNames = array(
'Open Case',