From a10d7861461699d4580218be58ebf176fa4fecca Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@osticket.com> Date: Wed, 11 Jun 2014 04:22:54 +0000 Subject: [PATCH] bug: Check account manage auto-assign flag Auto assign tickets to organization's account manager only if the flag is set and as the last resort i.e topic or filters assignment takes precedence. --- include/class.organization.php | 4 ++++ include/class.ticket.php | 19 ++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/include/class.organization.php b/include/class.organization.php index a68060d0f..9e11b212f 100644 --- a/include/class.organization.php +++ b/include/class.organization.php @@ -71,6 +71,10 @@ class OrganizationModel extends VerySimpleModel { return $this->check(self::COLLAB_ALL_MEMBERS); } + function autoAssignAccountManager() { + return $this->check(self::ASSIGN_AGENT_MANAGER); + } + function getUpdateDate() { return $this->updated; } diff --git a/include/class.ticket.php b/include/class.ticket.php index f0d4c770f..bc4bd9745 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -2411,15 +2411,6 @@ class Ticket { $source = 'Email'; } - // Auto assignment to organization account manager - if (($org = $user->getOrganization()) - && ($code = $org->getAccountManagerId())) { - if (!isset($vars['staffId']) && $code[0] == 's') - $vars['staffId'] = substr($code, 1); - elseif (!isset($vars['teamId']) && $code[0] == 't') - $vars['teamId'] = substr($code, 1); - } - if (!isset($topic)) { // This may return NULL, no big deal $topic = $cfg->getDefaultTopic(); @@ -2448,6 +2439,16 @@ class Ticket { $vars['slaId'] = $topic->getSLAId(); } + // Auto assignment to organization account manager + if (($org = $user->getOrganization()) + && $org->autoAssignAccountManager() + && ($code = $org->getAccountManagerId())) { + if (!isset($vars['staffId']) && $code[0] == 's') + $vars['staffId'] = substr($code, 1); + elseif (!isset($vars['teamId']) && $code[0] == 't') + $vars['teamId'] = substr($code, 1); + } + // Last minute checks $priority = $form->getAnswer('priority'); if (!$priority || !$priority->getIdValue()) -- GitLab