Fix inherited relationship being deleted when there is still a valid relationship
authoreileen <emcnaughton@wikimedia.org>
Sat, 17 Aug 2019 22:20:32 +0000 (10:20 +1200)
committereileen <emcnaughton@wikimedia.org>
Mon, 28 Oct 2019 00:06:29 +0000 (13:06 +1300)
commit310c2031dce3ceee56517a7e6198f7ef74c90ce3
tree91e1553b182c379c82f38fbcfeb1d096e55543dc
parent57c5129890167dba2cce4fd6877c489d30183a4e
Fix inherited relationship being deleted when there is still a valid relationship

This pulls out some of the good work & test written in #14410, but treating the parts as separate bugs
with separate cleanup requirements.

I put up cleanup in https://github.com/civicrm/civicrm-core/pull/15061

And this addresses the need for the relationship to not be deleted if a valid one still exists
- wrangled out into a separate function
CRM/Contact/BAO/Contact.php
CRM/Contact/BAO/Relationship.php
tests/phpunit/CRM/Contact/BAO/RelationshipTest.php
tests/phpunit/api/v3/MembershipTest.php
tests/phpunit/api/v3/RelationshipTest.php