From ce485e04b10a3086870d079918271b444181c216 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Thu, 10 Apr 2014 16:24:52 -0500
Subject: [PATCH] orgs: Auto assign tickets to account manager

---
 include/class.organization.php | 4 ++++
 include/class.ticket.php       | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/include/class.organization.php b/include/class.organization.php
index ad9deec88..908638685 100644
--- a/include/class.organization.php
+++ b/include/class.organization.php
@@ -40,6 +40,10 @@ class OrganizationModel extends VerySimpleModel {
         return $this->name;
     }
 
+    function getAccountManagerId() {
+        return $this->staff_id;
+    }
+
     function getUpdateDate() {
         return $this->updated;
     }
diff --git a/include/class.ticket.php b/include/class.ticket.php
index a61717b81..57235d31b 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -2333,6 +2333,12 @@ class Ticket {
             $source = 'Email';
         }
 
+        // Auto assignment to organization account manager
+        if (($org = $user->getOrganization()) && $org->getAccountManagerId()) {
+            if (!isset($vars['staffId']))
+                $vars['staffId'] = $org->getAccountManagerId();
+        }
+
         // Intenal mapping magic...see if we need to override anything
         if (isset($topic)) {
             $deptId = $deptId ?: $topic->getDeptId();
-- 
GitLab