How to create options to move tickets to a Spam Queue
Jump to navigation
Jump to search
To add a spam menu to ticket display page, you can make it via a callback, i.e.
Create "/opt/rt5/local/html/Callbacks/MyRT/Elements/Tabs/Privileged" with the following content(Replace queue id "3" with your real Spam queue id):
<%INIT> my $request_path = $HTML::Mason::Commands::r->path_info; $request_path =~ s!/{2,}!/!g; if ( $request_path =~ m{^/Ticket/} and my $id = $DECODED_ARGS->{id} ) { my $ticket = RT::Ticket->new( $session{CurrentUser} ); $ticket->Load($id); if ( $ticket->CurrentUserHasRight('ModifyTicket') && $ticket->Queue != 3 ) { PageMenu->child( "report-spam", title => "Spam", path => "/Ticket/Display.html?id=$id&Queue=3&Owner=Nobody", ); } } </%INIT>
To add it to searches, you can add the following item to the search format:
'<a href="__WebPath__/Ticket/Display.html?id=__id__;Queue=3;Owner=Nobody">Spam</a>',
The Queue list portlet uses default search format, so you will need to update config $DefaultSearchResultFormat accordingly, e.g.
Set($DefaultSearchResultFormat, qq{ '<B><A HREF="__WebPath__/Ticket/Display.html?id=__id__">__id__</a></B>/TITLE:#', '<B><A HREF="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a></B>/TITLE:Subject', Status, QueueName, Owner, Priority, '__NEWLINE__', '__NBSP__', '<small>__Requestors__</small>', '<small>__CreatedRelative__</small>', '<small>__ToldRelative__</small>', '<small>__LastUpdatedRelative__</small>', '<small>__TimeLeft__</small>', '<a href="__WebPath__/Ticket/Display.html?id=__id__;Queue=3;Owner=Nobody">Spam</a>', });
You can also pass the Name directly in ticket URL, e.g.
/Ticket/Display.html?id=$id&Queue=Spam&Owner=Nobody
To compare name instead, it's like:
if ( $ticket->CurrentUserHasRight('ModifyTicket') && $ticket->QueueObj->Name ne 'Spam' ) {