From 3868ded259e4ef86b833e11c2110f05778c6ba4a Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Wed, 12 Mar 2014 15:40:07 +0000
Subject: [PATCH] oops: Fix bug where $this object is used out of context.

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

diff --git a/include/class.ticket.php b/include/class.ticket.php
index b26237755..57d8ff42b 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -2429,7 +2429,8 @@ class Ticket {
         return $ticket;
     }
 
-    function open($vars, &$errors) {
+    /* routine used by staff to open a new ticket */
+    static function open($vars, &$errors) {
         global $thisstaff, $cfg;
 
         if(!$thisstaff || !$thisstaff->canCreateTickets()) return false;
@@ -2513,7 +2514,7 @@ class Ticket {
                 $references = array($response->getEmailMessageId(), $references);
             $options = array(
                 'references' => $references,
-                'thread'=>$this->getLastMessage()
+                'thread' => $ticket->getLastMessage()
             );
             $email->send($ticket->getEmail(), $msg['subj'], $msg['body'], $attachments,
                 $options);
-- 
GitLab