"On Due Date Changed" action?

Hello all,

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. I think I can make a custom scrip that uses the
"On Transaction" condition, and then propogates the date change up the
ladder. This seems like an awful big hammer, since it would run for
every transaction. Is there a way to detect whether or not the due
date is being updated as part of the transaction?

Thanks,

Lars Kellogg-Stedman lars@oddbit.com

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 lars@oddbit.com