From a0f5a0553fed65fb67f15db63934702c339f816a Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Sat, 29 Nov 2014 06:45:19 +0000
Subject: [PATCH] Do NOT reopen closed ticket due to autoreply

Do not reopen closed ticket, if the system can reliably determine that the new message is an
auto-response/reply from the end user.
---
 include/class.ticket.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/class.ticket.php b/include/class.ticket.php
index 3215f10ff..fdaedb949 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -1156,7 +1156,10 @@ class Ticket {
         }
 
         // Reopen if closed AND reopenable
-        if ($this->isClosed() && $this->isReopenable())
+        // We're also checking autorespond flag because we don't want to
+        // reopen closed tickets on auto-reply from end user. This is not to
+        // confused with autorespond on new message setting
+        if ($autorespond && $this->isClosed() && $this->isReopenable())
             $this->reopen();
 
        /**********   double check auto-response  ************/
-- 
GitLab