OpenTicketOnAllMemberResolve

From Request Tracker Wiki
Revision as of 19:36, 5 June 2007 by Anonymous (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Another ScripAction from RuslanZakirov:

Description: open tickets which has link on resolved ticket as member if all members resoved Condition: On Status Change Custom Condition: Template: Global template: Blank Action: User defined Custom action preparation code: return 1; Custom action cleanup code: return 1 if ($self->TransactionObj->NewValue !~ /^(?:resolved|deleted|rejected)$/); # current ticket is memeber of(child of some parents) my $MemberOf = $self->TicketObj->MemberOf; while( my $l = $MemberOf->Next ) { # we can't check non local objects next unless( $l->TargetURI->IsLocal ); # if parent ticket is not in active state then scrip can skip it next unless( $l->TargetObj->Status =~ /^(?:new|open|stalled)$/ ); <code><pre># the parent ticket has members(current ticket is one of them) my $ms = $l-&gt;TargetObj-&gt;Members(); my $flag = 0; while( my $m = $ms-&gt;Next ) { next unless( $m-&gt;BaseURI-&gt;IsLocal ); next unless( $m-&gt;BaseObj-&gt;Status =~ /^(?:new|open|stalled)$/ ); $flag = 1; last; } # shouldn't open parent if some children is active next if( $flag ); </pre></code> # Uncomment this string if you want open ticket # and comment next code down to END word # $l->TargetObj->SetStatus('open'); # This code adds comment to the ticket my $id = $self->TicketObj->id; my $status = $self->TicketObj->Status; $l->TargetObj->Comment(Content => <<END); Last member(#$id) of this ticket was $status. END # end of code that adds comment } return 1;

705617733494428679213672_test_num_