Ramon,
I’ve successfully implemented the resolve after 48 hours of inactivity part
of what I want to do. Now in order to get the notification to the user that
“This ticket will be close if not updated in 24 hours”, I’m basically going
to copy the same rt-crontool command, except the action will be
RecordCorrespondence instead of SetStatus. If I’m correct in my thinking
though, I’m worried that the actual act of sending them the correspondence
will set a new LastUpdated, and as such I’ll never actually reach the 48
hours of idle and close the ticket. Here’s what I was planning on
eventually having in my crontab:
10 * * * * rt-crontool --search
RT::Search::ActiveTicketsInQueue --search-arg --condition
RT::Condition::Idle --condition-arg 48 --action
RT::Action::SetStatus --action-arg resolved
5 * * * * rt-crontool --search RT::Search::ActiveTicketsInQueue --search-arg
--condition RT::Condition::Idle --condition-arg 24 --action
RT::Action::RecordCorrespondence --template ‘Expiring Tickets’
Would this just send the ‘Expiring Tickets’ template every 24 hours over and
over again, without ever reaching the 48 hours set in the SetStatus rule?
I’m wondering if I should modify Idle.pm a bit so looks only at the last
update by the requestor, not just any update?
Thanks again for the modules, I’ve already got the first part up and
running.
JonathanFrom: Ramon Kagan [mailto:rkagan@yorku.ca]
Sent: Monday, February 14, 2005 11:03 AM
To: Jonathan Reeder
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] auto-close tickets after X amount of time
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@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
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
–condition RT::Condition::Idle --condition-arg
–action RT::Action::SetStatus --action-arg
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@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
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?
The rt-users Archives
RT Administrator and Developer training is coming to your town soon!
(Boston, San Francisco, Austin, Sydney) Contact training@bestpractical.com
for details.
Be sure to check out the RT Wiki at http://wiki.bestpractical.com