Commit 0482777c authored by bgm's avatar bgm Committed by Aegir user
Browse files

Fixes mixed-entity type profiles, and fixes when a custom field is disabled...

Fixes mixed-entity type profiles, and fixes when a custom field is disabled but still present in the profile
parent 6947cb10
......@@ -23,7 +23,20 @@ class CRM_Activityprofile_APIWrappers_Profile {
'return' => 'group_type',
])['group_type'];
$isContactActivityProfile = ($uf_group_type == 'Case');
// It seems like this can be a string or an array
// and can also mix types together, such as:
// [0] => Case,Contact
// [1] => CaseType:9
if (is_array($uf_group_type)) {
foreach ($uf_group_type as $type) {
if (strpos($type, 'Case') !== FALSE) {
$isContactActivityProfile = TRUE;
}
}
}
elseif (strpos($uf_group_type, 'Case') !== FALSE) {
$isContactActivityProfile = TRUE;
}
}
if (!$isContactActivityProfile || !empty($params['activity_id'])) {
......@@ -140,6 +153,12 @@ class CRM_Activityprofile_APIWrappers_Profile {
'action' => 'get',
])['values'];
// Usually caused by a disabled custom field
if (empty($val)) {
unset($result['values'][$key]);
continue;
}
$val['entity'] = 'Contact';
}
catch (Exception $e) {
......
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