Remove obsolete addField from activity import
authorEileen McNaughton <emcnaughton@wikimedia.org>
Wed, 24 Aug 2022 21:25:39 +0000 (09:25 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Wed, 24 Aug 2022 21:25:39 +0000 (09:25 +1200)
CRM/Activity/Import/Field.php [deleted file]
CRM/Activity/Import/Parser/Activity.php

diff --git a/CRM/Activity/Import/Field.php b/CRM/Activity/Import/Field.php
deleted file mode 100644 (file)
index b3d4cbe..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC. All rights reserved.                        |
- |                                                                    |
- | This work is published under the GNU AGPLv3 license with some      |
- | permitted exceptions and without any warranty. For full license    |
- | and copyright information, see https://civicrm.org/licensing       |
- +--------------------------------------------------------------------+
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC https://civicrm.org/licensing
- */
-class CRM_Activity_Import_Field {
-
-  /**
-   * @var string
-   *   Name of the field
-   */
-  public $_name;
-
-  /**
-   * Title of the field to be used in display
-   * @var string
-   */
-  public $_title;
-
-  /**
-   * Type of field
-   * @var int
-   */
-  public $_type;
-
-  /**
-   * Is this field required
-   * @var bool
-   */
-  public $_required;
-
-  /**
-   * Data to be carried for use by a derived class
-   * @var object
-   */
-  public $_payload;
-
-  /**
-   * Regexp to match the CSV header of this column/field
-   * @var string
-   */
-  public $_headerPattern;
-
-  /**
-   * Regexp to match the pattern of data from various column/fields
-   * @var string
-   */
-  public $_dataPattern;
-
-  /**
-   * Value of this field
-   * @var string|null
-   */
-  public $_value;
-
-  /**
-   * @param string $name
-   * @param string $title
-   * @param int $type
-   * @param string $headerPattern
-   * @param string $dataPattern
-   */
-  public function __construct($name, $title, $type = CRM_Utils_Type::T_INT, $headerPattern = '//', $dataPattern = '//') {
-    $this->_name = $name;
-    $this->_title = $title;
-    $this->_type = $type;
-    $this->_headerPattern = $headerPattern;
-    $this->_dataPattern = $dataPattern;
-
-    $this->_value = NULL;
-  }
-
-  public function resetValue() {
-    $this->_value = NULL;
-  }
-
-  /**
-   * The value is in string format. convert the value to the type of this field
-   * and set the field value with the appropriate type
-   * @param string $value
-   */
-  public function setValue($value) {
-    $this->_value = $value;
-  }
-
-  /**
-   * @return bool
-   */
-  public function validate() {
-
-    if (CRM_Utils_System::isNull($this->_value)) {
-      return TRUE;
-    }
-    return TRUE;
-  }
-
-}
index 4b37a0fe045bbc789e67b0fe297e62fb8a31baec..e9508a59e084994880006482fe831f72f21f9c97 100644 (file)
@@ -47,16 +47,6 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Import_Parser {
    */
   public function init() {
     $this->setFieldMetadata();
-
-    foreach ($this->importableFieldsMetadata as $name => $field) {
-      $field['type'] = CRM_Utils_Array::value('type', $field, CRM_Utils_Type::T_INT);
-      $field['dataPattern'] = CRM_Utils_Array::value('dataPattern', $field, '//');
-      $field['headerPattern'] = CRM_Utils_Array::value('headerPattern', $field, '//');
-      if (!empty($field['custom_group_id'])) {
-        $field['title'] = $field["groupTitle"] . ' :: ' . $field["title"];
-      }
-      $this->addField($name, $field['title'], $field['type'], $field['headerPattern'], $field['dataPattern']);
-    }
   }
 
   /**
@@ -192,30 +182,6 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Import_Parser {
     return [['activity_type_id' => ts('Activity Type'), 'activity_date_time' => ts('Activity Date')]];
   }
 
-  /**
-   * @deprecated - these are just used in a couple of parent class functions now.
-   * @param string $name
-   * @param $title
-   * @param int $type
-   * @param string $headerPattern
-   * @param string $dataPattern
-   */
-  public function addField($name, $title, $type = CRM_Utils_Type::T_INT, $headerPattern = '//', $dataPattern = '//') {
-    if (empty($name)) {
-      $this->_fields['doNotImport'] = new CRM_Activity_Import_Field($name, $title, $type, $headerPattern, $dataPattern);
-    }
-    else {
-
-      $tempField = CRM_Contact_BAO_Contact::importableFields('Individual', NULL);
-      if (!array_key_exists($name, $tempField)) {
-        $this->_fields[$name] = new CRM_Activity_Import_Field($name, $title, $type, $headerPattern, $dataPattern);
-      }
-      else {
-        $this->_fields[$name] = new CRM_Contact_Import_Field($name, $title, $type, $headerPattern, $dataPattern, CRM_Utils_Array::value('hasLocationType', $tempField[$name]));
-      }
-    }
-  }
-
   /**
    * Ensure metadata is loaded.
    */