[REF] [Import] Stop calling Parser in MapField mode
authorEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 16 May 2022 21:51:14 +0000 (09:51 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 16 May 2022 21:57:51 +0000 (09:57 +1200)
CRM/Contact/Import/Form/DataSource.php
CRM/Contact/Import/Parser/Contact.php

index bccf9ddb5aca3e9dd78dd19e7c5be2267d5e2a69..01ee130fc57be9fa1180614e40643ed69f6f92bc 100644 (file)
@@ -179,8 +179,6 @@ class CRM_Contact_Import_Form_DataSource extends CRM_Import_Forms {
       $this->flushDataSource();
       $this->updateUserJobMetadata('submitted_values', $this->getSubmittedValues());
     }
-    // Setup the params array
-    $this->_params = $this->controller->exportValues($this->_name);
 
     // @todo - this params are being set here because they were / possibly still
     // are in some places being accessed by forms later in the flow
@@ -194,9 +192,6 @@ class CRM_Contact_Import_Form_DataSource extends CRM_Import_Forms {
     // Once the mentioned forms no longer call $this->get() all this 'setting'
     // is obsolete.
     $storeParams = [
-      'onDuplicate' => $this->getSubmittedValue('onDuplicate'),
-      'dedupe' => $this->getSubmittedValue('dedupe_rule_id'),
-      'contactType' => $this->getSubmittedValue('contactType'),
       'dateFormats' => $this->getSubmittedValue('dateFormats'),
       'savedMapping' => $this->getSubmittedValue('savedMapping'),
     ];
@@ -207,17 +202,6 @@ class CRM_Contact_Import_Form_DataSource extends CRM_Import_Forms {
     CRM_Core_Session::singleton()->set('dateTypes', $storeParams['dateFormats']);
 
     $this->instantiateDataSource();
-
-    $mapper = [];
-
-    $parser = new CRM_Contact_Import_Parser_Contact($mapper);
-    $parser->setMaxLinesToProcess(100);
-    $parser->setUserJobID($this->getUserJobID());
-    $parser->run(
-      [],
-      CRM_Import_Parser::MODE_MAPFIELD
-    );
-
   }
 
   /**
index 874ad018c43fd2ea02c39c50dcbf965bb96628b0..e56a0e20341a87c40b171ef044fffde1c3a70b4d 100644 (file)
@@ -2235,18 +2235,6 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Import_Parser {
     if ($mode == self::MODE_IMPORT) {
       $dataSource->setStatuses(['new']);
     }
-    if ($this->_maxLinesToProcess > 0) {
-      // Note this would only be the case in MapForm mode, where it is set to 100
-      // rows. In fact mapField really only needs 2 rows - the reason for
-      // 100 seems to be that the other import classes are processing a
-      // csv file, and there was a concern that some rows might have more
-      // columns than others - hence checking 100 rows perhaps seemed like
-      // a good precaution presumably when determining the activeFieldsCount
-      // which is the number of columns a row might have.
-      // However, the mapField class may no longer use activeFieldsCount for contact
-      // to be continued....
-      $dataSource->setLimit($this->_maxLinesToProcess);
-    }
 
     while ($row = $dataSource->getRow()) {
       $values = array_values($row);
@@ -2254,10 +2242,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Import_Parser {
 
       $this->_totalCount++;
 
-      if ($mode == self::MODE_MAPFIELD) {
-        $returnCode = CRM_Import_Parser::VALID;
-      }
-      elseif ($mode == self::MODE_PREVIEW) {
+      if ($mode == self::MODE_PREVIEW) {
         $returnCode = $this->preview($values);
       }
       elseif ($mode == self::MODE_SUMMARY) {