From 340e232f2a60b691abafc293c9f73785ca3008d9 Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@osticket.com> Date: Thu, 13 Mar 2014 16:51:03 +0000 Subject: [PATCH] fix: Make attachments unique per thread entry instead of the ticket thread The bug prevented attachments from being sent out if it was previously attached to the ticket - for example, you could resend a file to end user. --- include/class.thread.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/class.thread.php b/include/class.thread.php index 8a1f42ecf..fad99db93 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -475,10 +475,10 @@ Class ThreadEntry { return 0; // TODO: Add a unique index to TICKET_ATTACHMENT_TABLE (file_id, - // ticket_id), and remove this block + // ref_id), and remove this block if ($id = db_result(db_query('SELECT attach_id FROM '.TICKET_ATTACHMENT_TABLE - .' WHERE file_id='.db_input($fileId).' AND ticket_id=' - .db_input($this->getTicketId())))) + .' WHERE file_id='.db_input($fileId).' AND ref_id=' + .db_input($this->getId())))) return $id; $sql ='INSERT IGNORE INTO '.TICKET_ATTACHMENT_TABLE.' SET created=NOW() ' -- GitLab