Skip to content

Commit

Permalink
Merge pull request #23493 from eileenmcnaughton/import_rel
Browse files Browse the repository at this point in the history
[Import] Remove silly param
  • Loading branch information
colemanw authored May 19, 2022
2 parents b0a25a0 + 12a8af6 commit 2df31a2
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions CRM/Contact/Import/Parser/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Import_Parser {
use CRM_Contact_Import_MetadataTrait;

protected $_mapperKeys = [];
protected $_relationships;

/**
* Is update only permitted on an id match.
Expand Down Expand Up @@ -1053,9 +1052,8 @@ public function &getRelatedImportedContacts() {
* A string containing all the error-fields.
*
* @param null $csType
* @param null $relationships
*/
public static function isErrorInCustomData($params, &$errorMessage, $csType = NULL, $relationships = NULL) {
public static function isErrorInCustomData($params, &$errorMessage, $csType = NULL) {
$dateType = CRM_Core_Session::singleton()->get("dateTypes");
$errors = [];

Expand Down Expand Up @@ -1214,18 +1212,10 @@ public static function isErrorInCustomData($params, &$errorMessage, $csType = NU
}
}
}
elseif (is_array($params[$key]) && isset($params[$key]["contact_type"])) {
elseif (is_array($params[$key]) && isset($params[$key]["contact_type"]) && in_array(substr($key, -3), ['a_b', 'b_a'], TRUE)) {
//CRM-5125
//supporting custom data of related contact subtypes
$relation = NULL;
if ($relationships) {
if (array_key_exists($key, $relationships)) {
$relation = $key;
}
elseif (CRM_Utils_Array::key($key, $relationships)) {
$relation = CRM_Utils_Array::key($key, $relationships);
}
}
$relation = $key;
if (!empty($relation)) {
[$id, $first, $second] = CRM_Utils_System::explode('_', $relation, 3);
$direction = "contact_sub_type_$second";
Expand All @@ -1238,7 +1228,7 @@ public static function isErrorInCustomData($params, &$errorMessage, $csType = NU
}
}

self::isErrorInCustomData($params[$key], $errorMessage, $csType, $relationships);
self::isErrorInCustomData($params[$key], $errorMessage, $csType);
}
}
if ($errors) {
Expand Down Expand Up @@ -1894,8 +1884,6 @@ public static function getParameterForParser($count) {
*/
protected function setFieldMetadata() {
$this->setImportableFieldsMetadata($this->getContactImportMetadata());
// Probably no longer needed but here for now.
$this->_relationships = $this->getRelationships();
}

/**
Expand Down Expand Up @@ -2825,7 +2813,7 @@ public function validateValues(array $values): void {
}

//checking error in custom data
$this->isErrorInCustomData($params, $errorMessage, $csType, $this->_relationships);
$this->isErrorInCustomData($params, $errorMessage, $csType);

//checking error in core data
$this->isErrorInCoreData($params, $errorMessage);
Expand Down

0 comments on commit 2df31a2

Please sign in to comment.