[rt-users] Rejected Approval tickets not updating child ticket

Nick Bown Nick.Bown at fundshub.com
Tue Apr 20 04:39:43 EDT 2004


Hello,

We have been using approvals for a while now but only recently have the
approval staff started rejecting tickets due to audit changes. The
problem is that when an approval ticket is rejected the parent ticket is
not updated. Approvals work fine and the parent tickets are updated but
not rejected tickets.

The current scrip we have is:

Description: If an approval is rejected, reject the original and delete
pending approvals
------------------------------------
Condition: User Defined
------------------------------------
Custom condition:
------------------------------------
Action: User Defined
------------------------------------
Custom action preparation code:
# ------------------------------------------------------------------- #
return(0) unless ( lc($self->TransactionObj->NewValue) eq "rejected" or
	           lc($self->TransactionObj->NewValue) eq "deleted" );

my $rejected = 0;
my $links = $self->TicketObj->DependedOnBy;
foreach my $link (@{ $links->ItemsArrayRef }) {
    my $obj = $link->BaseObj;
    if ($obj->QueueObj->IsActiveStatus($obj->Status)) {
	if ($obj->Type eq 'ticket') {
	    $obj->Comment(
		Content	=> $self->loc("Your request was rejected."),
	    );
	    $obj->SetStatus(
		Status	=> 'rejected',
		Force	=> 1,
	    );

	    $T::Approval = $self->TicketObj; # so we can access it
inside templates
	    $self->{TicketObj} = $obj;  # we want the original id in the
token line
	    $rejected = 1;
	}
	else {
	    $obj->SetStatus(
		Status	=> 'deleted',
		Force	=> 1,
	    );
	}
    }
}

$links = $self->TicketObj->DependsOn;
foreach my $link (@{ $links->ItemsArrayRef }) {
    my $obj = $link->TargetObj;
    if ($obj->QueueObj->IsActiveStatus($obj->Status)) {
	$obj->SetStatus(
	    Status	=> 'deleted',
	    Force	=> 1,
	);
    }
}

# Now magically turn myself into a Requestor Notify object...
require RT::Action::Notify; bless($self, 'RT::Action::Notify');
$self->{Argument} = 'Requestor'; $self->Prepare;

return $rejected;
# ------------------------------------------------------------------- #
-------------------------------------
Custom action cleanup code: "never needed"
-------------------------------------
Stage: TransactionCreate
-------------------------------------
Template: Approval Created
-------------------------------------

I'm anything but an RT scripting expert but the lack of Custom Condition
seems a little odd especially when the Condition is set to user defined.
Does anyone have any idea what's wrong?

We are running RT 3.0.10 but this has been upgraded from an early
release so that may be where the problem has come in.

Thanks,

Nick



___________________________________________________________________________

This message is intended solely for the use of the individual or organisation to whom it is addressed and may contain confidential or copyrighted information. If you have received this message in error, please reply to the originator and delete it immediately. If you are not the intended recipient, you should not use, copy, alter, disseminate, print or disclose the contents of this message.

Information or opinions expressed in this message and/or any attachments are those of the author and are not necessarily those of EFSS Ltd. or its affiliates. EFSS Ltd. accepts no responsibility for loss or damage arising from its use, including damage from viruses.

Note: Internet e-mails are not necessarily secure. EFSS Ltd. does not accept responsibility for changes made to this message after it was sent.
___________________________________________________________________________





More information about the rt-users mailing list