Request Tracker: Notify Previous Owner

699 Views Asked by At

I would like to be able to send an e-mail to the previous owner when someone steals a ticket, currently with Request Tracker I can send an e-mail to the new owner but not the previous owner.

There appears to be an extension to allow this however it does not support RT 4.2 (I am using 4.2.1): http://metacpan.org/pod/RT::Extension::NotifyOwners

Any help would be appreciated, if someone has this set up or is using the extension on RT 4.2 that would be great. I am pretty sure you can do this with a custom action but I do not have enough knowledge in this area.

Error from the log:

root@WEBSVR01:/home/steven# cpanm RT::Extension::NotifyOwners
--> Working on RT::Extension::NotifyOwners
Fetching http://www.cpan.org/authors/id/I/ID/IDN/RT-Extension-NotifyOwners-0.02.tar.gz ... OK
Configuring RT-Extension-NotifyOwners-0.02 ... N/A
! Configure failed for RT-Extension-NotifyOwners-0.02. See /root/.cpanm/work/1390880978.19447/build.log for details.
root@WEBSVR01:/home/steven# tail /root/.cpanm/work/1390880978.19447/build.log
Unpacking RT-Extension-NotifyOwners-0.02.tar.gz
Entering RT-Extension-NotifyOwners-0.02
Checking configure dependencies from META.yml
Checking if you have ExtUtils::MakeMaker 6.42 ... Yes (6.82)
Configuring RT-Extension-NotifyOwners-0.02
Running Makefile.PL
Cannot find the location of RT.pm that defines $RT::LocalPath in: inc /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/sh                     are/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl . /opt/                     rt3/lib /opt/lib/rt3 /opt/lib /usr/local/rt3/lib /usr/local/lib/rt3 /usr/local/lib /home/rt3/lib /home/lib/rt3 /home/lib                      /usr/rt3/lib /usr/lib/rt3 /usr/lib /sw/rt3/lib /sw/lib/rt3 /sw/lib
Path to directory containing your RT.pm:
-> N/A
-> FAIL Configure failed for RT-Extension-NotifyOwners-0.02. See /root/.cpanm/work/1390880978.19447/build.log for details.
1

There are 1 best solutions below

0
On

You can achieve that by a script and a template. Scrip On Steal Notify Old Owner should be like this:

my $field = $self->TransactionObj->Field;
my $type = $self->TransactionObj->Type;

return 0 unless defined($field);
return 0 unless $field eq 'Owner';
return 0 unless $type eq 'Set';
return 0 if $self->TransactionObj->OldValue == $self->TransactionObj->Creator;

return 1 if $self->TransactionObj->OldValue != RT::Nobody()->id();

return 0;

Condition of the scrip should be User defined, Action should be Notify Other Recipients, Template for example Stolen Ticket.

Perl template Stolen Ticket will be then for example this one:

To: {my $user = new RT::User($RT::SystemUser);
$user->Load($Transaction->OldValue); $user->EmailAddress() || $Transaction->OldValue}
Subject: [{$rtname } #{ $Ticket->Id() }] Stolen: { $Ticket->Subject() }

URL: https://rt.example.com/rt/Ticket/Display.html?id={ $Ticket->id }

A ticket you owned:
  { $Ticket->Subject() }

has been taken by {$Ticket->OwnerObj->RealName} <{$Ticket->OwnerObj->EmailAddress}>.