Skip to content

Commit

Permalink
Merge pull request #12718 from mattwire/custom_field_optiongroup_fix
Browse files Browse the repository at this point in the history
Fix for issue editing custom fields with option groups after #12423
  • Loading branch information
monishdeb authored Aug 24, 2018
2 parents 19ea6c0 + f46ffe8 commit 5bc1d29
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions CRM/Custom/Form/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,15 +319,21 @@ public function buildQuickForm() {
$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);

Expand Down

0 comments on commit 5bc1d29

Please sign in to comment.