From 853a15cf10195debff86aecc7f326696ca2092d7 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Thu, 21 Nov 2013 11:09:39 -0600
Subject: [PATCH] Re-enable user identification by reply-to email header

---
 include/class.filter.php | 2 ++
 include/class.ticket.php | 8 +++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/include/class.filter.php b/include/class.filter.php
index 3f01e5d0e..db1256250 100644
--- a/include/class.filter.php
+++ b/include/class.filter.php
@@ -679,6 +679,8 @@ class TicketFilter {
         //Extract the vars we care about (fields we filter by!).
         $this->vars = array('body'=>$vars['message']);
         $interest = Filter::getSupportedMatchFields();
+        // emailId is always significant to the filter process
+        $interest[] = 'emailId';
         foreach ($vars as $k=>$v) {
             if (in_array($k, $interest))
                 $this->vars[$k] = trim($v);
diff --git a/include/class.ticket.php b/include/class.ticket.php
index 616656207..10798a28e 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -2012,12 +2012,14 @@ class Ticket {
         //Any error above is fatal.
         if($errors)  return 0;
 
-        $user = User::fromForm($user_info);
-        $user_email = UserEmail::ensure($user_info['email']);
-
         # Perform ticket filter actions on the new ticket arguments
         if ($ticket_filter) $ticket_filter->apply($vars);
 
+        // Allow vars to be changed in ticket filter and applied to the user
+        // account created or detected
+        $user = User::fromForm($vars);
+        $user_email = UserEmail::ensure($vars['email']);
+
         # Some things will need to be unpacked back into the scope of this
         # function
         if (isset($vars['autorespond'])) $autorespond=$vars['autorespond'];
-- 
GitLab