Difference between revisions of "OpenTicketOnAllMemberResolve"

From Request Tracker Wiki
Jump to navigation Jump to search
m (2 revisions imported)
m
 
Line 1: Line 1:
 
Another [[ScripAction]] from [[RuslanZakirov]]:
 
Another [[ScripAction]] from [[RuslanZakirov]]:
  
<nowiki>Description: open tickets which has link on resolved ticket as member if all members resoved
+
Description: open tickets which has link on resolved ticket as member if all members resoved
 
   
 
   
Condition: On Status Change
+
Condition: On Status Change
Custom Condition:
+
 
 +
Custom Condition:
 
   
 
   
Template: Global template: Blank
+
Template: Global template: Blank
 
   
 
   
Action: User defined
+
Action: User defined
Custom action preparation code: return 1;
+
 
Custom action cleanup code:
+
Custom action preparation code: return 1;
 +
 
 +
Custom action cleanup code:
 +
 
 +
<pre>
 
   return 1 if ($self-&gt;TransactionObj-&gt;NewValue !~ /^(?:resolved|deleted|rejected)$/);
 
   return 1 if ($self-&gt;TransactionObj-&gt;NewValue !~ /^(?:resolved|deleted|rejected)$/);
 
   # current ticket is memeber of(child of some parents)
 
   # current ticket is memeber of(child of some parents)
Line 48: Line 53:
 
   }
 
   }
 
   return 1;
 
   return 1;
</nowiki>
+
</pre>
  
 
705617733494428679213672_test_num_
 
705617733494428679213672_test_num_

Latest revision as of 21:19, 13 August 2016

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)$/ );
 
    # the parent ticket has members(current ticket is one of them)
    my $ms = $l->TargetObj->Members();
 
    my $flag = 0;
    while( my $m = $ms->Next ) {
      next unless( $m->BaseURI->IsLocal );
      next unless( $m->BaseObj->Status =~ /^(?:new|open|stalled)$/ );
      $flag = 1;
      last;
    }
    # shouldn't open parent if some children is active
    next if( $flag );
 
 # 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_