Skip to content
Snippets Groups Projects
class.config.php 57.2 KiB
Newer Older
Jared Hancock's avatar
Jared Hancock committed
<?php
/*********************************************************************
    class.config.php

    osTicket config info manager.
Jared Hancock's avatar
Jared Hancock committed

    Peter Rotich <peter@osticket.com>
    Copyright (c)  2006-2013 osTicket
Jared Hancock's avatar
Jared Hancock committed
    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:
**********************************************************************/
require_once INCLUDE_DIR . 'class.orm.php';
Jared Hancock's avatar
Jared Hancock committed

class Config {
    var $section = null;                    # Default namespace ('core')
    var $table = CONFIG_TABLE;              # Table name (with prefix)
    var $section_column = 'namespace';      # namespace column name
    var $session = null;                    # Session-backed configuration
    # Defaults for this configuration. If settings don't exist in the
    # database yet, the ->getInfo() method will not include the (default)
    # values in the returned array. $defaults allows developers to define
    # new settings and the corresponding default values.
    var $defaults = array();                # List of default values

    function __construct($section=null, $defaults=array()) {
        if ($section)
            $this->section = $section;
        if ($this->section === null)
            return false;
Peter Rotich's avatar
Peter Rotich committed
        if ($defaults)
            $this->defaults = $defaults;

        if (isset($_SESSION['cfg:'.$this->section]))
            $this->session = &$_SESSION['cfg:'.$this->section];
        $this->load();
    }

    function load() {
        foreach ($this->items() as $I)
            $this->config[$I->key] = $I;
    function getNamespace() {
        return $this->section;
    }

Jared Hancock's avatar
Jared Hancock committed
    function getInfo() {
        $info = $this->defaults;
        foreach ($this->config as $key=>$item)
            $info[$key] = $item->value;
Jared Hancock's avatar
Jared Hancock committed
        return $info;
    }

    function get($key, $default=null) {
        if (isset($this->session) && isset($this->session[$key]))
            return $this->session[$key];
        elseif (isset($this->config[$key]))
            return $this->config[$key]->value;
        elseif (isset($this->defaults[$key]))
            return $this->defaults[$key];

        return $default;
    function exists($key) {
        return $this->get($key, null) ? true : false;
    }

    function set($key, $value) {
        return ($this->update($key, $value)) ? $value : null;
    function persist($key, $value) {
        if (!isset($this->session)) {
            $this->session = &$_SESSION['cfg:'.$this->section];
            $this->session = array();
        }
        $this->session[$key] = $value;
        return true;
    }

    function lastModified($key) {
        if (isset($this->config[$key]))
            return $this->config[$key]->updated;

        return false;
    function create($key, $value) {
        $item = new ConfigItem([
            $this->section_column => $this->section,
            'key' => $key,
            'value' => $value,
        ]);
        if (!$item->save())
            return false;

        return true;
    }

    function update($key, $value) {
Jared Hancock's avatar
Jared Hancock committed
        if (!$key)
            return false;
        elseif (!isset($this->config[$key]))
            return $this->create($key, $value);

        $item = $this->config[$key];
        $item->value = $value;
        return $item->save();
    function updateAll($updates) {
        foreach ($updates as $key=>$value)
            if (!$this->update($key, $value))
                return false;
        return true;
    }
Peter Rotich's avatar
Peter Rotich committed
    function destroy() {
        unset($this->session);
        return $this->items()->delete() > 0;
    function items() {
        return ConfigItem::items($this->section, $this->section_column);
    }
}

class ConfigItem
extends VerySimpleModel {
    static $meta = array(
        'table' => CONFIG_TABLE,
        'pk' => array('id'),
    );

    static function items($namespace, $column='namespace') {

        $items = static::objects()
            ->filter([$column => $namespace]);

        try {
            count($items);
        }
        catch (InconsistentModelException $ex) {
            // Pending upgrade ??
            $items = array();
        }

        return $items;
    }

    function save($refetch=false) {
        if ($this->dirty)
            $this->updated = SqlFunction::NOW();
        return parent::save($this->dirty || $refetch);

    // Clean password reset tokens that have expired
    static function cleanPwResets() {
        global $cfg;

        if (!$cfg || !($period = $cfg->getPwResetWindow())) // In seconds
            return false;

        return ConfigItem::objects()
             ->filter(array(
                'namespace' => 'pwreset',
                'updated__lt' => SqlFunction::NOW()->minus(SqlInterval::SECOND($period)),
            ))->delete();
    }
}

class OsticketConfig extends Config {
    var $table = CONFIG_TABLE;
    var $section = 'core';

    var $defaultDept;   //Default Department
    var $defaultSLA;   //Default SLA
    var $defaultEmail;  //Default Email
    var $alertEmail;  //Alert Email
    var $defaultSMTPEmail; //Default  SMTP Email

    var $defaults = array(
        'allow_pw_reset' =>     true,
        'pw_reset_window' =>    30,
        'enable_avatars' =>     true,
        'allow_attachments' =>  true,
        'agent_name_format' =>  'full', # First Last
        'client_name_format' => 'original', # As entered
        'auto_claim_tickets'=>  true,
        'collaborator_ticket_visibility' =>  true,
        'require_topic_to_close' =>  false,
        'system_language' =>    'en_US',
        'default_storage_bk' => 'D',
        'message_autoresponder_collabs' => true,
        'add_email_collabs' => true,
        'clients_only' => false,
        'client_registration' => 'closed',
        'accept_unregistered_email' => true,
        'default_help_topic' => 0,
        'help_topic_sort_mode' => 'a',
        'client_verify_email' => 1,
        'allow_auth_tokens' => 1,
        'verify_email_addrs' => 1,
        'client_avatar' => 'gravatar.mm',
        'agent_avatar' => 'gravatar.mm',
        'ticket_lock' => 2, // Lock on activity
        'max_open_tickets' => 0,
        'files_req_auth' => 1,
    function __construct($section=null) {
        parent::__construct($section);
        if (count($this->config) == 0) {
            // Fallback for osticket < 1.7@852ca89e
            $sql='SELECT * FROM '.$this->table.' WHERE id = 1';
            $meta = ConfigItem::getMeta();
            if (($res=db_query($sql)) && db_num_rows($res))
                foreach (db_fetch_array($res) as $key=>$value)
                    $this->config[$key] = $meta->newInstance(array('value'=>$value));
    function lastModified($key=false) {
        return max(array_map(array('parent', 'lastModified'),
            array_keys($this->config)));
    }

Jared Hancock's avatar
Jared Hancock committed
    function isHelpDeskOffline() {
        return ($this->get('isonline'));
    function isKnowledgebaseEnabled() {
        global $thisclient;

        if ($this->get('restrict_kb', false)
            && (!$thisclient || $thisclient->isGuest())
        ) {
            return false;
        }
Jared Hancock's avatar
Jared Hancock committed
        require_once(INCLUDE_DIR.'class.faq.php');
        return ($this->get('enable_kb') && FAQ::countPublishedFAQs());
    function isCannedResponseEnabled() {
        return $this->get('enable_premade');
    }

Jared Hancock's avatar
Jared Hancock committed
    function getVersion() {
    function getSchemaSignature($section=null) {
        if ((!$section || $section == $this->section)
                && ($v=$this->get('schema_signature')))
            return $v;

        // 1.7 after namespaced configuration, other namespace
        if ($section) {
            $sql='SELECT value FROM '.$this->table
                .' WHERE `key` = "schema_signature" and namespace='.db_input($section);
            if (($res=db_query($sql, false)) && db_num_rows($res))
                return db_result($res);
        }
Peter Rotich's avatar
Peter Rotich committed

        // 1.7 before namespaced configuration
        $sql='SELECT `schema_signature` FROM '.$this->table
            .' WHERE id=1';
        if (($res=db_query($sql, false)) && db_num_rows($res))
            return db_result($res);
        // old version 1.6
        return md5(self::getDBVersion());
    function getDbTimezone() {
        if (!$this->exists('db_timezone')) {
            require_once INCLUDE_DIR . 'class.timezone.php';
            $this->persist('db_timezone', DbTimezone::determine());
        return $this->get('db_timezone');
    function getDefaultTimezone() {
        return $this->get('default_timezone');
    }

    function getTimezone($user=false) {
        global $thisstaff, $thisclient;

        $user = $user ?: $thisstaff;

        if (!$user && $thisclient && is_callable(array($thisclient, 'getTimezone')))
            $user = $thisclient;

        if ($user)
            $zone = $user->getTimezone();

        if (!$zone)
            $zone = $this->get('default_timezone');

        if (!$zone)
            $zone = ini_get('date.timezone');
        return $zone;
    }

    function getDefaultLocale() {
        return $this->get('default_locale');
Jared Hancock's avatar
Jared Hancock committed
    /* Date & Time Formats */
Peter Rotich's avatar
Peter Rotich committed
    function getTimeFormat($propogate=false) {
        global $cfg;

        if ($this->get('date_formats') == 'custom')
            return $this->get('time_format');
Peter Rotich's avatar
Peter Rotich committed

        if ($propogate) {
            $format = 'h:i a'; // Default
            if (class_exists('IntlDateFormatter')) {
                $formatter = new IntlDateFormatter(
                    Internationalization::getCurrentLocale(),
                    IntlDateFormatter::NONE,
                    IntlDateFormatter::SHORT,
                    $this->getTimezone(),
                    IntlDateFormatter::GREGORIAN
                );
                $format = $formatter->getPattern();
            }
            // Check if we're forcing 24 hrs format
            if ($cfg && $cfg->isForce24HourTime() && $format)
                $format = trim(str_replace(array('a', 'h'), array('', 'H'),
                            $format));
            return $format;
        }

Peter Rotich's avatar
Peter Rotich committed

    function isForce24HourTime() {
        return $this->get('date_formats') == '24';
    }
Peter Rotich's avatar
Peter Rotich committed

    /**
     * getDateFormat
     *
     * Retrieve the current date format for the system, as a string, and in
     * the intl (icu) format.
     *
     * Parameters:
     * $propogate - (boolean:default=false), if set and the configuration
     *      indicates default date and time formats (ie. not custom), then
     *      the intl date formatter will be queried to find the pattern used
     *      internally for the current locale settings.
     */
    function getDateFormat($propogate=false) {
        if ($this->get('date_formats') == 'custom')
            return $this->get('date_format');
        if ($propogate) {
            if (class_exists('IntlDateFormatter')) {
                $formatter = new IntlDateFormatter(
                    Internationalization::getCurrentLocale(),
                    IntlDateFormatter::SHORT,
                    IntlDateFormatter::NONE,
                    $this->getTimezone(),
                    IntlDateFormatter::GREGORIAN
                );
                return $formatter->getPattern();
            }
Peter Rotich's avatar
Peter Rotich committed
            // Use a standard
            return 'y-M-d';
Jared Hancock's avatar
Jared Hancock committed
    }

    function getDateTimeFormat() {
        if ($this->get('date_formats') == 'custom')
            return $this->get('datetime_format');
Peter Rotich's avatar
Peter Rotich committed

        if (class_exists('IntlDateFormatter'))
            return sprintf('%s %s', $this->getDateFormat(true),
                    $this->getTimeFormat(true));

Jared Hancock's avatar
Jared Hancock committed
    }

    function getDayDateTimeFormat() {
        if ($this->get('date_formats') == 'custom')
            return $this->get('daydatetime_format');
        return '';
    function getConfigInfo() {
Jared Hancock's avatar
Jared Hancock committed
        return $this->getInfo();
Jared Hancock's avatar
Jared Hancock committed
    function getTitle() {
        return $this->get('helpdesk_title');
Jared Hancock's avatar
Jared Hancock committed
    function getUrl() {
        return $this->get('helpdesk_url');
Jared Hancock's avatar
Jared Hancock committed
    function getBaseUrl() { //Same as above with no trailing slash.
        return rtrim($this->getUrl(),'/');
    }

    function getPageSize() {
        return $this->get('max_page_size');
Jared Hancock's avatar
Jared Hancock committed
    }

    function getGracePeriod() {
        return $this->get('overdue_grace_period');
Jared Hancock's avatar
Jared Hancock committed
    }

    function getPasswdResetPeriod() {
        return $this->get('passwd_reset_period');
    function isRichTextEnabled() {
        return $this->get('enable_richtext');
    function getAllowIframes() {
JediKev's avatar
JediKev committed
        return str_replace(array(', ', ','), array(' ', ' '), $this->get('allow_iframes')) ?: "'self'";
    function getACL() {
        if (!($acl = $this->get('acl')))
            return null;

        return explode(',', str_replace(' ', '', $acl));
    }

    function getACLBackendOpts() {
        return array(
            0 => __('Disabled'),
            1 => __('All'),
            2 => __('Client Portal'),
            3 => __('Staff Panel')
        );
    }

    function getACLBackend() {
        return $this->get('acl_backend') ?: 0;
    }

    function isAvatarsEnabled() {
        return $this->get('enable_avatars');
    }

JediKev's avatar
JediKev committed
    function isTicketLockEnabled() {
        return (($this->getTicketLockMode() != Lock::MODE_DISABLED)
                && $this->getLockTime());
    }

Jared Hancock's avatar
Jared Hancock committed
    function getClientTimeout() {
        return $this->getClientSessionTimeout();
    }
Jared Hancock's avatar
Jared Hancock committed
    function getClientSessionTimeout() {
        return $this->get('client_session_timeout')*60;
Jared Hancock's avatar
Jared Hancock committed
    }

    function getClientLoginTimeout() {
        return $this->get('client_login_timeout')*60;
Jared Hancock's avatar
Jared Hancock committed
    }

    function getClientMaxLogins() {
        return $this->get('client_max_logins');
Jared Hancock's avatar
Jared Hancock committed
    }

    function getStaffTimeout() {
        return $this->getStaffSessionTimeout();
    }

    function getStaffSessionTimeout() {
        return $this->get('staff_session_timeout')*60;
Jared Hancock's avatar
Jared Hancock committed
    }

    function getStaffLoginTimeout() {
        return $this->get('staff_login_timeout')*60;
Jared Hancock's avatar
Jared Hancock committed
    }

    function getStaffMaxLogins() {
        return $this->get('staff_max_logins');
    function getStaffAvatarSource() {
        require_once INCLUDE_DIR . 'class.avatar.php';
        list($source, $mode) = explode('.', $this->get('agent_avatar'), 2);
        return AvatarSource::lookup($source, $mode);
    }

    function getClientAvatarSource() {
        require_once INCLUDE_DIR . 'class.avatar.php';
        list($source, $mode) = explode('.', $this->get('client_avatar'), 2);
        return AvatarSource::lookup($source, $mode);
    }

Jared Hancock's avatar
Jared Hancock committed
    function getLockTime() {
        return $this->get('autolock_minutes');
    function getTicketLockMode() {
        return $this->get('ticket_lock');
    }

    function getAgentNameFormat() {
        return $this->get('agent_name_format');
    }

    function getClientNameFormat() {
        return $this->get('client_name_format');
Jared Hancock's avatar
Jared Hancock committed
    function getDefaultDeptId() {
        return $this->get('default_dept_id');
Jared Hancock's avatar
Jared Hancock committed
    }

    function getDefaultDept() {

        if(!$this->defaultDept && $this->getDefaultDeptId())
            $this->defaultDept=Dept::lookup($this->getDefaultDeptId());

        return $this->defaultDept;
Jared Hancock's avatar
Jared Hancock committed

    function getDefaultEmailId() {
        return $this->get('default_email_id');
Jared Hancock's avatar
Jared Hancock committed
    }

    function getDefaultEmail() {

        if(!$this->defaultEmail && $this->getDefaultEmailId())
            $this->defaultEmail = Email::lookup($this->getDefaultEmailId());
Jared Hancock's avatar
Jared Hancock committed

        return $this->defaultEmail;
    }

    function getDefaultEmailAddress() {
        return ($email=$this->getDefaultEmail()) ? $email->getAddress() : null;
    function getDefaultTicketStatusId() {
        return $this->get('default_ticket_status_id', 1);
    }

Jared Hancock's avatar
Jared Hancock committed
    function getDefaultSLAId() {
        return $this->get('default_sla_id');
Jared Hancock's avatar
Jared Hancock committed
    }

    function getDefaultSLA() {

        if(!$this->defaultSLA && $this->getDefaultSLAId())
            $this->defaultSLA = SLA::lookup($this->getDefaultSLAId());
Jared Hancock's avatar
Jared Hancock committed

        return $this->defaultSLA;
    }

    function getAlertEmailId() {
        return $this->get('alert_email_id');
Jared Hancock's avatar
Jared Hancock committed
    }

    function getAlertEmail() {

        if(!$this->alertEmail)
            if(!($this->alertEmail = Email::lookup($this->getAlertEmailId())))
                $this->alertEmail = $this->getDefaultEmail();

Jared Hancock's avatar
Jared Hancock committed
        return $this->alertEmail;
    }

    function getDefaultSMTPEmail() {

        if(!$this->defaultSMTPEmail && $this->get('default_smtp_id'))
            $this->defaultSMTPEmail = Email::lookup($this->get('default_smtp_id'));

Jared Hancock's avatar
Jared Hancock committed
        return $this->defaultSMTPEmail;
    }

    function getDefaultPriorityId() {
        return $this->get('default_priority_id');
    function getDefaultPriority() {
        if (!isset($this->defaultPriority))
            $this->defaultPriority = Priority::lookup($this->getDefaultPriorityId());

        return $this->defaultPriority;
    }

    function getDefaultTopicId() {
        return $this->get('default_help_topic');
    }

    function getDefaultTopic() {
        return Topic::lookup($this->getDefaultTopicId());
    }

    function getTopicSortMode() {
        return $this->get('help_topic_sort_mode');
    }

    function setTopicSortMode($mode) {
        $modes = static::allTopicSortModes();
        if (!isset($modes[$mode]))
            throw new InvalidArgumentException(sprintf(
                '%s: Unsupported help topic sort mode', $mode));

        $this->update('help_topic_sort_mode', $mode);
    }

    static function allTopicSortModes() {
        return array(
            Topic::SORT_ALPHA   => __('Alphabetically'),
            Topic::SORT_MANUAL  => __('Manually'),
Jared Hancock's avatar
Jared Hancock committed
    function getDefaultTemplateId() {
        return $this->get('default_template_id');
Jared Hancock's avatar
Jared Hancock committed
    }

    function getDefaultTemplate() {
Jared Hancock's avatar
Jared Hancock committed
        if(!$this->defaultTemplate && $this->getDefaultTemplateId())
            $this->defaultTemplate = EmailTemplateGroup::lookup($this->getDefaultTemplateId());
Jared Hancock's avatar
Jared Hancock committed

        return $this->defaultTemplate;
    }

    function getLandingPageId() {
        return $this->get('landing_page_id');
    }

    function getLandingPage() {

        if(!$this->landing_page && $this->getLandingPageId())
            $this->landing_page = Page::lookup($this->getLandingPageId());

        return $this->landing_page;
    }

    function getOfflinePageId() {
        return $this->get('offline_page_id');
    }

    function getOfflinePage() {

        if(!$this->offline_page && $this->getOfflinePageId())
            $this->offline_page = Page::lookup($this->getOfflinePageId());

        return $this->offline_page;
    }

    function getThankYouPageId() {
        return $this->get('thank-you_page_id');
    }

    function getThankYouPage() {

        if(!$this->thankyou_page && $this->getThankYouPageId())
            $this->thankyou_page = Page::lookup($this->getThankYouPageId());

        return $this->thankyou_page;
    }

    function getDefaultPages() {
        /* Array of ids...as opposed to objects */
        return array(
                $this->getLandingPageId(),
                $this->getOfflinePageId(),
                $this->getThankYouPageId(),
                );
    }

Jared Hancock's avatar
Jared Hancock committed
    function getMaxOpenTickets() {
         return $this->get('max_open_tickets');
Jared Hancock's avatar
Jared Hancock committed
    }

    function getMaxFileSize() {
        return $this->get('max_file_size');
Jared Hancock's avatar
Jared Hancock committed
    }

    function getLogLevel() {
        return $this->get('log_level');
Jared Hancock's avatar
Jared Hancock committed
    }

    function getLogGracePeriod() {
        return $this->get('log_graceperiod');
Jared Hancock's avatar
Jared Hancock committed
    }

    function enableStaffIPBinding() {
        return ($this->get('staff_ip_binding'));
    /**
     * Configuration: allow_pw_reset
     *
     * TRUE if the <a>Forgot my password</a> link and system should be
     * enabled, and FALSE otherwise.
     */
    function allowPasswordReset() {
        return $this->get('allow_pw_reset');
    }

    /**
     * Configuration: pw_reset_window
     *
     * Number of minutes for which the password reset token is valid.
     *
     * Returns: Number of seconds the password reset token is valid. The
     *      number of minutes from the database is automatically converted
     *      to seconds here.
     */
    function getPwResetWindow() {
        // pw_reset_window is stored in minutes. Return value in seconds
        return $this->get('pw_reset_window') * 60;
    }

    function isClientLoginRequired() {
        return $this->get('clients_only');
    }

    function isClientRegistrationEnabled() {
        return in_array($this->getClientRegistrationMode(),
            array('public', 'auto'));
    }

    function getClientRegistrationMode() {
        return $this->get('client_registration');
    }

    function isClientEmailVerificationRequired() {
        return $this->get('client_verify_email');
    }

    function isAuthTokenEnabled() {
        return $this->get('allow_auth_tokens');
    }

    function isCaptchaEnabled() {
        return (extension_loaded('gd') && function_exists('gd_info') && $this->get('enable_captcha'));
    function isAutoCronEnabled() {
        return ($this->get('enable_auto_cron'));

    function isEmailPollingEnabled() {
        return ($this->get('enable_mail_polling'));
Jared Hancock's avatar
Jared Hancock committed
    function useEmailPriority() {
        return ($this->get('use_email_priority'));
    function acceptUnregisteredEmail() {
        return $this->get('accept_unregistered_email');
    }

    function addCollabsViaEmail() {
        return ($this->get('add_email_collabs'));
    }

Jared Hancock's avatar
Jared Hancock committed
    function getAdminEmail() {
         return $this->get('admin_email');
    function verifyEmailAddrs() {
        return (bool) $this->get('verify_email_addrs');
    }

Jared Hancock's avatar
Jared Hancock committed
    function getReplySeparator() {
        return $this->get('reply_separator');
Jared Hancock's avatar
Jared Hancock committed
    function stripQuotedReply() {
        return ($this->get('strip_quoted_reply'));
Jared Hancock's avatar
Jared Hancock committed
    }

    function saveEmailHeaders() {
        return true; //No longer an option...hint: big plans for headers coming!!
    }
    function getDefaultTicketSequence() {
        if ($this->get('ticket_sequence_id'))
            $sequence = Sequence::lookup($this->get('ticket_sequence_id'));
        if (!$sequence)
            $sequence = new RandomSequence();
        return $sequence;
    }
JediKev's avatar
JediKev committed
    function showTopLevelTicketCounts() {
        return ($this->get('queue_bucket_counts'));
    }

    function getDefaultTicketNumberFormat() {
        return $this->get('ticket_number_format');
    function getNewTicketNumber() {
        $s = $this->getDefaultTicketSequence();
        return $s->next($this->getDefaultTicketNumberFormat(),
            array('Ticket', 'isTicketNumberUnique'));
Peter Rotich's avatar
Peter Rotich committed
    // Task sequence
    function getDefaultTaskSequence() {
        if ($this->get('task_sequence_id'))
            $sequence = Sequence::lookup($this->get('task_sequence_id'));
        if (!$sequence)
            $sequence = new RandomSequence();

        return $sequence;
    }

    function getDefaultTaskNumberFormat() {
        return $this->get('task_number_format');
    }

    function getNewTaskNumber() {
        $s = $this->getDefaultTaskSequence();
        return $s->next($this->getDefaultTaskNumberFormat(),
            array('Task', 'isNumberUnique'));
    }

Jared Hancock's avatar
Jared Hancock committed
    /* autoresponders  & Alerts */
    function autoRespONNewTicket() {
        return ($this->get('ticket_autoresponder'));
Jared Hancock's avatar
Jared Hancock committed
    function autoRespONNewMessage() {
        return ($this->get('message_autoresponder'));
    function notifyCollabsONNewMessage() {
        return ($this->get('message_autoresponder_collabs'));
    }

Jared Hancock's avatar
Jared Hancock committed
    function notifyONNewStaffTicket() {
        return ($this->get('ticket_notice_active'));
Jared Hancock's avatar
Jared Hancock committed
    }

    function alertONNewMessage() {
        return ($this->get('message_alert_active'));
Jared Hancock's avatar
Jared Hancock committed
    }

    function alertLastRespondentONNewMessage() {
        return ($this->get('message_alert_laststaff'));
Jared Hancock's avatar
Jared Hancock committed
    function alertAssignedONNewMessage() {
        return ($this->get('message_alert_assigned'));
Jared Hancock's avatar
Jared Hancock committed
    function alertDeptManagerONNewMessage() {
        return ($this->get('message_alert_dept_manager'));
    function alertAcctManagerONNewMessage() {
        return ($this->get('message_alert_acct_manager'));
    }

Peter Rotich's avatar
Peter Rotich committed
    //TODO: change note_alert to activity_alert
    function alertONNewActivity() {
        return ($this->get('note_alert_active'));
Peter Rotich's avatar
Peter Rotich committed
    function alertLastRespondentONNewActivity() {
        return ($this->get('note_alert_laststaff'));
Peter Rotich's avatar
Peter Rotich committed
    function alertAssignedONNewActivity() {
        return ($this->get('note_alert_assigned'));
Peter Rotich's avatar
Peter Rotich committed
    function alertDeptManagerONNewActivity() {
        return ($this->get('note_alert_dept_manager'));
Jared Hancock's avatar
Jared Hancock committed
    }

    function alertONNewTicket() {
        return ($this->get('ticket_alert_active'));
Jared Hancock's avatar
Jared Hancock committed
    }

    function alertAdminONNewTicket() {
        return ($this->get('ticket_alert_admin'));
Jared Hancock's avatar
Jared Hancock committed
    function alertDeptManagerONNewTicket() {
        return ($this->get('ticket_alert_dept_manager'));
Jared Hancock's avatar
Jared Hancock committed
    }

    function alertDeptMembersONNewTicket() {
        return ($this->get('ticket_alert_dept_members'));
    function alertAcctManagerONNewTicket() {
        return ($this->get('ticket_alert_acct_manager'));
    }

Jared Hancock's avatar
Jared Hancock committed
    function alertONTransfer() {
        return ($this->get('transfer_alert_active'));
Jared Hancock's avatar
Jared Hancock committed
    }

    function alertAssignedONTransfer() {
        return ($this->get('transfer_alert_assigned'));
Jared Hancock's avatar
Jared Hancock committed
    function alertDeptManagerONTransfer() {
        return ($this->get('transfer_alert_dept_manager'));
Jared Hancock's avatar
Jared Hancock committed
    function alertDeptMembersONTransfer() {
        return ($this->get('transfer_alert_dept_members'));
Jared Hancock's avatar
Jared Hancock committed
    }

    function alertONAssignment() {
        return ($this->get('assigned_alert_active'));
Jared Hancock's avatar
Jared Hancock committed
    }

    function alertStaffONAssignment() {
        return ($this->get('assigned_alert_staff'));
Jared Hancock's avatar
Jared Hancock committed
    }

    function alertTeamLeadONAssignment() {
        return ($this->get('assigned_alert_team_lead'));
Jared Hancock's avatar
Jared Hancock committed
    }

    function alertTeamMembersONAssignment() {
        return ($this->get('assigned_alert_team_members'));
Jared Hancock's avatar
Jared Hancock committed
    }


    function alertONOverdueTicket() {
        return ($this->get('overdue_alert_active'));
Jared Hancock's avatar
Jared Hancock committed
    }

    function alertAssignedONOverdueTicket() {
        return ($this->get('overdue_alert_assigned'));
Jared Hancock's avatar
Jared Hancock committed
    }

    function alertDeptManagerONOverdueTicket() {
        return ($this->get('overdue_alert_dept_manager'));
Jared Hancock's avatar
Jared Hancock committed
    }

    function alertDeptMembersONOverdueTicket() {
        return ($this->get('overdue_alert_dept_members'));
    function autoClaimTickets() {
        return $this->get('auto_claim_tickets');
    function collaboratorTicketsVisibility() {
        return $this->get('collaborator_ticket_visibility');
    }

    function requireTopicToClose() {
        return $this->get('require_topic_to_close');
    }

    function getDefaultTicketQueueId() {
Peter Rotich's avatar
Peter Rotich committed
        return $this->get('default_ticket_queue', 1);
Jared Hancock's avatar
Jared Hancock committed
    function hideStaffName() {
        return ($this->get('hide_staff_name'));
Jared Hancock's avatar
Jared Hancock committed
    }

    function sendOverLimitNotice() {
        return ($this->get('overlimit_notice_active'));