Skip to content

Commit

Permalink
CRM-20642 - ActivityFeed - Implement the include_case filter
Browse files Browse the repository at this point in the history
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
  • Loading branch information
totten committed May 31, 2017
1 parent 8e9f479 commit 721892f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions ang/civicase/ActivityControls.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
<label for="act_control_overdue_first">{{ ts('Show overdue activities first') }}</label>
</span>
</li>
<li ng-show="!params.case_id">
<span>
<input type="checkbox" id="act_control_include_case" ng-model="displayOptions.include_case" />
<label for="act_control_include_case">{{ ts('Show case activities') }}</label>
</span>
</li>
</ul>
</div>
<div class="btn-group btn-group-sm" data-toggle="buttons">
Expand Down
10 changes: 8 additions & 2 deletions ang/civicase/ActivityFeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

angular.module('civicase').config(function($routeProvider) {
$routeProvider.when('/activity/feed', {
template: '<div id="bootstrap-theme" class="civicase-main" civicase-activity-feed="{filters:{case_id:{\'IS NOT NULL\': 1}}}"></div>'
template: '<div id="bootstrap-theme" class="civicase-main" civicase-activity-feed="{}"></div>'
});
});

Expand Down Expand Up @@ -32,7 +32,8 @@

var displayOptions = $scope.displayOptions = CRM.cache.get('activityFeedDisplayOptions', {
followup_nested: true,
overdue_first: true
overdue_first: true,
include_case: true
});

var involving = $scope.involving = {
Expand Down Expand Up @@ -141,6 +142,11 @@
if (caseId) {
params.case_id = caseId;
}
else {
if (!displayOptions.include_case) {
params.case_id = {'IS NULL': 1};
}
}
_.each($scope.filters, function(val, key) {
if (val) {
if (key === 'text') {
Expand Down

0 comments on commit 721892f

Please sign in to comment.