Skip to content

Commit

Permalink
Merge pull request #14110 from mattwire/caseactivitylinks_partial
Browse files Browse the repository at this point in the history
REF Don't pass activity object to addCaseActivityLinks
  • Loading branch information
eileenmcnaughton authored Apr 25, 2019
2 parents 64eaa69 + c1c1b93 commit 824a466
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
26 changes: 16 additions & 10 deletions CRM/Case/BAO/Case.php
Original file line number Diff line number Diff line change
Expand Up @@ -1151,9 +1151,18 @@ public static function getCaseActivity($caseID, &$params, $contactID, $context =

// Activity Status Label for Case activities list
$caseActivities[$caseActivityId]['status_id'] = CRM_Core_PseudoConstant::getLabel('CRM_Activity_BAO_Activity', 'activity_status_id', $dao->status);
$deleted = '';
if ($dao->deleted) {
$deleted = '<br /> ' . ts('(deleted)');
}
$caseActivities[$caseActivityId]['status_id'] = CRM_Core_PseudoConstant::getLabel('CRM_Activity_BAO_Activity', 'activity_status_id', $dao->status) . $deleted;
// if there are file attachments we will return how many
if (!empty($dao->attachment_ids)) {
$attachmentIDs = array_unique(explode(',', $dao->attachment_ids));
$caseActivity['no_attachments'] = count($attachmentIDs);
}

$caseActivities[$caseActivityId]
= self::addCaseActivityLinks($caseID, $contactID, $userID, $context, $dao, $caseActivities[$caseActivityId]);
$caseActivities[$caseActivityId]['links'] = self::addCaseActivityLinks($caseID, $contactID, $userID, $context, $dao);
}

$caseActivitiesDT = array();
Expand All @@ -1173,11 +1182,11 @@ public static function getCaseActivity($caseID, &$params, $contactID, $context =
* @param int $userID
* @param string $context
* @param \CRM_Core_DAO $dao
* @param array $caseActivity
*
* @return array caseActivity
* @return string
* HTML formatted Link
*/
public static function addCaseActivityLinks($caseID, $contactID, $userID, $context, $dao, $caseActivity) {
private static function addCaseActivityLinks($caseID, $contactID, $userID, $context, $dao) {
// 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.
$caseActivityId = $dao->id;
$allowView = self::checkPermission($caseActivityId, 'view', $dao->activity_type_id, $userID);
Expand Down Expand Up @@ -1221,7 +1230,6 @@ public static function addCaseActivityLinks($caseID, $contactID, $userID, $conte
}
elseif (!$caseDeleted) {
$url = ' <a ' . $css . ' href="' . $restoreUrl . $additionalUrl . '">' . ts('Restore') . '</a>';
$caseActivity['status_id'] = $caseActivity['status_id'] . '<br /> (deleted)';
}

//check for operations.
Expand All @@ -1233,12 +1241,10 @@ public static function addCaseActivityLinks($caseID, $contactID, $userID, $conte
}
// if there are file attachments we will return how many and, if only one, add a link to it
if (!empty($dao->attachment_ids)) {
$attachmentIDs = array_unique(explode(',', $dao->attachment_ids));
$caseActivity['no_attachments'] = count($attachmentIDs);
$url .= implode(' ', CRM_Core_BAO_File::paperIconAttachment('civicrm_activity', $caseActivityId));
}
$caseActivity['links'] = $url;
return $caseActivity;

return $url;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion CRM/Case/Selector/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
$isDeleted = FALSE;
if ($result->case_deleted) {
$isDeleted = TRUE;
$row['case_status_id'] = empty($row['case_status_id']) ? "" : $row['case_status_id'] . '<br />(deleted)';
$row['case_status_id'] = empty($row['case_status_id']) ? "" : $row['case_status_id'] . '<br />' . ts('(deleted)');
}

$scheduledInfo['case_id'][] = $result->case_id;
Expand Down

0 comments on commit 824a466

Please sign in to comment.