if (empty($defaults['preferred_mail_format'])) {
$defaults['preferred_mail_format'] = 'Both';
}
+ else {
+ $defaults['preferred_mail_format'] = array_search($defaults['preferred_mail_format'], CRM_Core_SelectValues::pmf());
+ }
//set default from greeting types CRM-4575, CRM-9739
if ($form->_action & CRM_Core_Action::ADD) {
$defaults['preferred_language'] = $config->lcMessages;
}
+ // CRM-19135: where CRM_Core_BAO_Contact::getValues() set label as a default value instead of reserved 'value',
+ // the code is to ensure we always set default to value instead of label
+ if (!empty($defaults['preferred_mail_format'])) {
+ $defaults['preferred_mail_format'] = array_search($defaults['preferred_mail_format'], CRM_Core_SelectValues::pmf());
+ }
+
if (empty($defaults['communication_style_id'])) {
$defaults['communication_style_id'] = array_pop(CRM_Core_OptionGroup::values('communication_style', TRUE, NULL, NULL, 'AND is_default = 1'));
}