From 2b90b596e703c3badb730efcbbcd260433175695 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 1 Apr 2015 20:09:50 -0400 Subject: [PATCH] CRM-16214 - Set default value on option_value form --- CRM/Admin/Form/Options.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CRM/Admin/Form/Options.php b/CRM/Admin/Form/Options.php index cdf5ef0f7d..5818f2b1c2 100644 --- a/CRM/Admin/Form/Options.php +++ b/CRM/Admin/Form/Options.php @@ -115,17 +115,18 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { /** * Set default values for the form. - * the default values are retrieved from the database - * * * @return void */ public function setDefaultValues() { $defaults = parent::setDefaultValues(); - if (!isset($defaults['weight']) || !$defaults['weight']) { - $fieldValues = array('option_group_id' => $this->_gid); - $defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Core_DAO_OptionValue', $fieldValues); + // Default weight & value + $fieldValues = array('option_group_id' => $this->_gid); + foreach (array('weight', 'value') as $field) { + if (empty($defaults[$field])) { + $defaults[$field] = CRM_Utils_Weight::getDefaultWeight('CRM_Core_DAO_OptionValue', $fieldValues, $field); + } } //setDefault of contact types for email greeting, postal greeting, addressee, CRM-4575 -- 2.25.1