<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://rt-wiki.bestpractical.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Iizuki</id>
	<title>Request Tracker Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://rt-wiki.bestpractical.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Iizuki"/>
	<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/wiki/Special:Contributions/Iizuki"/>
	<updated>2026-08-22T12:47:32Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Conditional_Reopen_Reject&amp;diff=27166</id>
		<title>Conditional Reopen Reject</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Conditional_Reopen_Reject&amp;diff=27166"/>
		<updated>2023-06-14T05:55:26Z</updated>

		<summary type="html">&lt;p&gt;Iizuki: An improved version inspired by the original work. The functionality remains the same, but the code is refactored into two scripts. This avoids making dubious changes in the custom condition, and uses standard RT actions instead.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Conditional Reopen Reject lets you decide that, after a set amount of time since resolution, users won&#039;t be able to reopen a ticket.&lt;br /&gt;
&lt;br /&gt;
It works with two scrips and a template, as explained below.&lt;br /&gt;
&lt;br /&gt;
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 &#039;&#039;$Days&#039;&#039; variable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==The default reopen script==&lt;br /&gt;
&lt;br /&gt;
There&#039;s a default script for opening inactive tickets unconditionally. It&#039;s called &#039;&#039;On Correspond Open Inactive Tickets&#039;&#039;. You have to disable it first (or you may choose to repurpose it for one of the scripts below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setting up the scrip for reopening recent tickets==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; On Correspond  ( &amp;lt; week ) Open Inactive Tickets&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition:&#039;&#039;&#039; User defined&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Action:&#039;&#039;&#039; Open Inactive Tickets&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Template:&#039;&#039;&#039; Blank&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Applies to:&#039;&#039;&#039; Global&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Custom condition:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This condition is true only for mails coming in within a week of the ticket being closed.&lt;br /&gt;
# Script &amp;quot;On Correspond  ( &amp;gt; week ) Open Inactive Tickets&amp;quot; is strongly related.&lt;br /&gt;
&lt;br /&gt;
# my $Days = 60; # debugging&lt;br /&gt;
my $Days = 60*60*24*7; # 7 days&lt;br /&gt;
&lt;br /&gt;
my $TransactionObj = $self-&amp;gt;TransactionObj;&lt;br /&gt;
my $TicketObj = $self-&amp;gt;TicketObj;&lt;br /&gt;
my $QueueObj = $TicketObj-&amp;gt;QueueObj;&lt;br /&gt;
 &lt;br /&gt;
return 0 unless $TransactionObj-&amp;gt;Type eq &#039;Correspond&#039;;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
if ( $TransactionObj-&amp;gt;IsInbound &amp;amp;&amp;amp; &lt;br /&gt;
    $QueueObj-&amp;gt;IsInactiveStatus( $TicketObj-&amp;gt;Status ) &amp;amp;&amp;amp;&lt;br /&gt;
    time() - $TicketObj-&amp;gt;ResolvedObj-&amp;gt;Unix &amp;lt; $Days ) {&lt;br /&gt;
 &lt;br /&gt;
  return 1; # reopen the ticket&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
return 0;  # Don&#039;t reopen the ticket. Another script should send the user a mail that the ticket cannot be reopened.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Custom action preparation code:&#039;&#039;&#039; empty&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Custom action commit code:&#039;&#039;&#039; empty&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setting up the scrip for rejecting reopening of old tickets==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; On Correspond ( &amp;gt; week ) Open Inactive Tickets&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition:&#039;&#039;&#039; User defined&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Action:&#039;&#039;&#039; Autoreply To Requestors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Template:&#039;&#039;&#039; Conditional Reopen Reject&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Applies to:&#039;&#039;&#039; Global&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Custom condition:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Inspired by this: https://rt-wiki.bestpractical.com/wiki/Conditional_Reopen_Reject&lt;br /&gt;
# This condition is true only for mails coming in after the ticket has been closed for a week.&lt;br /&gt;
# Script &amp;quot;On Correspond ( &amp;lt; week ) Open Inactive Tickets&amp;quot; is strongly related to this.&lt;br /&gt;
&lt;br /&gt;
# my $Days = 60; # debugging&lt;br /&gt;
my $Days = 60*60*24*7; # 7 days&lt;br /&gt;
&lt;br /&gt;
my $TransactionObj = $self-&amp;gt;TransactionObj;&lt;br /&gt;
my $TicketObj = $self-&amp;gt;TicketObj;&lt;br /&gt;
my $QueueObj = $TicketObj-&amp;gt;QueueObj;&lt;br /&gt;
 &lt;br /&gt;
return 0 unless $TransactionObj-&amp;gt;Type eq &#039;Correspond&#039;;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
if ( $TransactionObj-&amp;gt;IsInbound &amp;amp;&amp;amp; &lt;br /&gt;
    $QueueObj-&amp;gt;IsInactiveStatus( $TicketObj-&amp;gt;Status ) &amp;amp;&amp;amp;&lt;br /&gt;
    time() - $TicketObj-&amp;gt;ResolvedObj-&amp;gt;Unix &amp;gt; $Days ) {&lt;br /&gt;
 &lt;br /&gt;
  return 1;  # Send a mail saying that this ticket cannot be reopened.&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
return 0; # Don&#039;t send the mail, another script may reopen the ticket.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Custom action preparation code:&#039;&#039;&#039; empty&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Custom action commit code:&#039;&#039;&#039; empty&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setting up the template==&lt;br /&gt;
&lt;br /&gt;
This is how the template should be configured:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name:&#039;&#039;&#039; Conditional Reopen Reject&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; Reject reopen if ticket has been closed for more than X days&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Type:&#039;&#039;&#039; Perl&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Content:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Subject: WARNING - TICKET REJECTED: {$Ticket-&amp;gt;Subject}&lt;br /&gt;
&lt;br /&gt;
Ticket #{$Ticket-&amp;gt;id()} has been closed for more than 7 days: it is not possible to reopen it.&lt;br /&gt;
&lt;br /&gt;
Please submit a new ticket instead.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thank you,&lt;br /&gt;
{$Ticket-&amp;gt;QueueObj-&amp;gt;CorrespondAddress()}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Iizuki</name></author>
	</entry>
</feed>