> I'd like to set up a mechanism that ensures that when the due date on
> a ticket is updated, the due date on any tickets that depend on it
> will also changes.

Well, it took a little research, but this seems to work (inspired by
http://wiki.bestpractical.com/view/OpenDependantsOnResolve):

Custom condition:
if ( ( $self->TransactionObj->Field || '' ) eq 'Due' &&
$self->TicketObj->DueObj->Unix > 0) {
  return(1);
}

return undef;

Custom action preparation code:
1;

Custom action cleanup code:
use RT::Date;

my $parents = $self->TicketObj->DependedOnBy;
my $id = $self->TicketObj->id;

my $dueDate = $self->TicketObj->DueObj;

while( my $l = $parents->Next ) {
  next unless( $l->BaseURI->IsLocal );
  next unless( $l->BaseObj->Status =~ /^(?:new|open|stalled)$/ );

  # Only update the parent due date if it's already set.
  next unless defined $l->BaseObj->DueObj->Unix > 0;

  my $parentDueDate = $l->BaseObj->DueObj;
  next unless $parentDueDate->Diff($dueDate) < 0;

  $l->BaseObj->Comment(Content => <<END);

This ticket depends on ticket \#$id which has a new due
date of ${\$dueDate->AsString}.  The due date on this
ticket has been updated accordingly.
END

  $l->BaseObj->SetDue($dueDate->ISO);

}

1;



-- 
Lars Kellogg-Stedman <[EMAIL PROTECTED]>
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

Reply via email to