A couple more fixes..
authorEileen McNaughton <emcnaughton@wikimedia.org>
Tue, 7 Jun 2022 19:38:08 +0000 (07:38 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Tue, 7 Jun 2022 19:38:08 +0000 (07:38 +1200)
CRM/Event/Import/Form/MapField.php
CRM/Event/Import/Parser/Participant.php

index c27e7f6eda3cb4f2e3054c72b6b7975f27a17757..22c4741528b9cd500acd3efd2f4512e77ff5441f 100644 (file)
@@ -62,7 +62,7 @@ class CRM_Event_Import_Form_MapField extends CRM_Import_Form_MapField {
 
     $defaults = [];
     $mapperKeys = array_keys($this->_mapperFields);
-    $hasHeaders = !empty($this->_columnHeaders);
+    $hasHeaders = $this->getSubmittedValue('skipColumnHeader');
     $headerPatterns = $this->getHeaderPatterns();
     $dataPatterns = $this->getDataPatterns();
     $savedMappingID = $this->getSubmittedValue('savedMapping');
@@ -111,7 +111,7 @@ class CRM_Event_Import_Form_MapField extends CRM_Import_Form_MapField {
           $js .= "swapOptions($formName, 'mapper[$i]', 0, 3, 'hs_mapper_" . $i . "_');\n";
 
           if ($hasHeaders) {
-            $defaults["mapper[$i]"] = array($this->defaultFromHeader($this->_columnHeaders[$i], $headerPatterns));
+            $defaults["mapper[$i]"] = array($this->defaultFromHeader($columnHeader, $headerPatterns));
           }
           else {
             $defaults["mapper[$i]"] = array($this->defaultFromData($dataPatterns, $i));
@@ -124,7 +124,7 @@ class CRM_Event_Import_Form_MapField extends CRM_Import_Form_MapField {
         if ($hasHeaders) {
           // Infer the default from the skipped headers if we have them
           $defaults["mapper[$i]"] = array(
-            $this->defaultFromHeader($this->_columnHeaders[$i],
+            $this->defaultFromHeader($columnHeader,
               $headerPatterns
             ),
             //                     $defaultLocationType->id
index 8098f6ba4800741644687aa194fa674112ec2550..4dc061ee65dd578415dc05610c8acfaf898f0c57 100644 (file)
@@ -75,6 +75,7 @@ class CRM_Event_Import_Parser_Participant extends CRM_Import_Parser {
    * The initializer code, called before the processing.
    */
   public function init() {
+    unset($this->userJob);
     $this->setFieldMetadata();
     foreach ($this->importableFieldsMetadata as $name => $field) {
       $field['type'] = CRM_Utils_Array::value('type', $field, CRM_Utils_Type::T_INT);