From d22cbf2d1423c6f1cccb91cfdf391316139f71be Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Fri, 11 Jul 2014 09:33:23 -0500
Subject: [PATCH] Properly tag source and topic for emails

---
 include/class.ticket.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/class.ticket.php b/include/class.ticket.php
index 6518d12ea..a4981d374 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -2436,7 +2436,6 @@ class Ticket {
                 $form->setAnswer('priority', null, $topic->getPriorityId());
             if ($autorespond)
                 $autorespond = $topic->autoRespond();
-            $source = $vars['source'] ?: 'Web';
 
             //Auto assignment.
             if (!isset($vars['staffId']) && $topic->getStaffId())
@@ -2466,8 +2465,9 @@ class Ticket {
         if (!$priority || !$priority->getIdValue())
             $form->setAnswer('priority', null, $cfg->getDefaultPriorityId());
         $deptId = $deptId ?: $cfg->getDefaultDeptId();
-        $topicId = $vars['topicId'] ?: 0;
+        $topicId = isset($topic) ? $topic->getId() : 0;
         $ipaddress = $vars['ip'] ?: $_SERVER['REMOTE_ADDR'];
+        $source = $source ?: 'Web';
 
         //We are ready son...hold on to the rails.
         $number = Ticket::genRandTicketNumber();
-- 
GitLab