[rt-users] Callbacks not working
Ruslan Zakirov
ruz at bestpractical.com
Tue Jun 12 10:39:49 EDT 2012
On Tue, Jun 12, 2012 at 6:29 PM, Mark Collins <mark at westgateit.com> wrote:
> Hi all,
>
> I'm trying to get a callback working that hides the system updates in a tickets history, but nothing is happening.
>
> I've placed the callback in /opt/rt/local/html/Callbacks/Westgate/Tickets/Elements (it's call ShowHistory), and the callback code just isn't running. The callback itself is as follows:
It should be .../Westgate/Tickets/Elements/ShowHistory directory and
file should be named after name of the callback you want to use. In
this case it's SkipTransaction.
Below see comments about your code.
> ========================
> <%init>
> my $myskip=1;
>
> if ( $Transaction->Type =~ /^(Correspond|Create)$/ ) {
> $myskip = 0;
> }
> $$skip=$myskip;
>
> </%init>
>
> <%args>
> $Transaction => undef
> $skip => undef
> </%args>
Logic of the code is slightly wrong. It will work, but it doesn't cope
with multiple callbacks. You shouldn't set $$skip to 1. Use "return if
$$skip;" as first line in the <%INIT> block. This way you can avoid
conflicts with extensions that use this callback.
Also, condition looks too agressive, you skip status changes,
comments, custom field changes and many other things, but it's really
up to you what to do here.
Check that $m->request_path matches 'Display.html'. This way you can
have short history on ticket's primary page and full when History tab
is clicked.
> ========================
>
> Any ideas on why this isn't working?
>
> Mark Collins
> Westgate IT
> Main
> 0845 017 8852
> Fax
> 0845 017 8854
> Web
> http://www.westgateit.com
>
>
>
>
> Fax to email
> 0845 017 8853
>
>
>
>
>
>
>
>
>
> Westgate IT Ltd. 12 Riverside Court, Lower Bristol Road, Bath, BA2 3DZ
> Company Registered in England and Wales, 3379298. Vat Registration Number: 692 0383 29
>
> This message (and any associated files) is intended only for the use of the individual or entity to which it is addressed and may contain information that is confidential, subject to copyright or constitutes a trade secret. If you are not the intended recipient you are hereby notified that any dissemination, copying or distribution of this message, or files associated with this message, is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. Messages sent to and from us may be monitored.
>
> Internet communications cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. Therefore, we do not accept responsibility for any errors or omissions that are present in this message, or any attachment, that have arisen as a result of e-mail transmission. If verification is required, please request a hard-copy version. Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.
>
> Scanned by MailDefender - managed email security from intY - www.maildefender.net
--
Best regards, Ruslan.
More information about the rt-users
mailing list