CRM-18752 Fix Custom multi value importer
authorSeamus Lee <seamuslee001@gmail.com>
Sun, 5 Jun 2016 05:46:14 +0000 (15:46 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Sun, 5 Jun 2016 05:53:48 +0000 (15:53 +1000)
CRM/Custom/Import/Form/DataSource.php
CRM/Import/Form/DataSource.php

index 7ff3e13c8ff3f2a56fa723833962a14f5f894fcf..fbfd8c3ecda867e19a050464cbeec715c79c131c 100644 (file)
@@ -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);
   }
 
 }
index ba2d1c6c24fd8e7a30e9c1da4b774fd359002bb5..51a311a32b1712a826628912db78e174fc76ef98 100644 (file)
@@ -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,