[rt-users] queues in rt3

Jonas Lincoln lincoln at unit.liu.se
Thu Jun 12 05:23:26 EDT 2003


Use the condition On Queue Change (I think this comes with the standard 
installation, otherwise I can post the one I use).

As ScripAction, you can use the following (mails everyone with right 
SeeQueue on that queue (the queue that the ticket is moved _to_)

You probably want to insert into the database as well, table ScripActions.

/lib/RT/Actions/NotifyQueue.pm:

package RT::Action::NotifyQueue;
require RT::Action::SendEmail;

use strict;
use vars qw/@ISA/;
@ISA = qw(RT::Action::SendEmail);


# {{{ sub SetRecipients

=head2 SetRecipients

Sets the recipients of this message to this ticket's Requestor.

=cut


sub SetRecipients {
     my $self=shift;

     my $QueueObj = $self->TicketObj->QueueObj;
     my $Users = new RT::Users($QueueObj->CurrentUser);
     $Users->WhoHaveRight(Right => 'SeeQueue',
			 Object => $QueueObj);
     my @UserList = @{ $Users->ItemsArrayRef };
     while (my $UserObj = shift @UserList) {
       push @{ $self->{'To'} },$UserObj->EmailAddress;
     }
     return (1);
}

# }}}


# {{{ sub SetReturnAddress

=head2 SetReturnAddress

Set this message\'s return address to the apropriate queue address

=cut

sub SetReturnAddress {
     my $self = shift;
     my %args = ( is_comment => 0,
		 @_
	       );

     my $replyto;
     if ($args{'is_comment'}) {
	$replyto = $self->TicketObj->QueueObj->CommentAddress ||
		     $RT::CommentAddress;
     }
     else {
	$replyto = $self->TicketObj->QueueObj->CorrespondAddress ||
		     $RT::CorrespondAddress;
     }

     unless ($self->TemplateObj->MIMEObj->head->get('From')) {
	my $friendly_name = $self->TicketObj->QueueObj->Description ||
		$self->TicketObj->QueueObj->Name;
	$friendly_name =~ s/"/\\"/g;
	$self->SetHeader('From', "\"$friendly_name\" <$replyto>");
     }

     unless ($self->TemplateObj->MIMEObj->head->get('Reply-To')) {
	$self->SetHeader('Reply-To', "$replyto");
     }

}

# }}}

eval "require RT::Action::NotifyQueue_Local";
die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/NotifyQueue_Local.pm});

1;


Cheers,
Jonas

Sebastian Flothow wrote:
>> When a ticket is moved from one queue to another, is that ticket 
>> "created" in the new queue?  I am trying to have a script set up so 
>> that when a ticket is moved to another queue, a notification is sent out.
> 
> 
> A ticket is created only once, moving between queues is a different type 
> oft transaction. So, basically, you need a ScripCondition which triggers 
> on this transaction type. I think there was one in contrib for rt2, not 
> sure whether there is for rt3.
> 
> 
> 
> Sebastian
> 
> -- 
> Sebastian Flothow
> sebastian at flothow.de
> 
>  > Because it reverses the logical flow of conversation.
> Why is top posting frowned upon?
> 
> _______________________________________________
> rt-users mailing list
> rt-users at lists.fsck.com
> http://lists.fsck.com/mailman/listinfo/rt-users
> 
> Have you read the FAQ? The RT FAQ Manager lives at http://fsck.com/rtfm




More information about the rt-users mailing list