Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

thread: Allow edits to the attachments of thread entry #120

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

greezybacon
Copy link
Contributor

This allows administrators with access to a thread and staff members access to edit the attachments of a thread entry item. Non administrators can only edit the attachments if they own the thread entry.

This is helpful if the incorrect attachments were submitted with a posting, or if the file names should be edited, or if additional attachments should have been added with the posting.

Edits to responses will not be resent to the end user. Instead, the posting should be edited afterwards and then resent. Perhaps a note could be added to the amended responses to indicate that the attachments were modified.

image

image

Outstanding

  • Would be nice to edit the filenames of new attachments inline (before submitting)

This allows administrators with access to a thread and staff members
access to edit the attachments of a thread entry item. Non
administrators can only edit the attachments if they own the thread
entry.

This is helpful if the incorrect attachments were submitted with a
posting, or if the file names should be edited, or if additional
attachments should have been added with the posting.

Edits to responses will not be resent to the end user. Instead, the
posting should be edited afterwards and then resent. Perhaps a note
could be added to the amended responses to indicate that the attachments
were modified.
@Chefkeks
Copy link
Contributor

Chefkeks commented Jan 3, 2017

Looks pretty good! 👍

@khaledmediouni
Copy link

Hi,

i tried to test this in my installation. But not showing in my plugin list
How to do it ?

Thank's

@ntozier
Copy link
Contributor

ntozier commented Feb 6, 2018

This was never released. But I imagine that you would do it like any other plugin, by reading the README and building the plugin.

https://github.com/osTicket/osTicket-plugins/blob/develop/README.md

Copy link

@jochenwezel jochenwezel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test scenario: Attachments storage is configured as database (the default)

Test description:
Given is a PDF attachment attached to a message of a ticket
When I click at the manage attachments button and remove the checkbox in front of the attachment
Then the attachment disappears in the UI
BUT the attachment data still exists in database

After deleting the attachment, I double-checked with these tables:

--following line shows 1 record with id 5113, also used in following sql statements
select *
    from ost_file
    where name = 'AusweiskopieXY.pdf'
    limit 0,10
    
select *
    from ost_file_chunk    
    where file_id = 5113
    limit 0,10 

Both tables still contain their record data.

Expected behaviour: the attachment reference at the UI + the real attachment data in database is removed

Finally, I solved my situation with

delete from ost_file_chunk where file_id = 5113;
delete from ost_file where id = 5113;

@jochenwezel
Copy link

@ntozier Installing this plugin was just to

  1. copy the files into a directory of the plugin directory
  2. use the admin area, management, plugins page: button add new plugin --> plugin found and installed --> plugin activated --> task completed.
    There was no need to do a php make.php hydrate

@BrettRow
Copy link

Has anyone got this to work with 1.12 ?

I created the plugin folder, added plugin in osTicket and enabled it. The dropdown menu option on a ticket now shows but when I select it I just get a one line blank popup.

This plugin would be very useful to remove the unnecessary attachment signatures and disclaimers that a lot of incoming emails have these days.

@sda399
Copy link

sda399 commented Jan 24, 2020

Hi, this is a useful feature, is this waiting for a pull request?

@sda399
Copy link

sda399 commented Jan 28, 2020

@greezybacon @jochenwezel

Both tables still contain their record data.

Expected behaviour: the attachment reference at the UI + the real attachment data in database is removed

Finally, I solved my situation with

delete from ost_file_chunk where file_id = 5113;
delete from ost_file where id = 5113;

I tested this plugin and it works for me.
deletion in file and file_chunk is run by cron.php which is supposed to delete orphaned files with some conditions -- see below.

cron.php chain calls class.file.php. Here's an excerpt:

static function deleteOrphans() {

        // XXX: Allow plugins to define filetypes which do not represent
        //      files attached to tickets or other things in the attachment
        //      table and are not logos
        $files = static::objects()
            ->filter(array(
                'attachments__object_id__isnull' => true,
                'ft' => 'T',
                'created__lt' => SqlFunction::NOW()->minus(SqlInterval::DAY(1)),
            ));

        foreach ($files as $f) {
            if (!$f->delete())
                break;
        }

        return true;
    }

This plugin is not included in the plugin repo, would someone pull this request please?

@ntozier
Copy link
Contributor

ntozier commented Jan 28, 2020

This plugin is not included in the plugin repo, would someone pull this request please?

This PR is not about a plugin?

@Mogio99
Copy link

Mogio99 commented Sep 23, 2021

Test scenario: Attachments storage is configured as database (the default)

Test description:
Given is a PDF attachment attached to a message of a ticket
When I click at the manage attachments button and remove the checkbox in front of the attachment
Then the attachment disappears in the UI
BUT the attachment data still exists in database

After deleting the attachment, I double-checked with these tables:

--following line shows 1 record with id 5113, also used in following sql statements
select *
    from ost_file
    where name = 'AusweiskopieXY.pdf'
    limit 0,10
    
select *
    from ost_file_chunk    
    where file_id = 5113
    limit 0,10 

Both tables still contain their record data.

Expected behaviour: the attachment reference at the UI + the real attachment data in database is removed

Finally, I solved my situation with

delete from ost_file_chunk where file_id = 5113;
delete from ost_file where id = 5113;

where did you put this part of code for delete attachements in ost_file and ost_file_chunk?

@Mogio99
Copy link

Mogio99 commented Sep 23, 2021

This plugin is not included in the plugin repo, would someone pull this request please?

using this plugin the attachments are only deleting in ost_attachement on db, there is a way to implement deletion from file and file_chunk that is not on phpmyadmin panel?

@Mogio99
Copy link

Mogio99 commented Sep 23, 2021

This allows administrators with access to a thread and staff members access to edit the attachments of a thread entry item. Non administrators can only edit the attachments if they own the thread entry.

This is helpful if the incorrect attachments were submitted with a posting, or if the file names should be edited, or if additional attachments should have been added with the posting.

Edits to responses will not be resent to the end user. Instead, the posting should be edited afterwards and then resent. Perhaps a note could be added to the amended responses to indicate that the attachments were modified.

image

image

Outstanding

  • Would be nice to edit the filenames of new attachments inline (before submitting)

using this plugin the attachments are only deleting in ost_attachement on db, there is a way to implement deletion from file and file_chunk that is not on phpmyadmin panel?

@Mogio99
Copy link

Mogio99 commented Sep 23, 2021

when i add a plugin it not showing in thread and in ost_attachments appear one lines with name,file_id and lang NULL

@Mogio99
Copy link

Mogio99 commented Sep 28, 2021

@greezybacon hi can you help me?
When i add an attachments from the plugin window, it not appear in ticket thread

plug1
plug2

@nandi96
Copy link

nandi96 commented Oct 25, 2022

Can not work with osTicket 1.17. When I try add a new plugin instance, the page is empty.
@greezybacon can u help me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants