From 9c457f49411ace78b52a2acfba9fe648fbee9600 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Wed, 28 May 2014 13:19:43 -0500 Subject: [PATCH] orgs: Unset primary contact when user is removed --- include/ajax.users.php | 2 +- include/class.organization.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/ajax.users.php b/include/ajax.users.php index 81d53af17..8e31f3922 100644 --- a/include/ajax.users.php +++ b/include/ajax.users.php @@ -379,7 +379,7 @@ class UsersAjaxAPI extends AjaxController { } elseif ($orgId) $org = Organization::lookup($orgId); elseif ($org = $user->getOrganization()) { - $info['title'] = $org->getName(); + $info['title'] = sprintf('%s — %s', $user->getName(), 'Organization'); $info['action'] = $info['onselect'] = ''; $tmpl = 'org.tmpl.php'; } diff --git a/include/class.organization.php b/include/class.organization.php index afa46b017..a68060d0f 100644 --- a/include/class.organization.php +++ b/include/class.organization.php @@ -212,13 +212,13 @@ class Organization extends OrganizationModel { if (!$user instanceof User) return false; - if (!$user->setOrganization(null)) + if (!$user->setOrganization(null, false)) return false; - // TODO: house cleaning - remove user from org contact..etc + // House cleaning - remove user from org contact..etc + $user->setPrimaryContact(false); - - return true; + return $user->save(); } function to_json() { -- GitLab