1 my $class = 'scripts-test';
2 my $instance_prefix = 'rt.';
3 my @zwrite = ('/usr/athena/bin/zwrite', '-d', '-O', 'auto', '-c', $class);
5 # RT-to-Zephyr notification scrip
6 # http://snippets.scripts.mit.edu/gitweb.cgi/.git/blob/HEAD:/rt/zephyr-scrip.pl
8 # Copyright © 2010 Anders Kaseorg <andersk@mit.edu>
10 # This program is free software: you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation, either version 2 of the License, or
13 # (at your option) any later version.
15 # This program is distributed in the hope that it will be useful, but
16 # WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 # General Public License for more details.
20 # Usage: configure $class and $instance_prefix above, and create a
23 # Description: Send Zephyr
24 # Condition: User Defined
25 # Action: User Defined
26 # Template: Global template: Blank
27 # Stage: TrasnactionCreate
30 # Custom action preparation code:
32 # Custom action cleanup code:
36 my ($instance, $body, $extra) = @_;
37 open my $out, '|-', @zwrite, '-i', $instance, defined $extra ? ('-s', $extra) : ();
42 local $SIG{__DIE__} = sub {
45 send_notice "${instance_prefix}error", "Internal error in Zephyr scrip:\n$err";
48 (my $id = $self->TransactionObj->Ticket) =~ s/@/@@/g;
49 (my $description = $self->TransactionObj->Description) =~ s/@/@@/g;
50 (my $subject = $self->TransactionObj->TicketObj->Subject) =~ s/@/@@/g;
52 send_notice "$instance_prefix$id", $description, $subject;