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

Activities can be linked to multiple cases. Handle caseIds being an array #13021

Merged
merged 1 commit into from
Oct 28, 2018

Conversation

mattwire
Copy link
Contributor

Overview

This was found when submitting a drupal webform with a case and an activity and some custom code on a post hook which does an activity.get API call and then an activity.create to update the activity.

Here is an example of an API call that will give you an array for case_id:

$result = civicrm_api3('Activity', 'get', [
  'sequential' => 1,
  'return' => ["case_id"],
  'case_id' => ['IS NOT NULL' => 1],
]);

The \Civi\CCase\fireCaseChange function doesn't handle the case when $caseIdsis an array, yet the callback function it calls does handle$caseIds` being an array. The result is that PHP throws some warnings about illegal offset type and the caseId is never added to the static cache and thus gets fired multiple times.

Before

CaseIds as array not handled properly, PHP warnings and case changed event fired multiple times (as not cached).

After

CaseIds as array handled properly. Cached properly and only fired once.

Technical Details

Comments

@civibot
Copy link

civibot bot commented Oct 27, 2018

(Standard links)

@civibot civibot bot added the master label Oct 27, 2018
@colemanw
Copy link
Member

Totally agree with this change. Happy to merge since test pass.

@colemanw colemanw merged commit 9b574de into civicrm:master Oct 28, 2018
@mattwire mattwire deleted the caseactivity_array branch March 1, 2019 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants