From 47920c496de7850a09a80646420344753a78053e Mon Sep 17 00:00:00 2001
From: aydreeihn <adriane@enhancesoft.com>
Date: Fri, 31 Aug 2018 10:38:07 -0500
Subject: [PATCH] Creating Tickets with Attachments

This commit fixes an issue where we were not emailing attachments for initial responses when creating a Ticket.
---
 include/class.ticket.php | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/include/class.ticket.php b/include/class.ticket.php
index 409804f86..95699e8f7 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -4134,10 +4134,14 @@ implements RestrictedAccess, Threadable, Searchable {
            $attachments = array();
            $message = $ticket->getLastMessage();
            if ($cfg->emailAttachments()) {
-               if ($message)
-                 $attachments = $message->getAttachments();
-               if ($response && $response->getNumAttachments())
-                 $attachments = $attachments->merge($response->getAttachments());
+               if ($message && $message->getNumAttachments()) {
+                 foreach ($message->getNumAttachments() as $attachment)
+                     $attachments[] = $attachment;
+               }
+               if ($response && $response->getNumAttachments()) {
+                 foreach ($response->getAttachments() as $attachment)
+                     $attachments[] = $attachment;
+               }
            }
 
             if ($vars['signature']=='mine')
-- 
GitLab