[rt-users] Action::EscalatePriority messing up my ticket history

Bernd Kuhlen -WetterOnline- bernd.kuhlen at wetteronline.de
Thu Oct 9 09:09:33 EDT 2008


Hi Alex,
I think I know the core of my problem. The whole directory ./Callbacks/ 
MyCallbacks.... hasn't existed before so I just made a "mkdir" to have  
it in my directory-tree.
But the RT doesn't know about the existence of this directory (it's  
not configured anywhere). That's why it's not working out, I guess.

I have a file called "ShowHistory" in my >rt-root>/html/Ticket/ 
Elements/ShowHistory. I'm pretty sure somewhere within this file I  
have to do the changes
I dump it for you (in case you have the time, please feel free just to  
skip this mail if you're busy ..)

<%perl>
if ($ShowDisplayModes or $ShowTitle) {
     my $title = $ShowTitle
                     ? loc('History')
                     : ' ';

     my $titleright;

     if ($ShowDisplayModes) {
         $titleright = '';

         if ($ShowHeaders) {
             $titleright .= qq{<a href="$URIFile?id=} .
                            $Ticket->id.qq{">} .
                            loc("Brief headers") .
                            qq{</a> — };
             $titleright .= q[<span class="selected">] . loc("Full  
headers") . "</span>";
         }
         else {
             $titleright .= q[<span class="selected">] . loc("Brief  
headers") . "</span> — ";
             $titleright .= qq{<a href="$URIFile?ShowHeaders=1;id=} .
                            $Ticket->id.qq{">} .
                            loc("Full headers") .
                            qq{</a>};
         }
     }
</%perl>
<div class="history">
<& /Widgets/TitleBoxStart, title => $title, titleright_raw =>  
$titleright &>
% }

<div id="ticket-history">
<%perl>
my @attachments = @{$Attachments->ItemsArrayRef()};
my @attachment_content = @{$AttachmentContent->ItemsArrayRef()};

while ( my $Transaction = $Transactions->Next ) {
     my $skip = 0;
     $m->callback(
         %ARGS,
         Transaction   => $Transaction,
         skip          => \$skip,
         CallbackName  => 'SkipTransaction',
     );
     next if $skip;

     $i++;

     my @trans_attachments = grep { $_->TransactionId == $Transaction- 
 >Id } @attachments;

     my $trans_content = {};
     grep { ($_->TransactionId == $Transaction->Id ) &&  
($trans_content->{$_->Id} = $_)  } @attachment_content;


     my $IsLastTransaction = 0;
     if ( $OldestFirst ) {
         $IsLastTransaction = $Transactions->IsLast;
     } else {
         $IsLastTransaction = 1 if ( $i == 1 );
     }
     #Args is first because we're clobbering the "Attachments" parameter
     $m->comp( 'ShowTransaction',
             %ARGS,

               Ticket               => $Ticket,
               Transaction          => $Transaction,
               ShowHeaders          => $ShowHeaders,
               RowNum               => $i,
               Attachments          => \@trans_attachments,
               AttachmentContent    => $trans_content,
               LastTransaction      => $IsLastTransaction
  );

# manually flush the content buffer after each txn, so the user sees
# some update
$m->flush_buffer();
}

</%perl>
</div>
% if ($ShowDisplayModes or $ShowTitle) {
<& /Widgets/TitleBoxEnd &>
% }
</div>
<%INIT>
my $Transactions = new RT::Transactions($session{'CurrentUser'});
if ($Tickets) {
     while (my $t = $Tickets->Next) {
         $Transactions->LimitToTicket($t->id);
     }
} else {
     $Transactions = $Ticket->Transactions;
}

my $OldestFirst = RT->Config->Get( 'OldestTransactionsFirst',  
$session{'CurrentUser'} );
my $SortOrder = $OldestFirst? 'ASC': 'DESC';
$Transactions->OrderByCols( { FIELD => 'Created',
                               ORDER => $SortOrder },
                             { FIELD => 'id',
                               ORDER => $SortOrder },
                           );

my $i;
$Attachments ||=  $m->comp('/Ticket/Elements/FindAttachments', Ticket  
=> $Ticket, Tickets => $Tickets || undef);
$AttachmentContent ||= $m->comp('/Ticket/Elements/ 
LoadTextAttachments', Ticket => $Ticket);

</%INIT>
<%ARGS>
$URIFile => RT->Config->Get('WebPath')."/Ticket/Display.html"
$Ticket => undef
$Tickets => undef
$Attachments => undef
$AttachmentContent => undef
$ShowHeaders => undef
$ShowTitle => 1
$ShowDisplayModes => 1
$WarnUnsigned => undef
</%ARGS>



On 9 Oct 2008, at 14:43, Bernd Kuhlen -WetterOnline- wrote:

> thanks a lot.
> I'll check this out.
>
> On 9 Oct 2008, at 14:39, Alex Young wrote:
>
>> Here is a copy of my file
>> /opt/rt3/local/html/Callbacks/MyCallbacks/Ticket/Elements/ 
>> ShowHistory/SkipTransaction
>>
>> <%init>
>>   $$skip = 1 if (($_SkipSystemMessages) && ($Transaction->Creator  
>> eq 1 | $Transaction->Creator eq 12));
>> </%init>
>> <%args>
>> $Transaction => undef
>> $skip => undef
>> $_SkipSystemMessages => undef
>> </%args>
>>
>> Creator ID 1 is RT_System, which pops up when you send emails out  
>> and other systems.
>> Creator ID 12 is the linux/RT user which runs the escelate job.
>>
>> All it is doing is seeing who created the transaction, and if its  
>> user number 1 or 12, it skips it.
>>
>> You will need ot find out the user ID number for the user running  
>> the escelate job. You can od this by looking in the user list. The  
>> nuber to the left is the number you would want to put into the  
>> “Creator eq XX” bit of the code.
>>
>> From: Bernd Kuhlen -WetterOnline- [mailto:bernd.kuhlen at wetteronline.de 
>> ]
>> Sent: 09 October 2008 11:38
>> To: Alex Young; rt-users at lists.bestpractical.com
>> Cc: Bernd Kuhlen -WetterOnline-
>> Subject: Re: [rt-users] Action::EscalatePriority messing up my  
>> ticket history
>>
>> Dear Alex, Dear List,
>> thanks for your quick response. I should add that I'm using  
>> RT-3.8.1 on FreeBSD6.3/amd64 (which I forgot in my first mail).
>>
>> I did the following (which didn't quite help me):
>>
>> mkdir -p Callbacks/MyCallbacks/Ticket/Elements/ShowHistory in my  
>> <rt-root>/local/html/Ticket directory. The whole directory  
>> "Callbacks" hadn't existed beforehand.
>> Into the file "SkipTransaction" I dumped the following:
>>
>> <%init>
>>   $$skip = 1 if (($_SkipSystemMessages) && ($Transaction->Creator  
>> eq 1));
>> </%init>
>> <%args>
>> $Transaction => undef
>> $skip => undef
>> $_SkipSystemMessages => undef
>> </%args>
>>
>> Then in my "Display.html" I changed this block
>>
>>
>> <& /Ticket/Elements/ShowHistory ,
>>      Ticket => $TicketObj,
>>      Tickets => $Tickets,
>>      Collapsed => $ARGS{'Collapsed'},
>>      ShowHeaders => $ARGS{'ShowHeaders'},
>>      Attachments => $attachments,
>>      AttachmentContent => $attachment_content,
>>      _SkipSystemMessages => !0        <----- that's what I added
>>      &>
>>
>> I must confess I don't have a clue what this code is doing I'm not  
>> a programmer. The only thing I know: my ticket history is still  
>> being messed up with priority-change entries.
>>
>> I'm wondering if I could fix my problem by simply denying any  
>> existing rights for the user doing the cron job. Of course the  
>> Right "ModifyTicket" is needed but maybe there's some right for  
>> tracing changes in the history ?
>>
>> best regards,
>> Bernd
>>
>>
>>
>> On 9 Oct 2008, at 11:29, Alex Young wrote:
>>
>>
>> I set RT to hide some of the history using this:
>> http://wiki.bestpractical.com/view/HideTransactions
>>
>> All I have done is set it to hide the history of the RT_System user  
>> and
>> the user I have setup to escalate the tickets. You can still see  
>> their
>> entries on the history page, just not in anoy of the other pages.
>>
>>
>> -----Original Message-----
>> From: rt-users-bounces at lists.bestpractical.com
>> [mailto:rt-users-bounces at lists.bestpractical.com] On Behalf Of Bernd
>> Kuhlen -WetterOnline-
>> Sent: 09 October 2008 10:21
>> To: rt-users at lists.bestpractical.com
>> Subject: [rt-users] Action::EscalatePriority messing up my ticket
>> history
>>
>> Hi everyone,
>>
>> I've set up my rt-crontool like this:
>>
>> 0 1 * * * /usr/local/bin/rt-crontool --search RT::Search::FromSQL --
>> search-arg "(Status='new' OR Status='open' OR Status = 'stalled')" --
>> action RT::Action::EscalatePriority >/dev/null 2>/dev/null
>>
>> and it's working fine. But I don't want it to mess up my ticket
>> history. I have tickets starting with a priority of 0 and ending with
>> 100 in some weeks time and every night I get a new entry saying that
>> the ticket priority has changed. These entry are informative if the
>> priority has been manually changed but not if they just trace the
>> linear priority escalation done by a cronjob. So after a couple of
>> weeks I have numerous lines with a "ticket-priority changed" entry.
>> That's not nice.
>>
>> I'm new to RT and couldn't find anything about this matter by google
>> or in any wiki.
>>
>> best regards,
>> Bernd
>>
>> _______________________________________________
>> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>>
>> Community help: http://wiki.bestpractical.com
>> Commercial support: sales at bestpractical.com
>>
>>
>> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
>> Buy a copy at http://rtbook.bestpractical.com
>>
>>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20081009/b2bb5931/attachment.htm>


More information about the rt-users mailing list