[rt-users] Send ticket to other queue from the actions menu

Emmanuel Lacour elacour at easter-eggs.com
Thu Oct 9 03:43:09 EDT 2014


On Wed, Oct 08, 2014 at 11:12:15PM +0200, Rinke Colen wrote:
>    I know how to define actions in RT_SiteConfig.pm like this:
> 
>      actions => [
>          '* -> closed' => {
>              label  => 'Close',
>              update => 'Respond',
>          },
> 
>    But I need something fancier now. I want to send my ticket to another
>    queue from the Actions menu. I want this action to be available only from
>    some statuses in the lifecycle. How can I do this? (I have already
>    configured a mapping under __maps__.)
>    Rinke


You have to use a callback (a file named
local/html/Callbacks/YourOrg/Elements/Tabs/Privileged). Then inside you
have to write your logic to finally add the action to the menu, example:

<%init>
my $request_path = $HTML::Mason::Commands::r->path_info;


# Only on ticket pages
if ( $request_path =~ qr{^/Ticket/.*\.html} && $m->request_args->{'id'}
&&  $m->request_args->{'id'} =~ /^\d+$/ ) {
        
    my $Ticket = RT::Ticket->new( $session{'CurrentUser'} );
    $Ticket->Load( $m->request_args->{'id'} );

    # Only if status is FIXME
    if ( $Ticket->Status eq 'FIXME' ) {
        my $tabs = PageMenu;
        my $actions = $tabs->child( 'actions' );

        my $Queue = RT::Queue->new( $session{'CurrentUser'} );
        $Queue->Load('YourTargetQueue');

        # Add our custom action here
        $actions->child(
                    'sendtoqueueX' => title => loc('Send to queue X'), path =>
                    '/Ticket/Display.html?id='.$Ticket->Id.'&Queue='.$Queue->id
                     );
    }
}
</%init>

@BPS: would be nice to be able to specify an "url" in Lifecycle actions
with basic replacements (__id__, ...)


-- 
Easter-eggs                              Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37    -   Fax: +33 (0) 1 43 35 00 76
mailto:elacour at easter-eggs.com  -   http://www.easter-eggs.com



More information about the rt-users mailing list