Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#1710 Ensure that civicrm_case_activity is properly populated… #17128

Merged
merged 1 commit into from
Apr 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions CRM/Report/Form/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,10 @@ public function __construct() {
'operatorType' => CRM_Report_Form::OP_SELECT,
'options' => ['0' => ts('No'), '1' => ts('Yes')],
];
$this->_columns['civicrm_case_activity'] = [
'dao' => 'CRM_Case_DAO_CaseActivity',
'fields' => [],
];
}

if ($campaignEnabled) {
Expand Down Expand Up @@ -349,22 +353,16 @@ public function __construct() {
parent::__construct();
}

public function preProcess() {
// Is "Include Case Activities" selected? If yes, include the case_id as a hidden column
$formToUse = $this->noController ? NULL : $this;
$includeCaseActivities = CRM_Utils_Request::retrieve('include_case_activities_value', 'Boolean', $formToUse);
if (!empty($includeCaseActivities)) {
$this->_columns['civicrm_case_activity'] = [
'dao' => 'CRM_Case_DAO_CaseActivity',
'fields' => [
'case_id' => [
'no_display' => TRUE,
'required' => TRUE,
],
],
];
}
parent::preProcess();
protected static function addCaseActivityColumns($columns) {
$columns['civicrm_case_activity']['fields'] = [
'case_id' => [
'title' => ts('Case ID'),
'required' => TRUE,
'dbAlias' => $columns['civicrm_case_activity']['alias'] . '.case_id',
'type' => CRM_Utils_Type::T_INT,
],
];
return $columns;
}

/**
Expand Down Expand Up @@ -733,6 +731,10 @@ public function buildQuery($applyLimit = TRUE) {
}
}

if (!empty($this->_params['include_case_activities_value'])) {
$this->_columns = self::addCaseActivityColumns($this->_columns);
}

// @todo - all this temp table stuff is here because pre 4.4 the activity contact
// form did not exist.
// Fixing the way the construct method declares them will make all this redundant.
Expand Down