From: deb.monish Date: Thu, 28 Jul 2016 09:33:14 +0000 (+0530) Subject: CRM-19135: preferred_mail_format not selecting translated labels in international... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=33997bc390b586d93fcbf8cdbcdeef922d1dbd3e;p=civicrm-core.git CRM-19135: preferred_mail_format not selecting translated labels in international versions --- diff --git a/CRM/Contact/Form/Edit/CommunicationPreferences.php b/CRM/Contact/Form/Edit/CommunicationPreferences.php index 5adefd8d6f..7ab867c8bb 100644 --- a/CRM/Contact/Form/Edit/CommunicationPreferences.php +++ b/CRM/Contact/Form/Edit/CommunicationPreferences.php @@ -168,6 +168,9 @@ class CRM_Contact_Form_Edit_CommunicationPreferences { 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) { diff --git a/CRM/Contact/Form/Inline/CommunicationPreferences.php b/CRM/Contact/Form/Inline/CommunicationPreferences.php index f9a6b60075..e792eb0d00 100644 --- a/CRM/Contact/Form/Inline/CommunicationPreferences.php +++ b/CRM/Contact/Form/Inline/CommunicationPreferences.php @@ -64,6 +64,12 @@ class CRM_Contact_Form_Inline_CommunicationPreferences extends CRM_Contact_Form_ $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')); }