allow non-organization employers
authorJon Goldberg <jon@megaphonetech.com>
Fri, 15 Apr 2022 14:24:11 +0000 (10:24 -0400)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Tue, 19 Apr 2022 19:52:20 +0000 (07:52 +1200)
CRM/Contact/BAO/RelationshipType.php

index 349b9d9991661a5ea6875d8982e6f5885b332f64..b2cc785173b2213c748212816e625271a38e5a76 100644 (file)
@@ -126,6 +126,8 @@ class CRM_Contact_BAO_RelationshipType extends CRM_Contact_DAO_RelationshipType
 
   /**
    * Get the id of the employee relationship, checking it is valid.
+   * We check that contact_type_a is Individual, but not contact_type_b because there's
+   * nowhere in the code that requires it to be Organization.
    *
    * @return int|string
    *
@@ -137,7 +139,6 @@ class CRM_Contact_BAO_RelationshipType extends CRM_Contact_DAO_RelationshipType
         $relationship = RelationshipType::get(FALSE)
           ->addWhere('name_a_b', '=', 'Employee of')
           ->addWhere('contact_type_a', '=', 'Individual')
-          ->addWhere('contact_type_b', '=', 'Organization')
           ->addSelect('id')->execute()->first();
         if (empty($relationship)) {
           throw new API_Exception('no valid relationship');