Merge pull request #19246 from eileenmcnaughton/import
authorSeamus Lee <seamuslee001@gmail.com>
Mon, 21 Dec 2020 20:29:27 +0000 (07:29 +1100)
committerGitHub <noreply@github.com>
Mon, 21 Dec 2020 20:29:27 +0000 (07:29 +1100)
[REF] Switch to using shared function to call deprecated function

CRM/Contribute/Import/Parser/Contribution.php
CRM/Import/Parser.php

index d871a075054da4eeebb331d3930588f98090aed8..26c4c47ef7968284cf24b949ec47200e536daaf8 100644 (file)
@@ -352,10 +352,6 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa
     }
 
     if ($this->_contactIdIndex < 0) {
-      // set the contact type if its not set
-      if (!isset($paramValues['contact_type'])) {
-        $paramValues['contact_type'] = $this->_contactType;
-      }
 
       $error = $this->checkContactDuplicate($paramValues);
 
@@ -911,7 +907,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa
             }
             else {
               // we need to get contribution contact using de dupe
-              $error = _civicrm_api3_deprecated_check_contact_dedupe($params);
+              $error = $this->checkContactDuplicate($params);
 
               if (isset($error['error_message']['params'][0])) {
                 $matchedIDs = explode(',', $error['error_message']['params'][0]);
index 3aa731f55f020d0f8d7e964b215ddba25e085706..05a22b58bba749b99c39ee2fbb347a1171dc1be3 100644 (file)
@@ -524,7 +524,7 @@ abstract class CRM_Import_Parser {
    */
   protected function checkContactDuplicate(&$formatValues) {
     //retrieve contact id using contact dedupe rule
-    $formatValues['contact_type'] = $this->_contactType;
+    $formatValues['contact_type'] = $formatValues['contact_type'] ?? $this->_contactType;
     $formatValues['version'] = 3;
     require_once 'CRM/Utils/DeprecatedUtils.php';
     $error = _civicrm_api3_deprecated_check_contact_dedupe($formatValues);