I just finished hacking on RT’s SelfService interface to suit Katipo’s needs. For those of you not familiar with Request Tracker (usually referred to as RT), it is a open source ticket tracker app written in Perl with a very long list of features.
Several of the coolest features relate to how you can add custom code without touching your source distribution. This makes upgrades a much less painful process, but still gives you the flexibility of being able to fully hack the app. Yesterday I used a Callback to exclude certain types of transactions from a ticket’s display of history.
While digging through /usr/share/request-tracker3.4/html/Ticket/Elements/ShowHistory, I found a callback called SkipTransaction. It sounded like just what I needed, but how did it work? A quick search of the RT wiki’s FAQ gave me some simple example code by Oliver Oberlach.
Not much to it. Follow the directions about how to work with callbacks (i.e. create the corresponding file in the right place) and then all it boils down to is setting $$skip to 1 if some attribute of your $Transaction object matches whatever condition suits you. Here’s what it looked like for me:
%# /usr/local/share/request-tracker3.4/\
html/Callbacks/KatipoCallbacks/Ticket/\
Elements/ShowHistory/SkipTransactions
%#
%# What transactions to skip for SelfService interface
%#
%# Walter McGinnis, 2006-07-12
# this should get rid of the display of priority adjustments
$$skip = 1 if $Transaction->CreatorObj->Name eq “rt_cronjob_user”;
$Transaction => undef
$skip => undef