[REF] Move another deprecated function to the class that uses it
authoreileen <emcnaughton@wikimedia.org>
Mon, 21 Dec 2020 20:16:03 +0000 (09:16 +1300)
committereileen <emcnaughton@wikimedia.org>
Mon, 21 Dec 2020 20:28:13 +0000 (09:28 +1300)
CRM/Event/Import/Parser/Participant.php
CRM/Utils/DeprecatedUtils.php

index 5ed2fecfbc0bfa89a6a4d7fe6dae0afbe152b6b0..3bb21269c1c4559b9d38d5236ffec69d268abbd8 100644 (file)
@@ -386,7 +386,7 @@ class CRM_Event_Import_Parser_Participant extends CRM_Event_Import_Parser {
           foreach ($matchedIDs as $contactId) {
             $formatted['contact_id'] = $contactId;
             $formatted['version'] = 3;
-            $newParticipant = _civicrm_api3_deprecated_create_participant_formatted($formatted, $onDuplicate);
+            $newParticipant = $this->deprecated_create_participant_formatted($formatted, $onDuplicate);
           }
         }
       }
@@ -435,7 +435,7 @@ class CRM_Event_Import_Parser_Participant extends CRM_Event_Import_Parser {
         }
       }
 
-      $newParticipant = _civicrm_api3_deprecated_create_participant_formatted($formatted, $onDuplicate);
+      $newParticipant = $this->deprecated_create_participant_formatted($formatted, $onDuplicate);
     }
 
     if (is_array($newParticipant) && civicrm_error($newParticipant)) {
@@ -625,4 +625,24 @@ class CRM_Event_Import_Parser_Participant extends CRM_Event_Import_Parser {
     return NULL;
   }
 
+  /**
+   * @deprecated - this is part of the import parser not the API & needs to be moved on out
+   *
+   * @param array $params
+   * @param $onDuplicate
+   *
+   * @return array|bool
+   *   <type>
+   */
+  protected function deprecated_create_participant_formatted($params, $onDuplicate) {
+    if ($onDuplicate != CRM_Import_Parser::DUPLICATE_NOCHECK) {
+      CRM_Core_Error::reset();
+      $error = _civicrm_api3_deprecated_participant_check_params($params, TRUE);
+      if (civicrm_error($error)) {
+        return $error;
+      }
+    }
+    return civicrm_api3_participant_create($params);
+  }
+
 }
index 1fe35cc8da1ed6fa345212f9e1670dbc1723cb9f..ae4efc5b2bc777f2d5a24ecec54df8d7f329b4ce 100644 (file)
@@ -488,28 +488,6 @@ function _civicrm_api3_deprecated_duplicate_formatted_contact($params) {
   return civicrm_api3_create_success(TRUE);
 }
 
-/**
- * @deprecated - this is part of the import parser not the API & needs to be moved on out
- *
- * @param array $params
- * @param $onDuplicate
- *
- * @return array|bool
- *   <type>
- */
-function _civicrm_api3_deprecated_create_participant_formatted($params, $onDuplicate) {
-  require_once 'CRM/Event/Import/Parser.php';
-  if ($onDuplicate != CRM_Import_Parser::DUPLICATE_NOCHECK) {
-    CRM_Core_Error::reset();
-    $error = _civicrm_api3_deprecated_participant_check_params($params, TRUE);
-    if (civicrm_error($error)) {
-      return $error;
-    }
-  }
-  require_once "api/v3/Participant.php";
-  return civicrm_api3_participant_create($params);
-}
-
 /**
  *
  * @param array $params