Skip to content
Snippets Groups Projects
Commit 2e11a174 authored by jaapjansma's avatar jaapjansma
Browse files

Fixed issue with View and Edit an activity in Activity Search.

parent 4b1f33df
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@
* Fixed custom link field so that the raw value also contains the html link (#55).
* Fix for Field filter. It did not work on a custom field that has the type country.
* Added image field output handler (!61)
* Fixed issue with View and Edit an activity in Activity Search.
# Version 1.16
......
......@@ -25,7 +25,35 @@ class CRM_DataprocessorSearch_Form_ActivitySearch extends CRM_DataprocessorSearc
* @return false|string
*/
protected function link($row) {
return CRM_Utils_System::url('civicrm/activity', 'reset=1&action=view&id='.$row['id']);
$activity = civicrm_api3('Activity', 'getsingle', ['id' => $row['id'], "return" => ["target_contact_id", "source_record_id", "activity_type_id"]]);
$activity['cid'] = reset($activity['target_contact_id']);
unset($activity['target_contact_id']);
unset($activity['target_contact_name']);
unset($activity['target_contact_sort_name']);
$activity['cxt'] = '';
// CRM-3553
$accessMailingReport = FALSE;
if (!empty($activity['mailingId'])) {
$accessMailingReport = TRUE;
}
$actionLinks = \CRM_Activity_Selector_Activity::actionLinks(CRM_Utils_Array::value('activity_type_id', $activity),
CRM_Utils_Array::value('source_record_id', $activity),
$accessMailingReport,
CRM_Utils_Array::value('activity_id', $activity)
);
$link = $actionLinks[\CRM_Core_Action::VIEW];
$values = $activity;
$extra = isset($link['extra']) ? \CRM_Core_Action::replace($link['extra'], $values) : NULL;
$frontend = isset($link['fe']);
if (isset($link['qs']) && !\CRM_Utils_System::isNull($link['qs'])) {
$urlPath = \CRM_Utils_System::url(\CRM_Core_Action::replace($link['url'], $values), \CRM_Core_Action::replace($link['qs'], $values), FALSE, NULL, TRUE, $frontend);
}
else {
$urlPath = \CRM_Utils_Array::value('url', $link, '#');
}
return $urlPath;
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment