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#1729 - Fix filters skipping on activity report #17200

Merged
merged 1 commit into from
Apr 30, 2020
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion CRM/Report/Form/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ public function where($recordType = NULL) {
}
else {
$op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op && !($fieldName == "contact_{$recordType}" && ($op != 'nnll' || $op != 'nll'))) {
if ($op && !($fieldName === "contact_{$recordType}" && ($op === 'nnll' || $op === 'nll'))) {
$clause = $this->whereClause($field,
$op,
CRM_Utils_Array::value("{$fieldName}_value", $this->_params),
Expand Down
17 changes: 17 additions & 0 deletions tests/phpunit/api/v3/ReportTemplateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,23 @@ public function testActivityDetailsNullFilters() {
$this->assertEmpty($rowsWithNullTarget);
}

/**
* Test the source contact filter works.
*
* @throws \CRM_Core_Exception
*/
public function testActivityDetailsContactFilter() {
$this->createContactsWithActivities();
$params = [
'report_id' => 'activity',
'contact_source_op' => 'has',
'contact_source_value' => 'z',
'options' => ['metadata' => ['sql']],
];
$rows = $this->callAPISuccess('report_template', 'getrows', $params);
$this->assertContains("civicrm_contact_source.sort_name LIKE '%z%'", $rows['metadata']['sql'][3]);
}

/**
* Set up some activity data..... use some chars that challenge our utf handling.
*/
Expand Down