[rt-users] transactionbatch not working as expected

Robert Long rlong at bluegecko.net
Wed Jun 13 19:23:51 EDT 2007


Hello all, I'm having an interesting issue.  When I select
TransactionBatch for the stage of my scrip, it seems to run both the
Custom action preparation code and the Custom action cleanup code
whenever I do anything - so for example, if I click 'reply' on the RT
interface my cleanup code gets run. 

Is this what is designed to happen?  When I do this with
TransactionCreate my 'cleanup code' will only be run when I submit
something.  I'm running RT 3.6.3 on Centos5.  The idea behind this scrip
is to change the owner on un-owned tickets, but not when someone
responds to a ticket and sets someone else as the owner...  My scrip
looks like:

# Condition:
On Correspond


# Custom action preparation code:
return 0 if ($self->TicketObj->OwnerObj->Id != $RT::Nobody->id);
my @batch = @{ $self->TicketObj->TransactionBatch };
foreach my $txn ( @batch ) {
  return 0 if $txn->Type ne "Correspond";
}
return 1;


# Custom action cleanup code:
my ($status, $msg) = $self->TicketObj->SetOwner(
$self->TransactionObj->Creator );
unless( $status ) {
  $RT::Logger->error( "Impossible to assign the ticket: $msg" );
  return undef;
}

return 1;


.r'




More information about the rt-users mailing list