Merge pull request #24187 from colemanw/removeCiviAuction
[civicrm-core.git] / CRM / Contribute / Import / Parser / Contribution.php
index 7784c9d9551d28d18369bf357976e1dc16311d03..9c4a4bbd249d23e866c604cdf9fe98eddee8910b 100644 (file)
@@ -42,6 +42,26 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Import_Parser {
     $this->_mapperKeys = $mapperKeys;
   }
 
+  /**
+   * Get information about the provided job.
+   *  - name
+   *  - id (generally the same as name)
+   *  - label
+   *
+   *  e.g. ['activity_import' => ['id' => 'activity_import', 'label' => ts('Activity Import'), 'name' => 'activity_import']]
+   *
+   * @return array
+   */
+  public static function getUserJobInfo(): array {
+    return [
+      'contribution_import' => [
+        'id' => 'contribution_import',
+        'name' => 'contribution_import',
+        'label' => ts('Contribution Import'),
+      ],
+    ];
+  }
+
   /**
    * Contribution-specific result codes
    * @see CRM_Import_Parser result code constants
@@ -397,7 +417,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Import_Parser {
         $error = $this->checkContactDuplicate($paramValues);
 
         if (CRM_Core_Error::isAPIError($error, CRM_Core_ERROR::DUPLICATE_CONTACT)) {
-          $matchedIDs = explode(',', $error['error_message']['params'][0]);
+          $matchedIDs = (array) $error['error_message']['params'];
           if (count($matchedIDs) > 1) {
             throw new CRM_Core_Exception('Multiple matching contact records detected for this row. The contribution was not imported', CRM_Import_Parser::ERROR);
           }
@@ -756,7 +776,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Import_Parser {
               $error = $this->checkContactDuplicate($params);
 
               if (isset($error['error_message']['params'][0])) {
-                $matchedIDs = explode(',', $error['error_message']['params'][0]);
+                $matchedIDs = (array) $error['error_message']['params'];
 
                 // check if only one contact is found
                 if (count($matchedIDs) > 1) {