Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

File Uploads - Editing ticket as a different user removes attachments

I have a fault with OsTicket v1.10 when creating customer tickets with file upload field. If you set the file upload filed to a required field and you upload a file as user1. Then if you login as user2 and you edit the ticket and try to save the ticket it will show an error stating that the file upload file is required even though the file is still uploaded. If you delete the file and upload it again as user2 then it will allow you to save the ticket. You are then able to edit the ticket and save as user2. However if you login as user1 again and edit the ticket it will give the same error until you remove this file and upload it again.

Also with regards to file uploads, if this field is not a required field. User1 creates the ticket and uploads a file to file upload field. User1 can edit the ticket and save the ticket. If user2 edits the ticket and saves then the file upload that was done by user1 is removed completely automatically.

This is causing us many issues with our use of OSTicket in the setup i have as files that are important are being removed when users edit other fields within a ticket. I initially thought that perhaps this could be an error of migration as i migrated from v1.9 to v1.10. However i created a fresh install of OSTicket v1.10 with 2 users and created a customer form with a single file upload field and saw that it did exactly the same thing.

Comments

  • Please note this is not a fault in v1.9. All worked perfectly in v1.9. This fault only appears in V1.10
  • edited May 4
    Hi Ntozier. This code already appears in the class.thread_actions.php file that i have. However i still have the issue of attachments being removed.



    // Replace previous edit --------------------------
    $original = $old->getParent();
    // Link the new entry to the old id
    $entry->pid = $old->pid;
    // Drop the previous edit, and base this edit off the original
    $old->delete();
    $old = $original;
    }

    // Move the attachments to the new entry
    $old->attachments->update(array(
    'object_id' => $entry->id
    ));

    // Mark the new entry as edited (but not hidden nor guarded)
    $entry->flags = ($old->flags & ~(ThreadEntry::FLAG_HIDDEN | ThreadEntry::FLAG_GUARDED))
    | ThreadEntry::FLAG_EDITED;

    // Guard against deletes on future edit if requested. This is done
    // if an email was triggered by the last edit. In such a case, it
    // should not be replaced by a subsequent edit.
    if ($guard)
    $entry->flags |= ThreadEntry::FLAG_GUARDED;


  • Then you should probably post this to that github thread and let them know that it is not solved.
  • thanks, i have done
Sign In or Register to comment.