From 6de379336f3b58264f65e83234d877677871bc34 Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Tue, 26 Aug 2014 20:41:58 +0000
Subject: [PATCH] Mark reopened tickets as un-answered

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

diff --git a/include/class.ticket.php b/include/class.ticket.php
index f451de786..daa241d91 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -864,12 +864,15 @@ class Ticket {
             case 'open':
                 // TODO: check current status if it allows for reopening
                 if ($this->isClosed()) {
-                    $sql.= ',closed=NULL, reopened=NOW() ';
-
+                    $sql .= ',closed=NULL, reopened=NOW() ';
                     $ecb = function ($t) {
                         $t->logEvent('reopened', 'closed');
                     };
                 }
+
+                // If the ticket is not open then clear answered flag
+                if (!$this->isOpen())
+                    $sql .= ', isanswered = 0 ';
                 break;
             default:
                 return false;
-- 
GitLab