OpenDependantsOnResolve: Difference between revisions

From Request Tracker Wiki
Jump to navigation Jump to search
m (2 revisions imported)
 
(No difference)

Latest revision as of 15:15, 6 April 2016

Lifted from the Mailing list. Writen by RuslanZakirov.

Description: open tickets which depends on resolved
Condition: On Status Change
Custom Condition:
Action: User defined
Custom action preparation code: return 1;
Custom action cleanup code:
  return 1 if ($self->TransactionObj->NewValue !~ /^(?:resolved|deleted|rejected)$/);
  my $DepOnBy = $self->TicketObj->DependedOnBy;
  while( my $l = $DepOnBy->Next ) {
    next unless( $l->BaseURI->IsLocal );
    next unless( $l->BaseObj->Status =~ /^(?:new|open|stalled)$/ );

    # here you can add any action
    # see also example below
    $l->BaseObj->SetStatus('open');
  }
  $DepOnBy = undef;
  return 1;
Template: Global template: Blank

Another variant that add comment instead.

return 1 if ($self->TransactionObj->NewValue !~ /^(?:resolved|deleted|rejected)$/);
my $DepOnBy = $self->TicketObj->DependedOnBy;
while( my $l = $DepOnBy->Next ) {
  next unless( $l->BaseURI->IsLocal );
  next unless( $l->BaseObj->Status =~ /^(?:new|open|stalled)$/ );

  my $id = $self->TicketObj->id;
  my $status = $self->TicketObj->Status;
  $l->BaseObj->Comment(Content => <<END);

This ticket depends on ticket \#$id which was $status.
END

}
$DepOnBy = undef;
return 1;

See also OpenTicketOnAllMemberResolve