diff --git a/include/class.config.php b/include/class.config.php index c70a21d881e65a04acd81df917ec1d1891e68d3e..e886ad749bde746e946eb639e0fffea0948894db 100644 --- a/include/class.config.php +++ b/include/class.config.php @@ -432,6 +432,10 @@ class OsticketConfig extends Config { return $this->get('default_help_topic'); } + function getDefaultTopic() { + return Topic::lookup($this->getDefaultTopicId()); + } + function getTopicSortMode() { return $this->get('help_topic_sort_mode'); } diff --git a/include/class.email.php b/include/class.email.php index aa6facef4bdc65069d159e27aaca430160a54c1f..79b307dca3edaebedfcbdb8d63e68c31ed90e7b8 100644 --- a/include/class.email.php +++ b/include/class.email.php @@ -86,6 +86,16 @@ class Email { return $this->dept; } + function getTopicId() { + return $this->ht['topic_id']; + } + + function getTopic() { + // Topic::lookup will do validation on the ID, no need to duplicate + // code here + return Topic::lookup($this->getTopicId()); + } + function autoRespond() { return (!$this->ht['noautoresp']); } diff --git a/include/class.ticket.php b/include/class.ticket.php index c3f49246957ab049d5cc504b7f9e5abb94fb3bd8..805f3d1a2026b259b16e29fd636440c7d8540066 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -2403,6 +2403,10 @@ class Ticket { $form->setAnswer('priority', null, $email->getPriorityId()); if ($autorespond) $autorespond = $email->autoRespond(); + if (!isset($topic)) { + // This may return NULL. No big deal + $topic = $email->getTopic(); + } $email = null; $source = 'Email'; } @@ -2416,6 +2420,11 @@ class Ticket { $vars['teamId'] = substr($code, 1); } + if (!isset($topic)) { + // This may return NULL, no big deal + $topic = $cfg->getDefaultTopic(); + } + // Intenal mapping magic...see if we need to override anything if (isset($topic)) { $deptId = $deptId ?: $topic->getDeptId(); diff --git a/include/staff/email.inc.php b/include/staff/email.inc.php index acfcb4c64aff9ce23eb31d61e998aa7ef5766bcd..8f8e683121a80ca852c4b65073c899bbbbe658a2 100644 --- a/include/staff/email.inc.php +++ b/include/staff/email.inc.php @@ -127,7 +127,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); <td> <span> <select name="topic_id"> - <option value="0" selected="selected">— None —</option> + <option value="0" selected="selected">— System Default —</option> <?php $topics = Topic::getHelpTopics(); while (list($id,$topic) = each($topics)) { ?>