Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Include Case ID in Activity Detail report
--- CRM/Report/Form/Activity.php.orig
+++ CRM/Report/Form/Activity.php
@@ -222,6 +222,16 @@
),
),
),
+ 'civicrm_case_activity' => array(
+ 'dao' => 'CRM_Case_DAO_CaseActivity',
+ 'fields' => array(
+ 'case_id' => array(
+ 'name' => 'case_id',
+ 'title' => ts('Case ID'),
+ 'type' => CRM_Utils_Type::T_INT,
+ ),
+ ),
+ ),
'civicrm_activity' => array(
'dao' => 'CRM_Activity_DAO_Activity',
'fields' => array(
@@ -524,6 +534,8 @@
{$this->_aliases['civicrm_activity_contact']}.record_type_id = {$targetID}
INNER JOIN civicrm_contact civicrm_contact_target
ON {$this->_aliases['civicrm_activity_contact']}.contact_id = civicrm_contact_target.id
+ LEFT JOIN civicrm_case_activity {$this->_aliases['civicrm_case_activity']}
+ ON {$this->_aliases['civicrm_activity']}.id = {$this->_aliases['civicrm_case_activity']}.activity_id
{$this->_aclFrom}";
if ($this->isTableSelected('civicrm_email')) {
@@ -852,6 +864,8 @@
INNER JOIN civicrm_activity_contact {$this->_aliases['civicrm_activity_contact']} ON {$this->_aliases['civicrm_activity_contact']}.activity_id
_aliases['civicrm_activity']}.id
AND {$this->_aliases['civicrm_activity_contact']}.record_type_id = {$sourceID}
LEFT JOIN civicrm_contact contact_civireport ON contact_civireport.id = {$this->_aliases['civicrm_activity_contact']}.contact_id
+ LEFT JOIN civicrm_case_activity {$this->_aliases['civicrm_case_activity']}
+ ON {$this->_aliases['civicrm_activity']}.id = {$this->_aliases['civicrm_case_activity']}.activity_id
{$this->_where} {$groupByFromSelect} {$this->_having} {$this->_orderBy} {$this->_limit}";
CRM_Utils_Hook::alterReportVar('sql', $this, $this);
@@ -1131,6 +1145,8 @@
{$this->_aliases['civicrm_activity_contact']}.record_type_id = {$assigneeID}
INNER JOIN civicrm_contact civicrm_contact_assignee
ON {$this->_aliases['civicrm_activity_contact']}.contact_id = civicrm_contact_assignee.id
+ LEFT JOIN civicrm_case_activity {$this->_aliases['civicrm_case_activity']}
+ ON {$this->_aliases['civicrm_activity']}.id = {$this->_aliases['civicrm_case_activity']}.activity_id
{$this->_aclFrom}";
if ($this->isTableSelected('civicrm_email')) {
@@ -1165,6 +1181,8 @@
{$this->_aliases['civicrm_activity_contact']}.record_type_id = {$sourceID}
INNER JOIN civicrm_contact civicrm_contact_source
ON {$this->_aliases['civicrm_activity_contact']}.contact_id = civicrm_contact_source.id
+ LEFT JOIN civicrm_case_activity {$this->_aliases['civicrm_case_activity']}
+ ON {$this->_aliases['civicrm_activity']}.id = {$this->_aliases['civicrm_case_activity']}.activity_id
{$this->_aclFrom}";
if ($this->isTableSelected('civicrm_email')) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.