Disable expired relationships cronjob error after deleting a contact subtype of a contact
It is a case quite isolated but it can happen.
If a relationship type is restricted between two contact types and one of them as a contact subtype, after a relationship is created it's possible to remove a contact subtype of a contact without removing the existing relationship. After this, the Disable expired relationships cronjob can fail if tries to disable this relationship.
Finished execution of Disable expired relationships with result: Error, Error message: Invalid Relationship
throwed by https://lab.civicrm.org/dev/core/blob/5.5/CRM/Contact/BAO/Relationship.php#L68
How to reproduce
-
Define a relationship like:
contact subtype of relationship contact A = Student
contact subtype of relationship contact B = School
relationship type studies at / has a student
-
Create a relationship studies at between a contact Student and a contact School with end date at the past
-
Remove contact subtype for the contact Student
-
Execute Disable expired relationships cronjob