Skip to content

Commit

Permalink
Merge pull request #12195 from michaelmcandrew/dev/core#140
Browse files Browse the repository at this point in the history
dev/core#140 add missing pseudoconstant for option_group_id in CustomField.xml
  • Loading branch information
eileenmcnaughton authored Jun 8, 2018
2 parents f58d84b + f93514f commit 175d24c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
7 changes: 6 additions & 1 deletion CRM/Core/DAO/CustomField.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Core/CustomField.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:dcb494bf3990ce63b66ef13ee47a2d15)
* (GenCodeChecksum:7f096c92af68ef9564675e3d708fbbe1)
*/

/**
Expand Down Expand Up @@ -594,6 +594,11 @@ public static function &fields() {
'entity' => 'CustomField',
'bao' => 'CRM_Core_BAO_CustomField',
'localizable' => 0,
'pseudoconstant' => [
'table' => 'civicrm_option_group',
'keyColumn' => 'id',
'labelColumn' => 'title',
]
],
'filter' => [
'name' => 'filter',
Expand Down
14 changes: 14 additions & 0 deletions tests/phpunit/api/v3/CustomFieldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,20 @@ public function testUpdateCustomField() {
$this->customGroupDelete($customGroup['id']);
}

public function testCustomFieldCreateWithOptionGroupName() {
$customGroup = $this->customGroupCreate(array('extends' => 'Individual', 'title' => 'test_custom_group'));
$params = array(
'custom_group_id' => $customGroup['id'],
'name' => 'Activity type',
'label' => 'Activity type',
'data_type' => 'String',
'html_type' => 'Select',
'option_group_id' => 'activity_type',
);
$result = $this->callAPISuccess('CustomField', 'create', $params);
}


/**
* @param $getFieldsResult
*
Expand Down
5 changes: 5 additions & 0 deletions xml/schema/Core/CustomField.xml
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,11 @@
<title>Field Option Group</title>
<comment>For elements with options, the option group id that is used</comment>
<add>1.4</add>
<pseudoconstant>
<table>civicrm_option_group</table>
<keyColumn>id</keyColumn>
<labelColumn>title</labelColumn>
</pseudoconstant>
</field>
<field>
<name>filter</name>
Expand Down

0 comments on commit 175d24c

Please sign in to comment.