From 3fb48a842f1cb5b247432d5a43c8d8da48080b2f Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@osticket.com> Date: Thu, 13 Mar 2014 16:44:36 +0000 Subject: [PATCH] Unpack the files uploaded by staff on new ticket in the context of response Staff uploaded files, on new ticket, were getting attached to message instead of response. --- include/class.ticket.php | 5 +++++ scp/tickets.php | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/class.ticket.php b/include/class.ticket.php index 482bafbb7..6bbb84fed 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -2224,6 +2224,11 @@ class Ticket { // post response - if any $response = null; if($vars['response'] && $thisstaff->canPostReply()) { + + // unpack any uploaded files into vars. + if ($_FILES['attachments']) + $vars['files'] = AttachmentFile::format($_FILES['attachments']); + $vars['response'] = $ticket->replaceVars($vars['response']); if(($response=$ticket->postReply($vars, $errors, false))) { //Only state supported is closed on response diff --git a/scp/tickets.php b/scp/tickets.php index f28ac8e3e..649c1c63d 100644 --- a/scp/tickets.php +++ b/scp/tickets.php @@ -484,9 +484,6 @@ if($_POST && !$errors): $vars = $_POST; $vars['uid'] = $user? $user->getId() : 0; - if($_FILES['attachments']) - $vars['files'] = AttachmentFile::format($_FILES['attachments']); - if(($ticket=Ticket::open($vars, $errors))) { $msg='Ticket created successfully'; $_REQUEST['a']=null; -- GitLab