From 14bcd42d8b4ad15073e2f423cc7ba2a0681e94b3 Mon Sep 17 00:00:00 2001
From: JediKev <kevin@enhancesoft.com>
Date: Fri, 3 Aug 2018 11:16:48 -0500
Subject: [PATCH] issue: Custom File Upload Dropping

This addresses issue 4155 where editing a ticket using a different session
causes custom file uploads to drop from the ticket.
---
 include/class.forms.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/class.forms.php b/include/class.forms.php
index 0fc575637..0e9735577 100644
--- a/include/class.forms.php
+++ b/include/class.forms.php
@@ -3974,7 +3974,10 @@ class FileUploadWidget extends Widget {
         // Files already attached to the field are allowed
         foreach ($this->field->getFiles() as $F) {
             // FIXME: This will need special porting in v1.10
-            $allowed[$F->id] = 1;
+            if ($F instanceof Attachment)
+                $allowed[$F->getFileId()] = 1;
+            else
+                $allowed[$F->id] = 1;
         }
 
         // New files uploaded in this session are allowed
-- 
GitLab