- 0 Talk
-
HideTransactions
Contents |
Hiding transactions in tickets' history
Edit
Introdduction
Edit
You should be familiar with CustomizingWithCallbacks as all examples here are based on 'SkipTransaction' callback in Ticket/Elements/ShowHistory Mason component. Create a Callback 'SkipTransaction' in local/html/Callbacks/<MyCallbacks>/Ticket/Elements/ShowHistory/SkipTransaction and pick code below.
SkipTransaction callback allows your code to set $$skip variable if you want to skip the current transaction.
Minimal example
Edit
This is minimal example as starting point that hides all transactions created by the system user.
<%INIT> $$skip = 1 if $Transaction->Creator == $RT::SystemUser->id; </%INIT> <%ARGS> $Transaction => undef $skip => undef </%ARGS>
Sane template for your custom code
Edit
<%INIT>
# do nothing if transaction is already flagged for skipping
# yes, this is possible, you may have many callbacks that
# skip using different conditions
return if $$skip;
# do nothing if it's not system user
return unless $Transaction->Creator == $RT::SystemUser->id;
# this is not good idea to skip some transaction types
# even if those are created by system user
return if $SHOW{ $Transaction->Type };
...
here add your additional conditions
...
</%INIT>
<%ONCE>
my %SHOW = map { $_ => 1} qw(
Create Comment Correspond
EmailRecord CommentEmailRecord
);
</%ONCE>
<%ARGS>
$Transaction => undef
$skip => undef
</%ARGS>
Additional code snippets
Edit
Do not hide on History.html page
Edit
If you'd like to have an abbreviated history on the main ticket display, but would like the full history in the History tab display, then add the following:
... # do nothing if we're on history page return if $r->uri =~ /History\.html/; ...
RT::Extension::BriefHistory
Edit
I created an extension where you can define which transaction types are shown on the ticket display page. The ticket history page shows always the full history. You can find it at github: http://github.com/cloos/rt-extension-briefhistory