From c31db174dfc148a5f1b7c951de6be7781475d059 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 2 Dec 2013 14:14:00 -0800 Subject: [PATCH] CRM-11864 - Options admin - improve user feedback --- CRM/Custom/Form/Option.php | 7 +++++-- templates/CRM/Custom/Form/Option.tpl | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CRM/Custom/Form/Option.php b/CRM/Custom/Form/Option.php index d43a974f17..15760f5aae 100644 --- a/CRM/Custom/Form/Option.php +++ b/CRM/Custom/Form/Option.php @@ -162,6 +162,8 @@ class CRM_Custom_Form_Option extends CRM_Core_Form { */ public function buildQuickForm() { if ($this->_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', @@ -403,10 +405,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; } diff --git a/templates/CRM/Custom/Form/Option.tpl b/templates/CRM/Custom/Form/Option.tpl index f0ca20f079..798c25f5e9 100644 --- a/templates/CRM/Custom/Form/Option.tpl +++ b/templates/CRM/Custom/Form/Option.tpl @@ -24,7 +24,7 @@ +--------------------------------------------------------------------+ *}
-

{if $action eq 4 }{ts}View Option{/ts}{elseif $action eq 2}{ts}Edit Option{/ts}{elseif $action eq 8}{ts}Delete Option{/ts}{else}{ts}Add Option{/ts}{/if}

+

{if $action eq 4 }{ts}View Option{/ts}{elseif $action eq 2}{ts}Edit Option{/ts}{elseif $action eq 8}{ts 1=$label}Delete Option "%1"{/ts}{else}{ts}Add Option{/ts}{/if}

{if $action ne 4 AND $action ne 8}
{include file="CRM/common/formButtons.tpl" location="top"}
{/if} {* $action ne view *} -- 2.25.1