Cases: Edit Activity does not save tags
Overview
When editing an Activity for cases, the selected tags
are not saved.
Steps to reproduce
- Create new case
- Open a specific activity `/civicrm/case/activity?action=update&id=<ACTIVITY_ID>&cid=76&caseid=<CASE_ID>&reset=1
- Add a new tag, and SAVE
- See that the tags are not saved.
Screenshot
Technical Solution
In https://github.com/civicrm/civicrm-core/blob/3bf2661bd263d718e867ad5170965d1bcb110df6/CRM/Case/Form/Activity.php#L546 it is assumed that $params['tag']
is an array, but actually is a comma separated string.
But in the parent class CRM_Activity_Form_Activity
, this feature works because of the code https://github.com/civicrm/civicrm-core/blob/43076c76f4724d0f42ceb03b46acfbce2c751233/CRM/Activity/Form/Activity.php#L1066, which converts the string to an Array.
So similar code needs to be implemented in CRM_Case_Form_Activity
.
if (!empty($params['tag'])) {
if (!is_array($params['tag'])) {
$params['tag'] = explode(',', $params['tag']);
}
foreach ($params['tag'] as $tag) {
$tagParams[$tag] = 1;
}
}