[rt-users] Adding Creator to Search
D. McMahon
dave at accessne.com
Wed Feb 25 12:04:29 EST 2004
RT 3.0.5
mySQL 3.23.58
apache 1.3.28 mod perl
I added Creator to the search criteria. Seems to
be working ok. Here it is for posterity, use at you
own peril.....
cp ./share/html/Elements/SelectOwner ./local/html/Elements/SelectCreator
cp ./share/html/Search/Elements/PickRestriction
./local/html/Search/Elements/PickRestriction
Change the following:
---------------------------------------------------
diff ./local/html/Elements/SelectCreator ./share/html/Elements/SelectOwner
27,29c27,28
<
< %while ( my $Creator = $Users->Next()) {
< <OPTION VALUE="<%$Creator->Id()%>" <% ($Creator->Id() == $Default) &&
"SELECTED" %>><%$Creator->Name()%></OPTION>
---
> %while ( my $User = $Users->Next()) {
> <OPTION VALUE="<%$User->Id()%>" <% ($User->Id() == $Default) &&
"SELECTED" %>><%$User->Name()%></OPTION>
31d29
<
46c44
< $Users->WhoHaveRight(Right => 'CreateTicket',
---
> $Users->WhoHaveRight(Right => 'OwnTicket',
===================================================
---------------------------------------------------
diff ./local/html/Search/Elements/PickRestriction
30d29
<
35d33
<
38,45d35
<
< <li><&|/l&>Creator is</&> <& /Elements/SelectBoolean, Name =>
"CreatorOp",
< TrueVal=> '=',
< FalseVal => '!='
< &>
< <& /Elements/SelectCreator, Name => "ValueOfCreator" &>
<
<
===================================================
Not sure if this is OK to do, but there is no ./local/lib
---------------------------------------------------
diff ./lib/RT/Interface/Web.pm
658,666d657
< # {{{ Limit Creator
< if ( $args{ARGS}->{'ValueOfCreator'} ne '' ) {
< $session{'tickets'}->LimitCreator(
< VALUE => $args{ARGS}->{'ValueOfCreator'},
< OPERATOR => $args{ARGS}->{'CreatorOp'}
< );
< }
<
< # }}}
===================================================
---------------------------------------------------
diff ./lib/RT/Tickets_Overlay.pm
1277,1306d1276
< # {{{ sub LimitCreator
<
< =head2 LimitCreator
<
< Takes a paramhash with the fields OPERATOR and VALUE.
< OPERATOR is one of = or !=.
< VALUE is a user id.
<
< =cut
<
< sub LimitCreator {
< my $self = shift;
< my %args = ( OPERATOR => '=',
< @_);
<
< my $creator = new RT::User($self->CurrentUser);
< $creator->Load($args{'VALUE'});
< # FIXME: check for a valid $creator
< $self->Limit (FIELD => 'Creator',
< VALUE => $args{'VALUE'},
< OPERATOR => $args{'OPERATOR'},
< DESCRIPTION => join(
< ' ', $self->loc('Creator'), $args{'OPERATOR'},
$creator->Name(),
< ),
< );
<
< }
<
< # }}}
<
===================================================
Stop and restart apache to pick up the changes.
Enjoy.
Dave
More information about the rt-users
mailing list