Skip to content
Snippets Groups Projects
  • Peter Rotich's avatar
    523dc8d6
    Thread Referral · 523dc8d6
    Peter Rotich authored
    Add the initial concept of thread (tickets & tasks) referral.
    
    * Agent & Team
    Referring a ticket to an agent or team - is just like assignment without
    actually assigning. If referred agent doesn't have access to the ticket's
    department then they'll only have view access.
    
    * Department
    This is like assigning a ticket to the entire department. Meaning agents who
    have access to the referred to department will now see the ticket - what
    they can do with the ticket will depend on the assigned role in that
    particular department.
    
    It's important to note the ticket will technically be still the
    responsibility of the primary department. Transferring the ticket is the
    sure way to relinquishing the responsibility.
    
    * Auto Department Referral via email
    This will happen if an email is sent to multiple departments. For example an
    email with TO: support &  CC: billing will result in the ticket getting
    routed to "support" department and "billing" getting a referral of the same
    ticket. This allows both departments to have visibility of the ticket -
    which is not possible at the moment.
    523dc8d6
    History
    Thread Referral
    Peter Rotich authored
    Add the initial concept of thread (tickets & tasks) referral.
    
    * Agent & Team
    Referring a ticket to an agent or team - is just like assignment without
    actually assigning. If referred agent doesn't have access to the ticket's
    department then they'll only have view access.
    
    * Department
    This is like assigning a ticket to the entire department. Meaning agents who
    have access to the referred to department will now see the ticket - what
    they can do with the ticket will depend on the assigned role in that
    particular department.
    
    It's important to note the ticket will technically be still the
    responsibility of the primary department. Transferring the ticket is the
    sure way to relinquishing the responsibility.
    
    * Auto Department Referral via email
    This will happen if an email is sent to multiple departments. For example an
    email with TO: support &  CC: billing will result in the ticket getting
    routed to "support" department and "billing" getting a referral of the same
    ticket. This allows both departments to have visibility of the ticket -
    which is not possible at the moment.
class.model.php 2.13 KiB
<?php
/*********************************************************************
    class.model.php

    Peter Rotich <peter@osticket.com>
    Copyright (c)  2006-2014 osTicket
    http://www.osticket.com

    Released under the GNU General Public License WITHOUT ANY WARRANTY.
    See LICENSE.TXT for details.

    vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/

// TODO:  Make ObjectModel models base class and extend VerySimpleModel
class ObjectModel {

    const OBJECT_TYPE_TICKET = 'T';
    const OBJECT_TYPE_THREAD = 'H';
    const OBJECT_TYPE_USER   = 'U';
    const OBJECT_TYPE_ORG    = 'O';
    const OBJECT_TYPE_FAQ    = 'K';
    const OBJECT_TYPE_FILE   = 'F';
    const OBJECT_TYPE_TASK   = 'A';
    const OBJECT_TYPE_TEAM   = 'E';
    const OBJECT_TYPE_DEPT   = 'D';
    const OBJECT_TYPE_STAFF  = 'S';

    private function objects() {
        static $objects = false;
        if ($objects == false) {
            $objects = array(
                    self::OBJECT_TYPE_TICKET  => 'Ticket',
                    self::OBJECT_TYPE_THREAD  => 'ThreadEntry',
                    self::OBJECT_TYPE_USER    => 'User',
                    self::OBJECT_TYPE_ORG     => 'Organization',
                    self::OBJECT_TYPE_FAQ     => 'FAQ',
                    self::OBJECT_TYPE_FILE    => 'AttachmentFile',
                    self::OBJECT_TYPE_TASK    => 'Task',
                    self::OBJECT_TYPE_TEAM    => 'Team',
                    self::OBJECT_TYPE_DEPT    => 'Dept',
                    self::OBJECT_TYPE_STAFF   => 'Staff',
                    );
        }

        return $objects;
    }

    static function getType($model) {

        foreach (self::objects() as $t => $c) {
            if ($model instanceof $c)
                return $t;
        }
    }

    static function lookup($id, $type) {
        $model = null;
        if ($id
                && ($objects=self::objects())
                && ($class=$objects[$type])
                && class_exists($class)
                && is_callable(array($class, 'lookup')))
            $model = $class::lookup($id);

        return $model;
    }
}
?>