[rt-users] Useful contributions

Ruslan U. Zakirov cubic at acronis.ru
Sat Sep 6 05:29:49 EDT 2003


        Hello. All.
    I want to introduce several scrips, actions, scripts that could be 
useful.

1) Template part that add Attachment links list to email.
{ my $res;
  my $Attachments = $Transaction->Attachments;
  while (my $a = $Attachments->Next) {
    next unless ($a->Filename);
    $res .= "Attachments:\n" unless ($res);
    $res .= "  ". $RT::WebURL ."/Ticket/Attachment/". $Transaction->Id() 
."/". $a->id ."/". $a->Filename;
  }
  $res;
}

2) Scrip that on ticket resolving open all tickets which depends on 
resolved.
_____________________________________________________________
Description: open tickets which depends on resolved
Condition: On Resolve
Custom Condition:
Action: User defined
Custom action preparation code: return 1;
Custom action cleanup code:
    my $DepOnBy = $self->TicketObj->DependedOnBy;
    while (my $l = $DepOnBy->Next) {
      if ($l->BaseIsLocal and $l->BaseObj->Status ne 'open') {
        $l->BaseObj->SetStatus('open');
      }
    }
    $DepOnBy = undef;
    return 1;
Template: Global template: Blank
_____________________________________________________________
3) Scrip that on ticket resolving open all tickets which has resolved 
ticket as member only if all their members are resolved.
_____________________________________________________________
Description: open tickets which has link on resolved ticket as member if 
all members resoved
Condition: On Resolve
Custom Condition:
Action: User defined
Custom action preparation code: return 1;
Custom action cleanup code:
    my $MemberOf = $self->TicketObj->MemberOf;
    while (my $l = $MemberOf->Next) {
      if ($l->TargetURI->IsLocal and
               $l->TargetObj->Status ne 'open') {
        my $ms = $l->TargetObj->Members();
        while (my $m = $ms->Next()) {return 1 if $m->Status =~ 
/^(?:new|open|stalled)$/;}
        $l->TargetObj->SetStatus('open');
      }
    }
    return 1;
Template: Global template: Blank
_____________________________________________________________
4) Last, attached perl script that marks Tickets from command line 
defined requestor as deleted.
WARNING: Don't use this script unless you are really know what you are 
doing. I'm not responsible for any damage that could be done by this script.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: delete-by-requestor
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20030906/dbb8fcf2/attachment.ksh>


More information about the rt-users mailing list