From cef29526a04fdfe070ab5856693d292743bf9cfe Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Sun, 5 Jun 2016 15:46:14 +1000 Subject: [PATCH] CRM-18752 Fix Custom multi value importer --- CRM/Custom/Import/Form/DataSource.php | 4 +++- CRM/Import/Form/DataSource.php | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CRM/Custom/Import/Form/DataSource.php b/CRM/Custom/Import/Form/DataSource.php index 7ff3e13c8f..fbfd8c3ecd 100644 --- a/CRM/Custom/Import/Form/DataSource.php +++ b/CRM/Custom/Import/Form/DataSource.php @@ -88,7 +88,9 @@ class CRM_Custom_Import_Form_DataSource extends CRM_Import_Form_DataSource { 'multipleCustomData', )); - $this->submitFileForMapping('CRM_Custom_Import_Parser_Api'); + $entity = 'multipleCustomData'; + + $this->submitFileForMapping('CRM_Custom_Import_Parser_Api', $entity); } } diff --git a/CRM/Import/Form/DataSource.php b/CRM/Import/Form/DataSource.php index ba2d1c6c24..51a311a32b 100644 --- a/CRM/Import/Form/DataSource.php +++ b/CRM/Import/Form/DataSource.php @@ -152,8 +152,11 @@ abstract class CRM_Import_Form_DataSource extends CRM_Core_Form { * Common form postProcess. * * @param string $parserClassName + * + * @param string|null $entity + * Entity to set for paraser currently only for custom import */ - protected function submitFileForMapping($parserClassName) { + protected function submitFileForMapping($parserClassName, $entity = NULL) { $this->controller->resetPage('MapField'); $fileName = $this->controller->exportValue($this->_name, 'uploadFile'); @@ -167,6 +170,9 @@ abstract class CRM_Import_Form_DataSource extends CRM_Core_Form { $mapper = array(); $parser = new $parserClassName($mapper); + if ($entity) { + $parser->setEntity($this->get($entity)); + } $parser->setMaxLinesToProcess(100); $parser->run($fileName, $separator, -- 2.25.1