MakeClicky:Fedex: Difference between revisions
Jump to navigation
Jump to search
m (2 revisions imported) |
(No difference)
|
Latest revision as of 15:14, 6 April 2016
make a "local" MakeClicky callback. On Debian/Ubuntu packaged RT, the path for local mods is /usr/local/share/request-tracker3.8
Local callbacks go under: /usr/local/share/request-tracker3.8/html/Callbacks/Default
The makeClicky callbacks in particular go in the file: /usr/local/share/request-tracker3.8/html/Callbacks/Default/Elements/MakeClicky/Default
Put the following in that file in order to have 2 MakeClicky callbacks -- link_ticket and link_fedex. Remember to edit your RT_SiteConfig.pm file to activate your specific MakeClicky callbacks by name, like this:
Set(@Active_MakeClicky, qw(short_ticket_link markup_fedex));
Restart Apache after making the callback file (below) and editting the config file (above). Then whenever someone says "Fedex #333" in a ticket, it will automatically be a link to tracking for 333.
--- callback file named "Default" begins after this line --- <%ARGS> $types => [] $actions => {} </%ARGS> <%INIT> my $web_path = RT->Config->Get('WebPath'); # action that takes "Ticket #NNN" as argument and returns link to the ticket $actions->{'link_ticket'} = sub { my %args = @_; # use Data::Dumper; $RT::Logger->error(Dumper \%args); my $id = $args{all_matches}[1]; return qq{<a href="$web_path/Ticket/Display.html?id=$id">$args{value}</a>}; }; # action that takes "Fedex #NNN" as argument and returns link to fedex tracking $actions->{'link_fedex'} = sub { my %args = @_; # use Data::Dumper; $RT::Logger->error(Dumper \%args); my $id = $args{all_matches}[1]; return qq{<a target="_new" href="http://www.fedex.com/Tracking?tracknumbers=$id">$args{value}</a>}; }; # add action to the list push @$types, ( { name => 'short_ticket_link', # name, that should be used in config to activate action regex => qr{ticket\s+#(\d+)}i, # regular expression that matches text 'ticket #xxx' action => 'link_ticket', # name of the action that should be applied }, { name => 'markup_fedex', # name, that should be used in config to activate action regex => qr{Fedex\s+#(\d+)}i, # regular expression that matches text 'fedex #xxx' action => 'link_fedex', # name of the action that should be applied }, ); </%INIT>