From eecfb4cfe2a6cc6093a0ff5bda1e6139f2199c86 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Tue, 27 May 2014 17:19:54 -0500
Subject: [PATCH] orgs: Allow inline edit, change, and creation

On the user profile page, the link to view the organization now triggers a
popup dialog which allows for changing and editing the organization directly
from the user profile page. An additional [Manage] button is added to the
dialog to allow redirect access to the organization page.
---
 include/staff/templates/org.tmpl.php | 5 +++--
 include/staff/user-view.inc.php      | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/staff/templates/org.tmpl.php b/include/staff/templates/org.tmpl.php
index b1d58427a..4331153de 100644
--- a/include/staff/templates/org.tmpl.php
+++ b/include/staff/templates/org.tmpl.php
@@ -14,9 +14,10 @@ if ($info['error']) {
 <div id="org-profile" style="display:<?php echo $forms ? 'none' : 'block'; ?>;margin:5px;">
     <i class="icon-group icon-4x pull-left icon-border"></i>
     <?php
-    if ($account) { ?>
+    if ($user) { ?>
     <a class="action-button pull-right user-action" style="overflow:inherit"
-        href="#users/<?php echo $account->getUserId(); ?>/org/<?php echo $org->getId(); ?>" ><i class="icon-user"></i> Change Organization</a>
+        href="#users/<?php echo $user->getId(); ?>/org/<?php echo $org->getId(); ?>" ><i class="icon-user"></i> Change</a>
+    <a class="action-button pull-right" href="orgs.php?id=<?php echo $org->getId(); ?>"><i class="icon-share"></i> Manage</a>
     <?php
     } ?>
     <div><b><a href="#" id="editorg"><i class="icon-edit"></i>&nbsp;<?php
diff --git a/include/staff/user-view.inc.php b/include/staff/user-view.inc.php
index 52af878ed..6a29a3a0e 100644
--- a/include/staff/user-view.inc.php
+++ b/include/staff/user-view.inc.php
@@ -84,8 +84,8 @@ $org = $user->getOrganization();
                         <span id="user-<?php echo $user->getId(); ?>-org">
                         <?php
                             if ($org)
-                                echo sprintf('<a href="orgs.php?id=%d">%s</a>',
-                                        $org->getId(), $org->getName());
+                                echo sprintf('<a href="#users/%d/org" class="user-action">%s</a>',
+                                        $user->getId(), $org->getName());
                             else
                                 echo sprintf('<a href="#users/%d/org"
                                         class="user-action">Add Organization</a>',
-- 
GitLab