Customising Quicksearch to show unowned ticket counts

Hi there,

I’m in the process of doing some groundwork for migrating our [fairly customised] RT from 3.8.10 to 4.0.x, checking that our various add ons work (and if they don’t, working out what we need to do to fix them).

I’m currently looking at our change to the Quicksearch panel. In 3.8.x, there was a Conditions callback, which we used to:

  1. add a count of unowned tickets in each queue, something some of my users are very keen on, and
  2. to drop the count of stalled tickets, which our users mostly don’t care about.

That callback has unfortunately been removed in the rewriting of this element to use life cycles and RT::Report::Tickets

Of those, (2) is easy to reimplement by either editing the lifecycle configuration, or overriding the element to skip the stalled status.

The first one looks much harder now, since RT::Report::Tickets appears to be simply using Group By to produce the various columns, and of course ‘unowned’ isn’t a status as such, it requires different queries.

So I’ve overridden the QueueSummaryByLifecycle element and just perform the extra queries separately by another RT::Report::Tickets object searching for unowned tickets in all the requested queues, unowned, and grouped by queue, and use that to add ‘unowned’ hash elements to the $data hash. Is that the best approach, or have I missed something a bit more elegant?

Tim

The Wellcome Trust Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE.

Hi there,

I’m in the process of doing some groundwork for migrating our [fairly customised] RT from 3.8.10 to 4.0.x, checking that our various add ons work (and if they don’t, working out what we need to do to fix them).

I’m currently looking at our change to the Quicksearch panel. In 3.8.x, there was a Conditions callback, which we used to:

  1. add a count of unowned tickets in each queue, something some of my users are very keen on, and
  2. to drop the count of stalled tickets, which our users mostly don’t care about.

That callback has unfortunately been removed in the rewriting of this element to use life cycles and RT::Report::Tickets

Of those, (2) is easy to reimplement by either editing the lifecycle configuration, or overriding the element to skip the stalled status.

The first one looks much harder now, since RT::Report::Tickets appears to be simply using Group By to produce the various columns, and of course ‘unowned’ isn’t a status as such, it requires different queries.

So I’ve overridden the QueueSummaryByLifecycle element and just perform the extra queries separately by another RT::Report::Tickets object searching for unowned tickets in all the requested queues, unowned, and grouped by queue, and use that to add ‘unowned’ hash elements to the $data hash. Is that the best approach, or have I missed something a bit more elegant?

add callback right before the following line and change $query as you need:

$report->SetupGroupings(…);

In your case callback would simple:

$$Query = “($$Query) AND Owner = ‘Nobody’”;

Also, components have:

$m->callback( CallbackName => ‘Filter’, Queues => @queues );

You can add similar callback to filter statuses a few lines later.

So two simple patches that add one line callback calls and two callback files.

Tim


The Wellcome Trust Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE.

RT Training Sessions (http://bestpractical.com/services/training.html)

  • Boston March 5 & 6, 2012

Best regards, Ruslan.

Hi Ruslan, thanks for the quick response.On 27 Feb 2012, at 15:34, Ruslan Zakirov wrote:

So I’ve overridden the QueueSummaryByLifecycle element and just perform the extra queries separately by another RT::Report::Tickets object searching for unowned tickets in all the requested queues, unowned, and grouped by queue, and use that to add ‘unowned’ hash elements to the $data hash. Is that the best approach, or have I missed something a bit more elegant?

add callback right before the following line and change $query as you need:

$report->SetupGroupings(…);

In your case callback would simple:

$$Query = “($$Query) AND Owner = ‘Nobody’”;

Also, components have:

$m->callback( CallbackName => ‘Filter’, Queues => @queues );

You can add similar callback to filter statuses a few lines later.

So two simple patches that add one line callback calls and two callback files.

Ah, neater, but that’s not quite what I’m after though; I need the existing status columns to be unchanged (i.e. tickets owned by anyone) whereas the unowned column is tickets in any active status which are owned by Nobody; I don’t think that can be done with a single call to SetupGroupings, can it?

Tim

The Wellcome Trust Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE.

Hi Ruslan, thanks for the quick response.

So I’ve overridden the QueueSummaryByLifecycle element and just perform the extra queries separately by another RT::Report::Tickets object searching for unowned tickets in all the requested queues, unowned, and grouped by queue, and use that to add ‘unowned’ hash elements to the $data hash. Is that the best approach, or have I missed something a bit more elegant?

add callback right before the following line and change $query as you need:

$report->SetupGroupings(…);

In your case callback would simple:

$$Query = “($$Query) AND Owner = ‘Nobody’”;

Also, components have:

$m->callback( CallbackName => ‘Filter’, Queues => @queues );

You can add similar callback to filter statuses a few lines later.

So two simple patches that add one line callback calls and two callback files.

Ah, neater, but that’s not quite what I’m after though; I need the existing status columns to be unchanged (i.e. tickets owned by anyone) whereas the unowned column is tickets in any active status which are owned by Nobody; I don’t think that can be done with a single call to SetupGroupings, can it?

Do you want Unowned column next to statuses? If so then overriding
plugin is for sure better way to go.

Take a look at SummaryByUser extension.

Old version in RT 3.8 used too many queries for this box. In RT4 it’s
only one, so there is no way back. I would recommend you to figure out
SetupGroupping thing and you would be able to do required box in two
queries.

Tim


The Wellcome Trust Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE.

Best regards, Ruslan.