From 4247b886dcd91701c2dd01a88137f4e4e82d22a5 Mon Sep 17 00:00:00 2001 From: yashodha Date: Tue, 23 May 2017 16:01:53 +0530 Subject: [PATCH] CRM-20624 - Expose description field for option values in UI --- CRM/Core/BAO/CustomOption.php | 4 ++-- CRM/Custom/Form/Option.php | 2 ++ CRM/Custom/Page/AJAX.php | 1 + templates/CRM/Custom/Form/Option.tpl | 3 +++ templates/CRM/Custom/Page/Option.tpl | 2 ++ 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CRM/Core/BAO/CustomOption.php b/CRM/Core/BAO/CustomOption.php index efbb6518c4..e19e169ed1 100644 --- a/CRM/Core/BAO/CustomOption.php +++ b/CRM/Core/BAO/CustomOption.php @@ -159,7 +159,7 @@ class CRM_Core_BAO_CustomOption { $options[$dao->id]['is_default'] = ''; } } - + $options[$dao->id]['description'] = $dao->description; $options[$dao->id]['class'] = $dao->id . ',' . $class; $options[$dao->id]['is_active'] = empty($dao->is_active) ? ts('No') : ts('Yes'); $options[$dao->id]['links'] = CRM_Core_Action::formLink($links, @@ -176,7 +176,7 @@ class CRM_Core_BAO_CustomOption { $dao->id ); } - + // crm_core_Error::Debug('t', $options); return $options; } diff --git a/CRM/Custom/Form/Option.php b/CRM/Custom/Form/Option.php index 00b4507744..c2abadca56 100644 --- a/CRM/Custom/Form/Option.php +++ b/CRM/Custom/Form/Option.php @@ -181,6 +181,7 @@ class CRM_Custom_Form_Option extends CRM_Core_Form { $this->add('text', 'value', ts('Option Value'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'value'), TRUE); + $this->add('textarea', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'description')); // weight $this->add('text', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'weight'), TRUE); $this->addRule('weight', ts('is a numeric field'), 'numeric'); @@ -406,6 +407,7 @@ SELECT count(*) $customOption->label = $params['label']; $customOption->name = CRM_Utils_String::titleToVar($params['label']); $customOption->weight = $params['weight']; + $customOption->description = $params['description']; $customOption->value = $params['value']; $customOption->is_active = CRM_Utils_Array::value('is_active', $params, FALSE); diff --git a/CRM/Custom/Page/AJAX.php b/CRM/Custom/Page/AJAX.php index ef99f073b5..62c95c7157 100644 --- a/CRM/Custom/Page/AJAX.php +++ b/CRM/Custom/Page/AJAX.php @@ -57,6 +57,7 @@ class CRM_Custom_Page_AJAX { $selectorElements = array( 'label', 'value', + 'description', 'is_default', 'is_active', 'links', diff --git a/templates/CRM/Custom/Form/Option.tpl b/templates/CRM/Custom/Form/Option.tpl index ac2a45ac22..f4357b9cc1 100644 --- a/templates/CRM/Custom/Form/Option.tpl +++ b/templates/CRM/Custom/Form/Option.tpl @@ -42,6 +42,9 @@ {$form.value.label} {$form.value.html} + + {$form.description.label} + {$form.description.html} {$form.weight.label} {$form.weight.html} diff --git a/templates/CRM/Custom/Page/Option.tpl b/templates/CRM/Custom/Page/Option.tpl index 7cd373f67d..8d1294e167 100644 --- a/templates/CRM/Custom/Page/Option.tpl +++ b/templates/CRM/Custom/Page/Option.tpl @@ -42,6 +42,7 @@ {ts}Label{/ts} {ts}Value{/ts} + {ts}Description{/ts} {ts}Default{/ts} {ts}Enabled?{/ts}   @@ -70,6 +71,7 @@ {sClass:'crm-custom_option-label'}, {sClass:'crm-custom_option-value'}, {sClass:'crm-custom_option-default_value'}, + {sClass:'crm-custom_option-default_description'}, {sClass:'crm-custom_option-is_active'}, {sClass:'crm-custom_option-links'}, {sClass:'hiddenElement'} -- 2.25.1