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

2014-10-09 Thread Emmanuel Lacour
On Thu, Oct 09, 2014 at 10:17:09PM +1100, Alex Peters wrote:
>Does this code also actually move the ticket into the other queue?
> 

by the fact that it calls the Display.html template with the Queue
attribute. Each time Display.html is called on a ticket, it first
process arguments before displaying the ticket (including the change
results).

>I'm interested in doing something similar: setting up menu items to
>quickly set the ticket's Starts date to predefined relative future values.

you can do this with such callback, without any doubt :)


-- 
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:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training November 4 & 5 Los Angeles
http://bestpractical.com/training


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

2014-10-09 Thread Alex Peters
Does this code also actually move the ticket into the other queue?

I'm interested in doing something similar: setting up menu items to quickly
set the ticket's Starts date to predefined relative future values.

On 9 October 2014 18:43, Emmanuel Lacour  wrote:

> 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
>  );
> }
> }
> 
>
> @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:elac...@easter-eggs.com  -   http://www.easter-eggs.com
> --
> RT Training November 4 & 5 Los Angeles
> http://bestpractical.com/training
>
-- 
RT Training November 4 & 5 Los Angeles
http://bestpractical.com/training


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

2014-10-09 Thread Emmanuel Lacour
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
 );
}
}


@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:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training November 4 & 5 Los Angeles
http://bestpractical.com/training


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

2014-10-08 Thread Rinke Colen
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
-- 
RT Training November 4 & 5 Los Angeles
http://bestpractical.com/training