From f1d04518b8d11323a4a2d02fde1d2fddd89bc592 Mon Sep 17 00:00:00 2001 From: Jamie McClelland Date: Tue, 9 Jun 2020 15:37:19 -0400 Subject: [PATCH] ensure custom field checkboxes are populated in profiles --- CRM/Core/BAO/UFGroup.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CRM/Core/BAO/UFGroup.php b/CRM/Core/BAO/UFGroup.php index b4e01738ca..34490de330 100644 --- a/CRM/Core/BAO/UFGroup.php +++ b/CRM/Core/BAO/UFGroup.php @@ -2326,6 +2326,14 @@ AND ( entity_id IS NULL OR entity_id <= 0 ) } elseif (CRM_Core_BAO_CustomField::getKeyID($name)) { $defaults[$fldName] = self::formatCustomValue($field, $details[$name]); + if (!$singleProfile && $field['html_type'] === 'CheckBox') { + // For batch update profile there needs to be a key lik + // $defaults['field[166]['custom_8'][2]'] => 1 where + // 166 is the conntact id, 8 is the field id and 2 is the checkbox option. + foreach ($defaults[$fldName] as $itemKey => $itemValue) { + $defaults[$fldName . '[' . $itemKey . ']'] = $itemValue; + } + } } else { $defaults[$fldName] = $details[$name]; @@ -3585,6 +3593,7 @@ SELECT group_id if (CRM_Core_BAO_CustomField::isSerialized($field)) { $value = CRM_Utils_Array::explodePadded($value); + // This may not be required now. if ($field['html_type'] === 'CheckBox') { $checkboxes = []; foreach (array_filter($value) as $item) { -- 2.25.1