From c2ce2e9509ce0d0f109ca5d59c2a2017f5e98790 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Mon, 10 Aug 2015 14:56:36 -0500
Subject: [PATCH] ticket: Fix auto-claim from canned auto-reply

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

diff --git a/include/class.ticket.php b/include/class.ticket.php
index 4b19339fc..37592863d 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -2315,7 +2315,7 @@ implements RestrictedAccess, Threadable {
                       'cannedattachments' => $files
         );
         $errors = array();
-        if (!($response=$this->postReply($info, $errors, false)))
+        if (!($response=$this->postReply($info, $errors, false, false)))
             return null;
 
         $this->markUnAnswered();
@@ -2354,10 +2354,9 @@ implements RestrictedAccess, Threadable {
     }
 
     /* public */
-    function postReply($vars, &$errors, $alert = true) {
+    function postReply($vars, &$errors, $alert=true, $claim=true) {
         global $thisstaff, $cfg;
 
-
         if (!$vars['poster'] && $thisstaff)
             $vars['poster'] = $thisstaff;
 
@@ -2379,7 +2378,7 @@ implements RestrictedAccess, Threadable {
         }
 
         // Claim on response bypasses the department assignment restrictions
-        if ($thisstaff && $this->isOpen() && !$this->getStaffId()
+        if ($claim && $thisstaff && $this->isOpen() && !$this->getStaffId()
             && $cfg->autoClaimTickets()
         ) {
             $this->setStaffId($thisstaff->getId()); //direct assignment;
-- 
GitLab