diff --git a/CRM/Contact/BAO/Relationship.php b/CRM/Contact/BAO/Relationship.php index 502f6b143ae1..ba4e02d47984 100644 --- a/CRM/Contact/BAO/Relationship.php +++ b/CRM/Contact/BAO/Relationship.php @@ -224,7 +224,7 @@ public static function legacyCreateMultiple(&$params, $ids = []) { self::addRecent($params, $relationship); } - return [$valid, $invalid, $duplicate, $saved, $relationshipIds, $relationships]; + return [$valid, $duplicate]; } /** diff --git a/CRM/Contact/Import/Parser/Contact.php b/CRM/Contact/Import/Parser/Contact.php index 36d581f43e06..8399c5fb401d 100644 --- a/CRM/Contact/Import/Parser/Contact.php +++ b/CRM/Contact/Import/Parser/Contact.php @@ -893,7 +893,7 @@ public function import($onDuplicate, &$values, $doGeocodeAddress = FALSE) { 'contact' => $primaryContactId, ]; - [$valid, $invalid, $duplicate, $saved, $relationshipIds] = CRM_Contact_BAO_Relationship::legacyCreateMultiple($relationParams, $relationIds); + [$valid, $duplicate] = CRM_Contact_BAO_Relationship::legacyCreateMultiple($relationParams, $relationIds); if ($valid || $duplicate) { $relationIds['contactTarget'] = $relContactId; diff --git a/tests/phpunit/CRM/Contact/BAO/ContactType/RelationshipTest.php b/tests/phpunit/CRM/Contact/BAO/ContactType/RelationshipTest.php index c2ff108942d2..7280901e470d 100644 --- a/tests/phpunit/CRM/Contact/BAO/ContactType/RelationshipTest.php +++ b/tests/phpunit/CRM/Contact/BAO/ContactType/RelationshipTest.php @@ -146,82 +146,6 @@ public function testRelationshipTypeAddStudentSponcor() { $this->relationshipTypeDelete($result->id); } - /** - * Methods create relationshipe within same contact type with invalid Relationships. - */ - public function testRelationshipCreateInvalidWithinSameType() { - //check for Individual to Parent - $relTypeParams = [ - 'name_a_b' => 'indivToparent', - 'name_b_a' => 'parentToindiv', - 'contact_type_a' => 'Individual', - 'contact_type_b' => 'Individual', - 'contact_sub_type_b' => $this->parent, - ]; - $relType = CRM_Contact_BAO_RelationshipType::add($relTypeParams); - $params = [ - 'relationship_type_id' => $relType->id . '_a_b', - 'contact_check' => [$this->indivi_student => 1], - ]; - $ids = ['contact' => $this->individual]; - - list($valid, $invalid, $duplicate, $saved, $relationshipIds) = CRM_Contact_BAO_Relationship::legacyCreateMultiple($params, $ids); - - $this->assertEquals($invalid, 1); - $this->assertEquals(empty($relationshipIds), TRUE); - $this->relationshipTypeDelete($relType->id); - } - - /** - * Methods create relationshipe within diff contact type with invalid Relationships. - */ - public function testRelCreateInvalidWithinDiffTypeSpocorIndivi() { - //check for Sponcer to Individual - $relTypeParams = [ - 'name_a_b' => 'SponsorToIndiv', - 'name_b_a' => 'IndivToSponsor', - 'contact_type_a' => 'Organization', - 'contact_sub_type_a' => $this->sponsor, - 'contact_type_b' => 'Individual', - ]; - $relType = CRM_Contact_BAO_RelationshipType::add($relTypeParams); - $params = [ - 'relationship_type_id' => $relType->id . '_a_b', - 'contact_check' => [$this->individual => 1], - ]; - $ids = ['contact' => $this->indivi_parent]; - - list($valid, $invalid, $duplicate, $saved, $relationshipIds) = CRM_Contact_BAO_Relationship::legacyCreateMultiple($params, $ids); - - $this->assertEquals($invalid, 1); - $this->assertEquals(empty($relationshipIds), TRUE); - $this->relationshipTypeDelete($relType->id); - } - - public function testRelCreateInvalidWithinDiffTypeStudentSponcor() { - //check for Student to Sponcer - $relTypeParams = [ - 'name_a_b' => 'StudentToSponser', - 'name_b_a' => 'SponsorToStudent', - 'contact_type_a' => 'Individual', - 'contact_sub_type_a' => $this->student, - 'contact_type_b' => 'Organization', - 'contact_sub_type_b' => 'Sponser', - ]; - $relType = CRM_Contact_BAO_RelationshipType::add($relTypeParams); - $params = [ - 'relationship_type_id' => $relType->id . '_a_b', - 'contact_check' => [$this->individual => 1], - ]; - $ids = ['contact' => $this->indivi_parent]; - - list($valid, $invalid, $duplicate, $saved, $relationshipIds) = CRM_Contact_BAO_Relationship::legacyCreateMultiple($params, $ids); - - $this->assertEquals($invalid, 1); - $this->assertEquals(empty($relationshipIds), TRUE); - $this->relationshipTypeDelete($relType->id); - } - /** * Methods create relationshipe within same contact type with valid data. * success expected @@ -242,11 +166,9 @@ public function testRelationshipCreateWithinSameType() { 'contact_check' => [$this->indivi_parent => $this->indivi_parent], ]; $ids = ['contact' => $this->individual]; - list($valid, $invalid, $duplicate, $saved, $relationshipIds) = CRM_Contact_BAO_Relationship::legacyCreateMultiple($params, $ids); + list($valid) = CRM_Contact_BAO_Relationship::legacyCreateMultiple($params, $ids); $this->assertEquals($valid, 1); - $this->assertEquals(empty($relationshipIds), FALSE); - $this->relationshipTypeDelete($relType->id); } /** @@ -269,10 +191,9 @@ public function testRelCreateWithinDiffTypeSponsorIndivi() { 'contact_check' => [$this->indivi_student => 1], ]; $ids = ['contact' => $this->organization_sponsor]; - list($valid, $invalid, $duplicate, $saved, $relationshipIds) = CRM_Contact_BAO_Relationship::legacyCreateMultiple($params, $ids); + list($valid) = CRM_Contact_BAO_Relationship::legacyCreateMultiple($params, $ids); $this->assertEquals($valid, 1); - $this->assertEquals(empty($relationshipIds), FALSE); $this->relationshipTypeDelete($relType->id); } @@ -293,10 +214,9 @@ public function testRelCreateWithinDiffTypeStudentSponsor() { 'contact_check' => [$this->organization_sponsor => 1], ]; $ids = ['contact' => $this->indivi_student]; - list($valid, $invalid, $duplicate, $saved, $relationshipIds) = CRM_Contact_BAO_Relationship::legacyCreateMultiple($params, $ids); + list($valid) = CRM_Contact_BAO_Relationship::legacyCreateMultiple($params, $ids); $this->assertEquals($valid, 1); - $this->assertEquals(empty($relationshipIds), FALSE); $this->relationshipTypeDelete($relType->id); }