Conditional Reopen Reject: Difference between revisions
(New article) |
(Added author reference) |
||
Line 1: | Line 1: | ||
Contributed by [http://wiki.bestpractical.com/view/Cris Cris] | |||
==Introduction== | ==Introduction== | ||
Conditional Reopen Reject lets you decide that, after a set amount of time since resolution, users won't be able to reopen a ticket. | Conditional Reopen Reject lets you decide that, after a set amount of time since resolution, users won't be able to reopen a ticket. | ||
Line 113: | Line 114: | ||
I hope you enjoy it! | I hope you enjoy it! | ||
Revision as of 10:05, 2 May 2014
Contributed by Cris
Introduction
Conditional Reopen Reject lets you decide that, after a set amount of time since resolution, users won't be able to reopen a ticket.
It works with a scrip and a template, as explained below.
Setting up the scrip
We have had this customization installed for so long that I do not remember the default configuration of RT. I believe a script called "On Correspond Open Tickets" already exists in a default installation.
You have to change it (or create it if it doesn't exist) the following way.
Keep in mind that this is configured so that tickets become non-reopenable after a week since resolution. If you want a different timeframe, just change the $Days variable.
Description: On Correspond Open Tickets
Condition: User defined
Action: Autoreply to requestors
Template: Conditional Reopen Reject
Applies to: Global
Custom condition:
my $Days = 60*60*24*7; # 7 days my $TransactionObj = $self->TransactionObj; my $TicketObj = $self->TicketObj; my $QueueObj = $TicketObj->QueueObj; my $QueueName = $QueueObj->Name; return 0 unless $TransactionObj->Type eq 'Correspond'; # begin debug section ############# my $dr = $TicketObj->ResolvedObj->Unix; my $tt = time() - $TicketObj->ResolvedObj->Unix; $RT::Logger->info( "> -- Scrip 1 --\n" ); $RT::Logger->info( "> DataRisoluzione: $dr \n" ); $RT::Logger->info( "> TempoTrascorso: $tt \n" ); # InBound should be true only if the email comes from the original requestor if ( $TransactionObj->IsInbound ) {$RT::Logger->info("> Inbound\n");} if ( $QueueObj->IsInactiveStatus( $TicketObj->Status ) ) {$RT::Logger->info("> Inactive\n");} # end debug section ############# if ( $TransactionObj->IsInbound && $QueueObj->IsInactiveStatus( $TicketObj->Status ) && time() - $TicketObj->ResolvedObj->Unix > $Days ) { return 1; # send mail template } else { $TicketObj->SetStatus( 'open' ); return 0; # don't send mail template }
Custom action preparation code: empty
Custom action commit code: empty
Setting up the template
This is how the template should be configured:
Name: Conditional Reopen Reject
Description: Reject reopen if ticket has been closed for more than X days
Type: Perl
Content:
Subject: WARNING - TICKET REJECTED: {$Ticket->Subject} Ticket #{$Ticket->id()} has been closed for more than 7 days: it is not possible to reopen it. Please submit a new ticket instead. Thank you RT for {$Ticket->QueueObj->SubjectTag || $rtname}
OK, that's all.
I hope you enjoy it!