From a55b3c0b5090e5d58b2b1474f5bcc18cb0b5332f Mon Sep 17 00:00:00 2001 From: Jon Goldberg Date: Thu, 25 Jun 2020 12:26:02 -0400 Subject: [PATCH] Multi record import screen fix --- CRM/Core/BAO/Mapping.php | 1 + tests/phpunit/CRM/Core/BAO/MappingTest.php | 7 +++++++ 2 files changed, 8 insertions(+) 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"); + } + }