!empty($params['contact_sub_type_hidden'])
) {
// if profile was used, and had any subtype, we obtain it from there
- $data['contact_sub_type'] = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, (array) $params['contact_sub_type_hidden']) . CRM_Core_DAO::VALUE_SEPARATOR;
+ //CRM-13596 - add to existing contact types, rather than overwriting
+ $data_contact_sub_type_arr = explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($data['contact_sub_type'], CRM_Core_DAO::VALUE_SEPARATOR));
+ if (!in_array($params['contact_sub_type_hidden'], $data_contact_sub_type_arr)) {
+ $data['contact_sub_type'] = $data['contact_sub_type'] . implode(CRM_Core_DAO::VALUE_SEPARATOR, (array)$params['contact_sub_type_hidden']) . CRM_Core_DAO::VALUE_SEPARATOR;
+ }
}
if ($ctype == 'Organization') {
}
}
- $type = $data['contact_type'];
- if (!empty($data['contact_sub_type'])) {
- $type = $data['contact_sub_type'];
- $type = explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($type, CRM_Core_DAO::VALUE_SEPARATOR));
- // generally a contact even if, has multiple subtypes the parent-type is going to be one only
- // and since formatCustomField() would be interested in parent type, lets consider only one subtype
- // as the results going to be same.
- $type = $type[0];
+ //CRM-13596 - check for contact_sub_type_hidden first
+ if (array_key_exists('contact_sub_type_hidden', $params)) {
+ $type = $params['contact_sub_type_hidden'];
+ }
+ else {
+ $type = $data['contact_type'];
+ if (!empty($data['contact_sub_type'])) {
+ $type = $data['contact_sub_type'];
+ $type = explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($type, CRM_Core_DAO::VALUE_SEPARATOR));
+ // generally a contact even if, has multiple subtypes the parent-type is going to be one only
+ // and since formatCustomField() would be interested in parent type, lets consider only one subtype
+ // as the results going to be same.
+ $type = $type[0];
+ }
}
CRM_Core_BAO_CustomField::formatCustomField($customFieldId,