[rt-users] RT_System opening tickets?

Bruce Campbell bruce_campbell at ripe.net
Fri Jan 11 13:24:20 EST 2002


On Fri, 11 Jan 2002, Jesse Vincent wrote:

> RT automatically opens tickets when you start doing things
> like adding new updates to them. (And yes, in the distant future, this
> should all be done with Scrips, rather than hard-coded)

OnCorrespond ReOpenTicket with template Blank ?

Hrm, would the following work (as RT::Action::ReOpenTicket) ?

( brief sideline in trying to stop from going mad on other matters )

-- 
                             Bruce Campbell                            RIPE
                                                                        NCC
                                                                 Operations

	# Copyright guff - 2002  Bruce Campbell (bruce_campbell at ripe.net)
	package RT::Action::ReOpenTicket;
	require RT::Action::Generic;

	@ISA = qw(RT::Action::Generic);

	=head1 NAME

	RT::Action::ReOpenTicket - An Action to re-open a ticket if two
	conditions are met - correspondence has come in, and the ticket
	is marked as resolved.

	=head1 SYNOPSIS

	require RT::Action::ReOpenTicket;
	@ISA = qw(RT::Action::ReOpenTicket);

	=head1 DESCRIPTION

	This only affects tickets which are resolved.  Tickets with any
	other status stay that way.

	Does not send email when this happens.  In Scrip terms, this is:

		OnCorrespond ReOpenTicket with template Blank

	=begin testing

	ok (require RT::TestHarness);
	ok (require RT::Action::Generic);

	=end testing

	=head1 AUTHOR

	Bruce Campbell <bruce_campbell at ripe.net>

	=head1 SEE ALSO

	perl(1), RT

	=cut

	# Prepare ourselves.  Check if this ticket is resolved.
	sub Prepare {
		my $self = shift;

		my $retval = 0;
		if( $self->TicketObj ){
			if( $self->TicketObj->Status =~ /resolve/i ){
				$retval = 1;
			}
		}else{
			$RT::Logger->warning("No ticket object handed to $self\n");
		}
		return( $retval );
	}

	# Open the ticket.
	sub Commit {

		my $self = shift;
		my $retval = 0;
		if( $self->TicketObj ){
			# Let this module be reused if we want to do something
			# else with it.
			my $action = $self->Argument || "open";

			# SetStatus takes care of current user etc.
			$retval = $self->TicketObj->SetStatus( $action );
		}else{
			$RT::Logger->warning("No ticket object handed to $self\n");
		}
		return( $retval );
	}






More information about the rt-users mailing list