[rt-users] Getting owner to change when replying

Carlos Vicente cvicente at network-services.uoregon.edu
Thu Jun 26 14:12:49 EDT 2003


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
<file> (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
#
# Copyright (c) 1996-2003 Jesse Vincent <jesse at bestpractical.com>
# Copyright (c) 2003 Jamie Wilkinson <jaq at spacepants.org>
#
# (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 at spacepants.org                          
http://spacepants.org/jaq.gpg





More information about the rt-users mailing list