NonTransitioningStatus

From Request Tracker Wiki
Jump to navigation Jump to search

(Also, check out AnyTransactionSource which allows you to differentiate internal and external correspondence in scrips)

---

When creating a custom status I needed the ability to prevent the status from automatically transitioning to open on any correspondence.

My specific scenerio was that I created a status that represents "Awaiting Customer Response" (acr). At predefined periods I send out reminder emails that we are still waiting for a response. Each time I sent out the email the ticket would get set back to the "open" status and reminders would no longer go out. I need the status of the ticket to remain "acr".

rt3/etc/RT_Config.pm

...
@ActiveStatus = qw(new open stalled customstat) unless @ActiveStatus;
@InactiveStatus = qw(resolved rejected deleted) unless @InactiveStatus;
@NonTransitioningStatus = qw(new open customstat) unless @NonTransitioningStatus;
...

rt3/lib/RT/Action/AutoOpen.pm

Change this

...
 # {{{ sub Prepare
 sub Prepare {
   my $self = shift;
 
   # if the ticket is already open or the ticket is new and the message is more mail from the
   # requestor, don't reopen it.
 
   if ( $self->TicketObj->Status eq 'open' )
        || ( ( $self->TicketObj->Status eq 'new' )
             && $self->TransactionObj->IsInbound )
     ) {
 
       return undef;
   }
   else {
       return (1);
   }
 }
 # }}}
 ...
 
 

To this

...
 # {{{ sub Prepare
 sub Prepare {
   my $self = shift;
 
   # if the ticket is already open or the ticket is new and the message is more mail from the
   # requestor, don't reopen it.
   # if it is a NonTransitioningStatus don't reopen.
 
   my %nonTransitioningStatus = ();
 
   if( @RT::NonTransitioningStatus ){
           for(@RT::NonTransitioningStatus) { %nonTransitioningStatus = ($_ => 1); }
   }
 
   if ( ( ( $self->TicketObj->Status eq 'new' )
             && $self->TransactionObj->IsInbound )
        || (%nonTransitioningStatus)[$self->TicketObj->Status]
     ) {
 
       return undef;
   }
   else {
       return (1);
   }
 }
 # }}}
 ...