[rt-users] auto-close tickets after X amount of time
Ramon Kagan
rkagan at yorku.ca
Mon Feb 14 12:03:04 EST 2005
Sorry typo..
SetStatus.pm should be in .../lib/Action
Ramon Kagan
York University, Computing and Network Services
Information Security - Senior Information Security Analyst
(416)736-2100 #20263
rkagan at yorku.ca
----------------------------------- ------------------------------------
I have not failed. I have just I don't know the secret to success,
found 10,000 ways that don't work. but the secret to failure is
trying to please everybody.
- Thomas Edison - Bill Cosby
----------------------------------- ------------------------------------
On Mon, 14 Feb 2005, Ramon Kagan wrote:
> I have...
>
> In .../lib/Condition
>
> #cat Idle.pm
> # Author: Ramon Kagan
> #
> # Birth September 30, 2004 - 08:30 ESTEDT
> #
> # This module checks the "idleness" of a ticket"
> #
>
> =head1 NAME
>
> RT::Condition::Idle
>
> =head1 DESCRIPTION
>
> Returns true if the ticket we're operating on has been idle
> for the number of days specified
>
> =cut
>
> package RT::Condition::Idle;
> require RT::Condition::Generic;
>
> use strict;
> use Time::ParseDate;
> use vars qw/@ISA/;
> @ISA = qw(RT::Condition::Generic);
>
>
> =head2 IsApplicable
>
> If the last modified date plus the number of days specified is before
> "now" return true
>
> =cut
>
> sub IsApplicable {
> my $self = shift;
> my $seconds = $self->Argument * 86400;
> $RT::Logger->debug("Idle: Seconds is " . $seconds);
> my $now = parsedate("now");
> $RT::Logger->debug("Idle: Now is " . $now);
> my $lastdate = $self->TicketObj->LastUpdated;
> my $last = parsedate("$lastdate");
> $RT::Logger->debug("Idle: Last is " . $last);
> if ($now - $last > $seconds) {
> return(1);
> }
> else {
> return(undef);
> }
> }
>
> eval "require RT::Condition::Idle_Vendor";
> die $@ if ($@ && $@ !~ qr{^Can't locate RT/Condition/Idle_Vendor.pm});
> eval "require RT::Condition::Idle_Local";
> die $@ if ($@ && $@ !~ qr{^Can't locate RT/Condition/Idle_Local.pm});
>
> 1;
>
>
> in .../lib/SetStatus.pm
>
> # Author: Ramon Kagan
> #
> # Birth September 8, 2004 - 08:30 ESTEDT
> #
> # This module incorporates much of the SetPriority.pm from
> # Best Practical. It changes the status of the ticket as requested
> #
>
> package RT::Action::SetStatus;
> require RT::Action::Generic;
>
> use strict;
> use vars qw/@ISA/;
> @ISA=qw(RT::Action::Generic);
>
> #Do what we need to do and send it out.
>
> #What does this type of Action does
>
> # {{{ sub Describe
> sub Describe {
> my $self = shift;
> return (ref $self . " will set a ticket's status to the argument
> provided.");
> }
> # }}}
>
>
> # {{{ sub Prepare
> sub Prepare {
> # nothing to prepare
> return 1;
> }
> # }}}
>
> sub Commit {
> my $self = shift;
> $self->TicketObj->SetStatus($self->Argument);
>
> }
>
> eval "require RT::Action::SetStatus_Vendor";
> die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/SetStatus_Vendor.pm});
> eval "require RT::Action::SetStatus_Local";
> die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/SetStatus_Local.pm});
>
> 1;
>
>
> Using crontool
>
> rt-crontool --search RT::Search::ActiveTicketsInQueue --search-arg <Queue>
> --condition RT::Condition::Idle --condition-arg <number of days idle>
> --action RT::Action::SetStatus --action-arg <status>
>
> If you want to make this hours... change the 86400 in Idle.pm to 3600
>
> Hope that helps.
>
> Ramon Kagan
> York University, Computing and Network Services
> Information Security - Senior Information Security Analyst
> (416)736-2100 #20263
> rkagan at yorku.ca
>
> ----------------------------------- ------------------------------------
> I have not failed. I have just I don't know the secret to success,
> found 10,000 ways that don't work. but the secret to failure is
> trying to please everybody.
> - Thomas Edison - Bill Cosby
> ----------------------------------- ------------------------------------
>
> On Mon, 14 Feb 2005, Jonathan Reeder wrote:
>
> > I have a ton of tickets that get sent in, picked up by a staff member,
> > replied to with a suggestion, and then the requestor never takes the time to
> > write back and say "Thanks that worked" or "Its fixed" or anything like that
> > to let us know that the ticket can be closed. So what I'd like to do is set
> > something up so that if a ticket goes 48 hours without a reply from the
> > requestor (if the owner is not nobody and a reply has been made to the
> > requestor) then the ticket gets automatically closed. What would also be
> > nice would be if I could set it up such that an email was sent after 12
> > hours of no activity saying "If you don't reply to this ticket in 36 hours,
> > it will automatically be closed."
> >
> > Anyone done anything like this?
> >
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> RT Administrator and Developer training is coming to your town soon! (Boston, San Francisco, Austin, Sydney) Contact training at bestpractical.com for details.
>
> Be sure to check out the RT Wiki at http://wiki.bestpractical.com
>
>
More information about the rt-users
mailing list