1 my $class = 'scripts-test';
2 my $instance_prefix = 'rt.';
3 my @zwrite = ('/usr/local/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/Scrips/zephyr.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: On Transaction
25 # Action: User Defined
26 # Template: Global template: Blank
27 # Stage: TransactionCreate
28 # Custom action preparation code:
30 # Custom action cleanup code:
34 my ($instance, $body, $extra) = @_;
35 open my $out, '|-', @zwrite, '-i', $instance, defined $extra ? ('-s', $extra) : ();
40 local $SIG{__DIE__} = sub {
43 send_notice "${instance_prefix}error", "Internal error in Zephyr scrip:\n$err";
46 (my $id = $self->TransactionObj->Ticket) =~ s/@/@@/g;
47 (my $description = $self->TransactionObj->Description) =~ s/@/@@/g;
48 (my $subject = $self->TransactionObj->TicketObj->Subject) =~ s/@/@@/g;
50 send_notice "$instance_prefix$id", $description, $subject;