73 lines
1.8 KiB
Plaintext
73 lines
1.8 KiB
Plaintext
# On create:
|
|
# - Sent email to requestor
|
|
# - Check queue, and transfer to new queue if required
|
|
|
|
# Custom condition:
|
|
|
|
my $txn = $self->TransactionObj;
|
|
my $type = $txn->Type;
|
|
my $ticket = $self->TicketObj;
|
|
|
|
#return 0 unless $type eq "Status" || ( $type eq 'Set' && $txn->Field eq 'Status');
|
|
# To test by triggering change of status (Condition ^ above!)
|
|
|
|
#Only act in test-queue (safety for testing)
|
|
return 0 unless $ticket->QueueObj->Name eq "test-queue";
|
|
#Only act on creation
|
|
return 0 unless $txn->Type eq "Create";
|
|
|
|
return 1;
|
|
|
|
|
|
# Custom action preparation code:
|
|
require RT::Action::SendEmail;
|
|
use strict;
|
|
use vars qw/@ISA/;
|
|
@ISA = qw(RT::Action::SendEmail);
|
|
$self->SetRecipients();
|
|
$self->SUPER::Prepare();
|
|
$self->SUPER::Commit();
|
|
|
|
sub SetRecipients {
|
|
my $self = shift;
|
|
my $ticket = $self->TicketObj;
|
|
my ( @To, @PseudoTo, @Cc, @Bcc );
|
|
my $arg ='Owner,Requestor,AdminCc,Cc';
|
|
##Requestor
|
|
#push @To, $ticket->Requestors->MemberEmailAddresses;
|
|
push @To, $ticket->FirstCustomFieldValue('Inquirer Email');
|
|
|
|
my $creator = "Davis Admin";
|
|
@{ $self->{'To'} } = @To;
|
|
|
|
}
|
|
|
|
1;
|
|
|
|
# Custom action commit code:
|
|
my $ticket = $self->TicketObj;
|
|
my $queue = $ticket->FirstCustomFieldValue('Hub Queue');
|
|
|
|
#if ($ticket->Status() ne "new") {
|
|
# return 1;
|
|
#}
|
|
|
|
#$ticket->Comment(Content => 'Script #21 - sending email to requestor');
|
|
#$ticket->Comment(Content => 'Status is: '.$self->TicketObj->Status());
|
|
$ticket->Comment(Content => 'AUTO: Email sent to requestor is: '.$ticket->FirstCustomFieldValue('Inquirer Email'));
|
|
# $ticket->Comment(Content => 'To is: '.@{ $self->{'To'} });
|
|
|
|
#Now change Queue
|
|
#Get list of queues?:
|
|
if ($queue eq "test-queue") {
|
|
$ticket->Comment(Content => 'AUTO: Leaving in current queue');
|
|
} else {
|
|
$ticket->Comment(Content => 'AUTO: Changing queue to'.$queue);
|
|
my ($status, $msg) = $ticket->SetQueue( $queue);
|
|
}
|
|
return 1;
|
|
|
|
|
|
|
|
|