From 485105b1a2ae3a9e7403696ec0b62a823c8bb59f Mon Sep 17 00:00:00 2001 From: yashodha Date: Tue, 10 Oct 2017 18:22:07 +0530 Subject: [PATCH] CRM-21286 - expose active flag in UI for group --- CRM/Group/Form/Edit.php | 9 ++++----- templates/CRM/Group/Form/Edit.tpl | 5 +++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CRM/Group/Form/Edit.php b/CRM/Group/Form/Edit.php index 95c0df5cb0..6886183eab 100644 --- a/CRM/Group/Form/Edit.php +++ b/CRM/Group/Form/Edit.php @@ -160,7 +160,6 @@ class CRM_Group_Form_Edit extends CRM_Core_Form { */ public function setDefaultValues() { $defaults = array(); - if (isset($this->_id)) { $defaults = $this->_groupValues; if (!empty($defaults['group_type'])) { @@ -176,6 +175,8 @@ class CRM_Group_Form_Edit extends CRM_Core_Form { if (CRM_Core_Permission::check('administer Multiple Organizations') && CRM_Core_Permission::isMultisiteEnabled()) { CRM_Contact_BAO_GroupOrganization::retrieve($this->_id, $defaults); } + } else { + $defaults['is_active'] = 1; } if (!((CRM_Core_Permission::check('access CiviMail')) || @@ -261,6 +262,7 @@ class CRM_Group_Form_Edit extends CRM_Core_Form { if (!CRM_Core_Permission::check('administer reserved groups')) { $this->freeze('is_reserved'); } + $this->addElement('checkbox', 'is_active', ts('Is active?')); //build custom data CRM_Custom_Form_CustomData::buildQuickForm($this); @@ -367,9 +369,6 @@ WHERE title = %1 else { // store the submitted values in an array $params = $this->controller->exportValues($this->_name); - - $params['is_active'] = CRM_Utils_Array::value('is_active', $this->_groupValues, 1); - if ($this->_action & CRM_Core_Action::UPDATE) { $params['id'] = $this->_id; } @@ -379,7 +378,7 @@ WHERE title = %1 } $params['is_reserved'] = CRM_Utils_Array::value('is_reserved', $params, FALSE); - + $params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE); $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $this->_id, 'Group' diff --git a/templates/CRM/Group/Form/Edit.tpl b/templates/CRM/Group/Form/Edit.tpl index 45ba14ab62..5abce7d219 100644 --- a/templates/CRM/Group/Form/Edit.tpl +++ b/templates/CRM/Group/Form/Edit.tpl @@ -82,6 +82,11 @@ + + {$form.is_active.label} + {$form.is_active.html} + + {include file="CRM/Custom/Form/CustomData.tpl"} -- 2.25.1