From: Jon Goldberg <jon@megaphonetech.com>
Date: Fri, 15 Apr 2022 14:24:11 +0000 (-0400)
Subject: allow non-organization employers
X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=bb91a1a3c032fbf9a6627a3b653e4053e3427540;p=civicrm-core.git

allow non-organization employers
---

diff --git a/CRM/Contact/BAO/RelationshipType.php b/CRM/Contact/BAO/RelationshipType.php
index 349b9d9991..b2cc785173 100644
--- a/CRM/Contact/BAO/RelationshipType.php
+++ b/CRM/Contact/BAO/RelationshipType.php
@@ -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');