From 3dab629d5069b31045b4ba93cdd5adb10ea32e99 Mon Sep 17 00:00:00 2001
From: JediKev <kevin@enhancesoft.com>
Date: Tue, 25 Jul 2017 12:29:54 -0500
Subject: [PATCH] orgs: Remove Primary Contacts

This addresses issue 3903 where you cannot remove Primary Contacts from an
Organization through the UI. This adds functionality to remove
collaborators from the select box.
---
 include/class.organization.php | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/class.organization.php b/include/class.organization.php
index f41e04225..b2ad8a903 100644
--- a/include/class.organization.php
+++ b/include/class.organization.php
@@ -425,6 +425,12 @@ implements TemplateVariable {
                 $u->setPrimaryContact(array_search($u->id, $vars['contacts']) !== false);
                 $u->save();
             }
+        } else {
+            $members = $this->allMembers();
+            $members->update(array(
+                'status' => SqlExpression::bitand(
+                    new SqlField('status'), ~User::PRIMARY_ORG_CONTACT)
+                ));
         }
 
         return $this->save();
-- 
GitLab