From: jitendrapurohit Date: Thu, 7 Jan 2016 07:21:36 +0000 (+0530) Subject: use setDefault instead X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=cfb54913767d653afd129e3d8f3bda46d73f839b;p=civicrm-core.git use setDefault instead --- diff --git a/CRM/Contact/Form/Edit/CommunicationPreferences.php b/CRM/Contact/Form/Edit/CommunicationPreferences.php index d3e65e6b37..ed3e4dbe8c 100644 --- a/CRM/Contact/Form/Edit/CommunicationPreferences.php +++ b/CRM/Contact/Form/Edit/CommunicationPreferences.php @@ -164,6 +164,11 @@ class CRM_Contact_Form_Edit_CommunicationPreferences { $defaults['communication_style_id'] = array_pop(CRM_Core_OptionGroup::values('communication_style', TRUE, NULL, NULL, 'AND is_default = 1')); } + // CRM-17778 -- set preferred_mail_format to default if unset + if (empty($defaults['preferred_mail_format'])) { + $defaults['preferred_mail_format'] = array_search('Both', CRM_Core_SelectValues::pmf()); + } + //set default from greeting types CRM-4575, CRM-9739 if ($form->_action & CRM_Core_Action::ADD) { foreach (CRM_Contact_BAO_Contact::$_greetingTypes as $greeting) { diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index d17560ace8..c53091d56b 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -1448,7 +1448,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { case 'Select': $props['class'] = CRM_Utils_Array::value('class', $props, 'big') . ' crm-select2'; - if (!array_key_exists('placeholder', $props) && empty($fieldSpec['default'])) { + if (!array_key_exists('placeholder', $props)) { $props['placeholder'] = $required ? ts('- select -') : ($context == 'search' ? ts('- any -') : ts('- none -')); } // TODO: Add and/or option for fields that store multiple values