From: Matthew Wire (MJW Consulting) Date: Wed, 22 Aug 2018 21:55:10 +0000 (+0100) Subject: Fix for issue editing custom fields with option groups after #12423 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f46ffe849e6b89eff6272f21b8085dda56eff9a7;p=civicrm-core.git Fix for issue editing custom fields with option groups after #12423 --- diff --git a/CRM/Custom/Form/Field.php b/CRM/Custom/Form/Field.php index 014ae6ad6e..0a83a5b37e 100644 --- a/CRM/Custom/Form/Field.php +++ b/CRM/Custom/Form/Field.php @@ -319,15 +319,21 @@ class CRM_Custom_Form_Field extends CRM_Core_Form { $this->freeze('data_type'); } - $optionGroupParams = [ - 'is_reserved' => 0, - 'is_active' => 1, - 'options' => ['limit' => 0, 'sort' => "title ASC"], - 'return' => ['title'], - ]; if ($this->_action == CRM_Core_Action::UPDATE) { - $optionGroupParams['id'] = $this->_values['id']; + $optionGroupParams = [ + 'id' => $this->_values['option_group_id'], + 'return' => ['title'], + ]; } + else { + $optionGroupParams = [ + 'is_reserved' => 0, + 'is_active' => 1, + 'options' => ['limit' => 0, 'sort' => "title ASC"], + 'return' => ['title'], + ]; + } + // Get all custom (is_reserved=0) option groups $optionGroupMetadata = civicrm_api3('OptionGroup', 'get', $optionGroupParams);