diff --git a/CRM/Core/BAO/Mapping.php b/CRM/Core/BAO/Mapping.php index 56c1d9e02034..309972bb6aaf 100644 --- a/CRM/Core/BAO/Mapping.php +++ b/CRM/Core/BAO/Mapping.php @@ -151,6 +151,7 @@ public static function getCreateMappingValues($mappingType) { civicrm_api3('OptionValue', 'create', [ 'option_group_id' => 'mapping_type', 'label' => $mappingType, + 'name' => $mappingType, 'value' => max(array_keys($mappingValues['values'])) + 1, 'is_reserved' => 1, ]); diff --git a/tests/phpunit/CRM/Core/BAO/MappingTest.php b/tests/phpunit/CRM/Core/BAO/MappingTest.php index 50dea9ef5916..fb71da022eaf 100644 --- a/tests/phpunit/CRM/Core/BAO/MappingTest.php +++ b/tests/phpunit/CRM/Core/BAO/MappingTest.php @@ -219,4 +219,11 @@ public function getMappingMaps() { ]; } + /** + * Ensure getCreateMappingValues() doesn't return an error when there are spaces in the name. + */ + public function testGetCreateMappingValues() { + CRM_Core_BAO_Mapping::getCreateMappingValues("Import Multi value custom data"); + } + }