[rt-users] 3.6.3:Query Bulder help to Limit 10 unowned tickets display to queues the user has rights to only
Nick Metrowsky
nmetrowsky at digitalglobe.com
Fri Dec 22 12:47:46 EST 2006
Hi Everyone,
As you probably are aware that RT 3.6.3 has a major change which affects
the "10 newest unowned tickets" display on the "RT at a glance" page.
The information displayed in this area of the screen is now a saved
search contained within the database.
The attached code snippet was written by Eric Schultz back in January,
2006. This code is designed to display unassigned tickets to those users
that have rights to the various queues they support. So, instead of
getting a display for all Request Tracker queues, a user will only get a
display of tickets for queues that they service. This feature has proven
to be very useful at our site, so it would be a nice thing to have in
for RT 3.6.3.
My question, how would one go about adding this logic to a Query Builder
search element?
Any ideas would be most welcome.
Nick
The Query Builder search for "10 unowned tickets" in 3.6.3 contains:
User = 'Nobody'
AND
(Status = 'new')
OR (Status = 'open')
The following is the logic to limit unowned tickets to the queues a user
has rights to only:
** MyRequests 2005/07/05 23:47:16 1.11
--- MyRequests 2005/10/04 21:56:46 1.12
***************
*** 77,90 ****
<%init>
my $rows = $RT::MyRequestsLength;
! my $Query = "Owner = 'Nobody' AND ( Status = 'new' OR Status =
'open')";
my $QueryString = '?' . $m->comp('/Elements/QueryString',
Query => $Query,
--- 77,102 ----
<%init>
my $rows = $RT::MyRequestsLength;
! # This next section of code will limit unowned tickets to only be
! # those that are in a queue that a user can own tickets in.
! my $q = new RT::Queues($session{'CurrentUser'});
! $q->UnLimit;
! my @queues;
!
! while (my $queue = $q->Next) {
! if ($queue->CurrentUserHasRight( 'OwnTicket' )) {
! push( @queues, "Queue = \'" . $queue->Name . "\'" );
! }
! }
+ my $Query = "Owner = 'Nobody' AND ( Status = 'new' OR Status = 'open')
AND ( " . join( " OR ", @queues ) . " )";
+
my $QueryString = '?' . $m->comp('/Elements/QueryString',
Query => $Query,
------------------------------------------------------------------------
---------
Nick Metrowsky
Consulting System Administrator
303-684-4785 Office
303-684-4100 Fax
nmetrowsky at digitalglobe.com <mailto:nmetrowsky at digitalglobe.com>
DigitalGlobe (r), An Imaging and Information Company
http://www.digitalglobe.com <http://www.digitalglobe.com>
------------------------------------------------------------------------
---------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20061222/769ce193/attachment.htm>
More information about the rt-users
mailing list