[rt-users] Easily assigning "requestor" a username rather than an email

Jonathan Reeder jreeder at minutemenu.com
Tue Jan 11 16:29:41 EST 2005


Worked like a charm!  Thanks a bunch for the help.

-----Original Message-----
From: Todd Chapman [mailto:rt at chaka.net]
Sent: Tuesday, January 11, 2005 1:03 PM
To: Jonathan Reeder
Cc: rt-users at lists.bestpractical.com
Subject: Re: [rt-users] Easily assigning "requestor" a username rather
than an email


This is not the cleanest way to do it but it is the easiest.

Create /opt/rt3/local/lib/RT/User_Local.pm with this content:

no warnings qw(redefine);

sub LoadByEmail {
    my $self    = shift;
    my $address = shift;

    # Never load an empty address as an email address.
    unless ($address) {
        return (undef);
    }

    if ($address !~ /\@/) {
        $self->Load($address) && return $self;
    }
    $address = $self->CanonicalizeEmailAddress($address);

    #$RT::Logger->debug("Trying to load an email address: $address\n");
    return $self->LoadByCol( "EmailAddress", $address );
}

You may need to restart Apache.

-Todd

On Tue, Jan 11, 2005 at 12:51:41PM -0600, Jonathan Reeder wrote:
> Cool, this sounds very promising.  I'm a bit unindoctrinated though, so
> you'll have to excuse me.  Is this going to allow me to put a username in
> the "Requestor" field, then when I save the ticket, it will automatically
> assign that user's email address to the "Requestor" field?
>
> Thanks a bunch.
>
> -----Original Message-----
> From: Todd Chapman [mailto:rt at chaka.net]
> Sent: Tuesday, January 11, 2005 11:40 AM
> To: Jonathan Reeder
> Cc: rt-users at lists.bestpractical.com
> Subject: Re: [rt-users] Easily assigning "requestor" a username rather
> than an email
>
>
> I think there are some places in RT where LoadByEmail is called and
> it should probably just be Load(). User_Overlay::Load() should
> be changed to:
>
> sub Load {
>     my $self       = shift;
>     my $identifier = shift || return undef;
>
>     #if it's an int, load by id. otherwise, load by name.
>     if ( $identifier =~ /^\d+$/ ) {
>         $self->SUPER::LoadById($identifier);
>     }
>     elsif ($identifier =~ /\@/) {
>         $self->LoadByEmail( $identifier );
>     }
>     else {
>         $self->LoadByCol( "Name", $identifier );
>     }
> }
>
> On Tue, Jan 11, 2005 at 11:21:49AM -0600, Jonathan Reeder wrote:
> > Since this question requires a little bit of background, I'm going to
> state
> > the question itself as simply as possible before I get into the
> back-story.
> >
> > Q: How can I easily make the "requestor" of a ticket a user other than
> > myself, without necessarily knowing that user's email address?
Secondary
> to
> > that, is it possible to search through tickets by a requestor's username
> > rather than by his email address?
> >
> > If this makes sense as is, read no further.  If not, you can see why I'm
> > asking below:
> >
> > The way we have our RT set up is such that our clients are set up as
users
> > in the system.  They can each login, search tickets, create tickets,
etc.
> > However, they also call us quite frequently.  When they call us, an
> internal
> > support staff member will create a new ticket, and change the requestor
> from
> > himself to the client's email address as listed in their "Edit User"
form.
> > Unfortunately, its obviously a lot easier to ask a caller "What is your
> > company name?" (which we use as their username) than it is to say "What
> > email address to you have on file with us?".  So it would be awesome if
> the
> > person fielding the call could just pop in a username rather than having
> to
> > find the email address associated with that username.
> >
> > Also, I'd like to be able to search through tickets by providing a
> > requestor's username rather than his email address.  Right now, the
search
> > criteria only has "(Requestor's|CC's|AdminCC's) email address
> > (contains|doesn't contain) __________".  I'm wondering if any of you
guys
> > have come up with an easier way to search through tickets by a
requesting
> > user rather than by a requesting user's email address.
> >
> > Thanks a bunch for taking the time to help out.
> >
> > Jonathan Reeder
>
> > _______________________________________________
> > http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> >
> > Be sure to check out the RT wiki at http://wiki.bestpractical.com
>





More information about the rt-users mailing list