Unverified Commit bddff5e6 authored by Seamus Lee's avatar Seamus Lee Committed by GitHub

Merge pull request #17200 from eileenmcnaughton/rep

#1729 Fix filters skipping on activity report
parents 658971ca 54df7b0b
......@@ -542,7 +542,7 @@ class CRM_Report_Form_Activity extends CRM_Report_Form {
}
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),
......
......@@ -1259,6 +1259,23 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase {
$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.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment