X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCustom%2FForm%2FOption.php;h=2e8af3d9f529027f18e11004611e2d199cd3e7f1;hb=da7a33feb6f28d09a8b2de93cb702b43ed484851;hp=d43a974f177a5fe6dbca0e80a8d3bf4204e018a3;hpb=1604d1a0eeae27872de8c8a6fc4950c4b11c0229;p=civicrm-core.git diff --git a/CRM/Custom/Form/Option.php b/CRM/Custom/Form/Option.php index d43a974f17..2e8af3d9f5 100644 --- a/CRM/Custom/Form/Option.php +++ b/CRM/Custom/Form/Option.php @@ -1,9 +1,9 @@ _action == CRM_Core_Action::DELETE) { + $option = civicrm_api3('option_value', 'getsingle', array('id' => $this->_id)); + $this->assign('label', $option['label']); $this->addButtons(array( array( 'type' => 'next', @@ -245,6 +247,9 @@ class CRM_Custom_Form_Option extends CRM_Core_Form { * * @param array $fields posted values of the form * + * @param $files + * @param $form + * * @return array list of errors to be posted back to the form * @static * @access public @@ -403,10 +408,11 @@ SELECT count(*) $params = $this->controller->exportValues('Option'); if ($this->_action == CRM_Core_Action::DELETE) { + $option = civicrm_api3('option_value', 'getsingle', array('id' => $this->_id)); $fieldValues = array('option_group_id' => $this->_optionGroupID); - $wt = CRM_Utils_Weight::delWeight('CRM_Core_DAO_OptionValue', $this->_id, $fieldValues); + CRM_Utils_Weight::delWeight('CRM_Core_DAO_OptionValue', $this->_id, $fieldValues); CRM_Core_BAO_CustomOption::del($this->_id); - CRM_Core_Session::setStatus(ts('Your multiple choice option has been deleted'), ts('Deleted'), 'success'); + CRM_Core_Session::setStatus(ts('Option "%1" has been deleted.', array(1 => $option['label'])), ts('Deleted'), 'success'); return; } @@ -449,7 +455,7 @@ SELECT count(*) CRM_Core_DAO::VALUE_SEPARATOR, substr($customField->default_value, 1, -1) ); - if (CRM_Utils_Array::value('default_value', $params)) { + if (!empty($params['default_value'])) { if (!in_array($customOption->value, $defVal)) { if (empty($defVal[0])) { $defVal = array($customOption->value); @@ -494,7 +500,7 @@ SELECT count(*) break; } - if (CRM_Utils_Array::value('default_value', $params)) { + if (!empty($params['default_value'])) { $customField->default_value = $customOption->value; $customField->save(); }