Getting owner to change when replying

I’ve noticed that when a user replies to a new ticket, they do not
become the owner – it remains owned by nobody. Is there a way to change
this so that if someone takes an action on a ticket that’s owned by
nobody, they own it?

Thanks!

Jen

Jen:

I’ve done what you want by modifying the default “AutoOpen” action that
comes with 3.0.2…

Here’s the diff (the file is $RTBASE/lib/RT/Action/AutoOpen.pm)

%cvs diff -C 3 -r rt3-0-2 AutoOpen.pm
Index: AutoOpen.pm
RCS file: /var/db/cvs/rt3/lib/RT/Action/AutoOpen.pm,v
retrieving revision 1.1.1.2
retrieving revision 1.1.1.2.2.2
diff -C3 -r1.1.1.2 -r1.1.1.2.2.2
*** AutoOpen.pm 13 May 2003 21:05:40 -0000 1.1.1.2
— AutoOpen.pm 15 May 2003 20:41:06 -0000 1.1.1.2.2.2
*** 74,79 ****
— 74,89 ----
Data => ‘Ticket auto-opened on incoming
correspondence’
);

  •   # Set started if it isn't already
    
  •   if ($self->TicketObj->Started eq "") {
    
  •           $self->TicketObj->SetStarted;
    
  •   }
    
  •   # Set owner if it isn't already
    
  •   if ($self->TicketObj->IsOwner($RT::Nobody)) {
    

$self->TicketObj->SetOwner($self->TransactionObj->CreatorObj->id);

  •   }
    
     return(1);
    
    }On Wednesday, Jun 4, 2003, at 17:07 US/Pacific, jennyw wrote:

I’ve noticed that when a user replies to a new ticket, they do not
become the owner – it remains owned by nobody. Is there a way to
change
this so that if someone takes an action on a ticket that’s owned by
nobody, they own it?

Thanks!

Jen


rt-users mailing list
rt-users@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-users

Have you read the FAQ? The RT FAQ Manager lives at http://fsck.com/rtfm

I’ve done what you want by modifying the default “AutoOpen” action that
comes with 3.0.2…

Thanks! Any reason why it doesn’t work with a scrip, though?

Jen

No… I just found it more convenient to re-write AutoOpen (which is
the “OpenTickets” scrip action) rather than write my own custom scrip
at the time.On Thursday, Jun 5, 2003, at 15:47 US/Pacific, jennyw wrote:

On Thu, Jun 05, 2003 at 01:06:14AM -0700, Chad Scott wrote:

I’ve done what you want by modifying the default “AutoOpen” action
that
comes with 3.0.2…

Thanks! Any reason why it doesn’t work with a scrip, though?

Jen


rt-users mailing list
rt-users@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-users

Have you read the FAQ? The RT FAQ Manager lives at http://fsck.com/rtfm

This one time, at band camp, jennyw wrote:

I’ve noticed that when a user replies to a new ticket, they do not
become the owner – it remains owned by nobody. Is there a way to change
this so that if someone takes an action on a ticket that’s owned by
nobody, they own it?

I’ve got a patch that adds an AutoTake.pm action, then all you need to do is
do a couple of database inserts to enable the new script as a separate
action/scrip.

Apply the attachment, then perform the following queries on your database:

insert into scripactions (name, description, execmodule, creator, created,
lastupdatedby, lastupdated) values (‘Assign Tickets’, ‘Assign a ticket on
first correspondance’, ‘AutoTake’, 1, current_timestamp, 1, current_timestamp);

insert into scrips (description, scripcondition, scripaction, stage, queue,
template, creator, created, lastupdatedby, lastupdated) values (‘AutoTake’,
3, ID of the above scripaction, ‘TransactionCreate’, 0, 1, 1,
current_timestamp, 1, current_timestamp);

Remember to get the ID of the scripaction from the first query for the
scripaction column in the second query.

jaq@spacepants.org http://spacepants.org/jaq.gpg

rt-3.0-autotake.patch (2.53 KB)

I have installed rt-3.0.2 on redhat linux 7.2
everything working fine.

But so many directories are creating under /tmp directory with web user
ownership.

shall I remove all these directories from cron job?

Thank in advance.
Mohan.

Jamie Wilkinson wrote:

Apply the attachment, then perform the following queries on your database:

It should be noted that throwing random SQL at your RT database
is, um, Not Advisable. Please don’t try this at home.

RT provides tools and hooks for doing this in a safe(r), portable
way. In this instance, a datafile containing something like:

@ScripActions = (
{ Name => ‘Auto Take’,
Description => ‘Take ticket on correspondence’,
ExecModule => ‘AutoTake’ },
);

when fed to “rt-setup-database --insert --datafile”, is the
correct approach.

Phil Homewood, Systems Janitor, http://www.SnapGear.com
pdh@snapgear.com Ph: +61 7 3435 2810 Fx: +61 7 3891 3630
SnapGear - Custom Embedded Solutions and Security Appliances

This one time, at band camp, Phil Homewood wrote:

Jamie Wilkinson wrote:

Apply the attachment, then perform the following queries on your database:

It should be noted that throwing random SQL at your RT database
is, um, Not Advisable. Please don’t try this at home.

RT provides tools and hooks for doing this in a safe(r), portable
way. In this instance, a datafile containing something like:

@ScripActions = (
{ Name => ‘Auto Take’,
Description => ‘Take ticket on correspondence’,
ExecModule => ‘AutoTake’ },
);

when fed to “rt-setup-database --insert --datafile”, is the
correct approach.

The patch submitted to rt-3.0-bugs included this for the scripaction, although
not the scrip.

jaq@spacepants.org http://spacepants.org/jaq.gpg

Does this work if the user is nobody? Im trying to find a method to
assign tickets to someone if they reply or comment in a ticket. Ive
applied everything and even restarted Apache and it seems not to work be
working.On Thu, 2003-06-12 at 22:16, Jamie Wilkinson wrote:

This one time, at band camp, jennyw wrote:

I’ve noticed that when a user replies to a new ticket, they do not
become the owner – it remains owned by nobody. Is there a way to change
this so that if someone takes an action on a ticket that’s owned by
nobody, they own it?

I’ve got a patch that adds an AutoTake.pm action, then all you need to do is
do a couple of database inserts to enable the new script as a separate
action/scrip.

Apply the attachment, then perform the following queries on your database:

insert into scripactions (name, description, execmodule, creator, created,
lastupdatedby, lastupdated) values (‘Assign Tickets’, ‘Assign a ticket on
first correspondance’, ‘AutoTake’, 1, current_timestamp, 1, current_timestamp);

insert into scrips (description, scripcondition, scripaction, stage, queue,
template, creator, created, lastupdatedby, lastupdated) values (‘AutoTake’,
3, ID of the above scripaction, ‘TransactionCreate’, 0, 1, 1,
current_timestamp, 1, current_timestamp);

Remember to get the ID of the scripaction from the first query for the
scripaction column in the second query.
Richie Crews
Unix Administrator / Internet Integrator
Red Hat Certified Engineer
Email: rcrews@intercall.com
Cell: (706) 773 - 3436
Desk: (706) 634 - 3681
Fax: (706) 634 - 3831

Unix is very user friendly, its just picky on who it likes…

“Providing security for your email needs”
Stop Spam, Support RBL http://www.mail-abuse.org

This one time, at band camp, Jamie Wilkinson wrote:

I’ve got a patch that adds an AutoTake.pm action, then all you need to do is
do a couple of database inserts to enable the new script as a separate
action/scrip.

The patch I sent was broken, a correct AutoTake.pm is attached, drop it over
the top of the broken version. As per Phil’s email, use the importer script
to add the action to your RT installation.

jaq@spacepants.org http://spacepants.org/jaq.gpg

AutoTake.pm (1.82 KB)

Hi all,

I’ve tried Jamie’s AutoTake.pm, but I can’t seem to make it work.
This is the scenario:

  • RT 3.0.3
  • Someone sends e-mail and creates a ticket (ticket is owned by Nobody)
  • I (a privileged user, who can own tickets in this queue) reply to the
    ticket (via e-mail or web).
  • The ticket changes from new to open, but the owner never changes.

I added these using sbin/rt-setup-database --action insert --datafile
(once for each file):

@ScripActions = (
{ Name => ‘Assign Tickets’,
Description => ‘Assign a ticket on first correspondence’,
ExecModule => ‘AutoTake’ },
);

@Scrips = (
{ Description => ‘AutoTake’,
ScripCondition => 3,
ScripAction => 16,
Stage => ‘TransactionCreate’,
Queue => 0,
Template => 1 }
);

For reference, these are the contents of lib/RT/Actions/AutoTake.pm:

BEGIN LICENSE BLOCK

(Except where explictly superceded by other copyright notices)

This work is made available to you under the terms of Version 2 of

the GNU General Public License. A copy of that license should have

been provided with this software, but in any event can be snarfed

from www.gnu.org.

This work is distributed in the hope that it will be useful, but

WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU

General Public License for more details.

Unless otherwise specified, all modifications, corrections or

extensions to this work which alter its source code become the

property of Best Practical Solutions, LLC hen submitted for

inclusion in the work.=0A

END LICENSE BLOCK

automatically assign a ticket to the current user if

* ticket is owned by Nobody

* user is privileged

* user can own tickets in this queue

Based on Bruce Campbell’s AutoTake.pm module for RT2, and Chad Scott’s

AutoOpen patch for RT3.

package RT::Action::AutoTake;
Require RT::Action::Generic;
use strict;
use vars qw/@ISA/;
@ISA = qw(RT::Action::Generic);

sub Describe {
my $self = shift;
return (ref $self );
}

sub Prepare {
my $self = shift;
my $retval = undef;
if ($self->TicketObj->IsOwner($RT::Nobody)) {
$retval = 1;
}
return($retval);
}

sub Commit {
my $self = shift;
$self->TicketObj->SetOwner($self->TransactionObj->CreatorObj->id);
return(1);
}
eval “require RT::Action::AutoTake_Vendor”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Action/AutoTake_Vendor.pm});
eval “require RT::Action::AutoTake_Local”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Action/AutoTake_Local.pm});

1;

Has anyone successfully used this?

Also, it seems that there’s been enough demand for this scrip for Jesse
to consider including it in the distribution… Jesse?

Thanks a lot in advance.

cv

This one time, at band camp, Jamie Wilkinson wrote:

I’ve got a patch that adds an AutoTake.pm action, then all you need to
do is
do a couple of database inserts to enable the new script as a separate
action/scrip.

The patch I sent was broken, a correct AutoTake.pm is attached, drop it
over
the top of the broken version. As per Phil’s email, use the importer
script
to add the action to your RT installation.

jaq@spacepants.org
http://spacepants.org/jaq.gpg