[rt-users] Ticket Status Change on Final Chained Approval

Foggi, Nicola NFOGGI at depaul.edu
Wed Mar 24 00:35:15 EDT 2010


Hey Everyone,

So we have implemented approvals under RT 3.8.6 basically to track and approval purchase requests.  The request has to go through 2 levels of approvals, at which point i have it setup to email our purchasing department the information to complete the purchase.  In researching how to do this, I came up with a scrip custom condition of:

my $newstatus = $self->TicketObj->Status;
my $oldstatus = $self->TransactionObj->OldValue;
my $dependencies = $self->TicketObj->HasUnresolvedDependencies;

$RT::Logger->crit(qq(New Status $newstatus Old Status $oldstatus Dependencies $dependencies));

if (($newstatus eq 'open') && ($dependencies eq '')) {

  return 1;

}

which seemed to do the trick until today, when a ticket accidentally got re-opened after it had been rejected.  So I modified the check to be:

if (($newstatus eq 'open') && ($dependencies eq '') && ($oldstatus ne 'rejected') && ($oldstatus ne 'resolved')) {

which seems to work, but is there an event to actually check the status when it leaves a "Pending Approval" state to "Open".  It appears to go to an "Open" state after the first approver approvals it, though the GUI still shows it pending approval, since it has the second approval that has to pass, and only when that one passes does it move to a visable state of "Open", but in the backend, rt will log this on the initial approval:

RT: New Status open Old Status  Dependencies 1 ((eval 1909):5) 

so there is no "Old Status" as seen by my log message.  Should I maybe modify it to only run this scrip when oldstatus = '', newstatus = 'open' and depenedencies = ''? would that be the best check? or is there a way to actually check the approval state?

Thanks!

Nicola
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20100323/c2dc68cf/attachment.htm>


More information about the rt-users mailing list