Approvals code

Below is the code I have in a scrip for RT approvals when the approval is
resolved by the approver. For some reason the reply appears 2 times though
and I don’t see how that can be in this code. So if I write a note saying
that “this person is allowed…” It comes up as “this person is allowed”
“this person is allowed” Any hints would be helpful. Thanks.

-------------------------------------------------------------------

return(0) unless ($self->TicketObj->Type eq ‘approval’);

my $note;
my $t = $self->TicketObj->Transactions;
while (my $o = $t->Next) {
$note .= $o->Content . “\n” if $o->ContentObj
and $o->Content !~ /Default Approval/;
}

foreach my $obj ($self->TicketObj->AllDependedOnBy( Type => ‘ticket’ )) {
$obj->Comment(
Content => $self->loc( “Your request has been approved by [_1]. Other
approvals may still be pending.”, # loc
$self->TransactionObj->CreatorObj->Name,
) . “\n” . $self->loc( “Approver’s notes: [_1]”, # loc
$note
),
);
$T::Approval = $self->TicketObj; # so we can access it inside templates
$self->{TicketObj} = $obj; # we want the original id in the token line
}

Now magically turn myself into a Requestor Notify object…

require RT::Action::Notify; bless($self, ‘RT::Action::Notify’);
$self->{Argument} = ‘Requestor’; $self->Prepare;

return 1;

-------------------------------------------------------------------

Thanks again.

Mike