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

CRM-20642 - Activity.get - Fix "IS NULL" filtering for case_id, tag_id, file_id #10451

Merged
merged 2 commits into from
Jun 2, 2017

Conversation

totten
Copy link
Member

@totten totten commented May 31, 2017

Context

You could call Activity.get with the field case_id, tag_id, or file_id. The field could specify a number or an array (e.g. array('IS NOT NULL'=>1) or array('>'=>100)).

Before

Specifying a filter like case_id => array('IS NULL'=>1) was meaningless. It led to an incorrect subquery.

After

IS NULL filtering leads to a LEFT JOIN and WHERE the_column IS NULL.

Acceptance Criteria

  • Previously supported queries continue to work the same as before.
  • Queries using IS NULL also work.

totten added 2 commits May 31, 2017 15:42
CRM-20642 requires an option for displaying "activities which are *not*
case-related" (i.e.  `case_id IS NULL`) .  This adds a unit-test for
ensuring that the filter works as expected.
totten added a commit to totten/org.civicrm.civicase that referenced this pull request Jun 1, 2017
In the "display options", this conditionally adds a checkbox "Show case
activities". Contingencies:

 * If the `ActivityFeed` is embedded within a case, then the `Activity.get` query filters on `case_id = civicrm#123`, and the option "Show case activities" is not available.
 * If "Show case activities" is enabled, then the `Activity.get` query does not filter on `case_id`. (Case and non-case activities are displayed.)
 * If "Show case activities" is disabled, then the `Activity.get` query filters on `case_id IS NULL`. (Only non-case activities are displayed.)

Depends on civicrm/civicrm-core#10451 for correct results
@colemanw colemanw merged commit 503a995 into civicrm:master Jun 2, 2017
@totten totten deleted the master-null-caseid branch June 2, 2017 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants