[Rt-commit] rt branch, 4.4-trunk, updated. rt-4.4.4-115-g9b4134f6dc

? sunnavy sunnavy at bestpractical.com
Fri Jun 26 09:35:46 EDT 2020


The branch, 4.4-trunk has been updated
       via  9b4134f6dc83d4e4c72d3a758e620aca4f00294d (commit)
       via  ddecbcb998385c9ad7e3b0c1e555ebfb2062c03e (commit)
       via  aa5063c9f2a0b9936a9a117ac66bcf2e58a2fd5d (commit)
       via  42fce4092aed2020cf893912b2f73e60f8f8b0f8 (commit)
      from  a88446da3853bd9e60a6811803ba64c217f9806c (commit)

Summary of changes:
 docs/query_builder.pod                    | 33 +++++++++++++++++++++++--------
 lib/RT/Interface/Web/QueryBuilder/Tree.pm | 32 ++++++++++++++++++++++++++----
 lib/RT/Report/Tickets.pm                  |  2 +-
 3 files changed, 54 insertions(+), 13 deletions(-)

- Log -----------------------------------------------------------------
commit 42fce4092aed2020cf893912b2f73e60f8f8b0f8
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Apr 10 23:01:52 2018 +0800

    Add support of "Lifecycle =" and "Queue LIKE" to GetReferencedQueues
    
    So queue-level custom fields could show up on pages like query builder
    for queries like "Lifecycle = 'default'" or "Queue LIKE 'General'".

diff --git a/lib/RT/Interface/Web/QueryBuilder/Tree.pm b/lib/RT/Interface/Web/QueryBuilder/Tree.pm
index 1ab187794f..f9cdd6144f 100644
--- a/lib/RT/Interface/Web/QueryBuilder/Tree.pm
+++ b/lib/RT/Interface/Web/QueryBuilder/Tree.pm
@@ -99,6 +99,10 @@ will appear as a key whose value is 1.
 
 sub GetReferencedQueues {
     my $self = shift;
+    my %args = (
+        CurrentUser => '',
+        @_
+    );
 
     my $queues = {};
 
@@ -110,10 +114,30 @@ sub GetReferencedQueues {
             return unless $node->isLeaf;
 
             my $clause = $node->getNodeValue();
-            return unless $clause->{Key} eq 'Queue';
-            return unless $clause->{Op} eq '=';
-
-            $queues->{ $clause->{Value} } = 1;
+            if ( $clause->{Key} eq 'Queue' ) {
+                if ( $clause->{Op} eq '=' ) {
+                    $queues->{ $clause->{Value} } ||= 1;
+                }
+                elsif ( $clause->{Op} =~ /^LIKE$/i ) {
+                    my $qs = RT::Queues->new( $args{CurrentUser} || $HTML::Mason::Commands::session{CurrentUser} );
+                    $qs->Limit( FIELD => 'Name', VALUE => $clause->{Value}, OPERATOR => 'LIKE' );
+                    while ( my $q = $qs->Next ) {
+                        next unless $q->id;
+                        $queues->{ $q->id } ||= 1;
+                    }
+                }
+            }
+            elsif ( $clause->{Key} eq 'Lifecycle' ) {
+                if ( $clause->{Op} eq '=' ) {
+                    my $qs = RT::Queues->new( $args{CurrentUser} || $HTML::Mason::Commands::session{CurrentUser} );
+                    $qs->Limit( FIELD => 'Lifecycle', VALUE => $clause->{Value} );
+                    while ( my $q = $qs->Next ) {
+                        next unless $q->id;
+                        $queues->{ $q->id } ||= 1;
+                    }
+                }
+            }
+            return;
         }
     );
 
diff --git a/lib/RT/Report/Tickets.pm b/lib/RT/Report/Tickets.pm
index 65733a43f1..01e9b72d3c 100644
--- a/lib/RT/Report/Tickets.pm
+++ b/lib/RT/Report/Tickets.pm
@@ -173,7 +173,7 @@ our %GROUPINGS_META = (
                 require RT::Interface::Web::QueryBuilder::Tree;
                 my $tree = RT::Interface::Web::QueryBuilder::Tree->new('AND');
                 $tree->ParseSQL( Query => $args->{'Query'}, CurrentUser => $self->CurrentUser );
-                $queues = $args->{'Queues'} = $tree->GetReferencedQueues;
+                $queues = $args->{'Queues'} = $tree->GetReferencedQueues( CurrentUser => $self->CurrentUser );
             }
             return () unless $queues;
 

commit aa5063c9f2a0b9936a9a117ac66bcf2e58a2fd5d
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Thu Jun 25 13:41:22 2020 -0400

    Document new queue and lifecycle search options

diff --git a/docs/query_builder.pod b/docs/query_builder.pod
index 1195ea06e7..daf6b17223 100644
--- a/docs/query_builder.pod
+++ b/docs/query_builder.pod
@@ -156,5 +156,23 @@ And there are the basics of the query builder! To implement these basics to
 build reports, please see the Dashboard & Reports document. For definitions of
 piece of RT metadata, please see the Definitions of Ticket Metadata document.
 
+=head1 Searching Custom Fields
+
+If you use custom fields on your tickets, you might initially load the Query
+Builder and not see them listed. If your custom fields are applied to
+individual queues and not globally, they won't show up as options on a
+new search. However, once you add a queue to your search, as shown above, the
+custom fields applied to the queue or queues in your search will be displayed.
+You can then add custom field values to your search just like other fields.
+
+In addition to exact queue name searches like "Queue = 'RT'", the query builder
+also allows 'LIKE' searches. This can be useful if you have several queues that
+follow some naming pattern, like "IT Support", "Printer Support", and "Email Support".
+To include all of these, you can use "Queue LIKE 'Support'".
+
+Using the Advanced tab, you can also type one other criteria to search for queues
+by their lifecycle. TicketSQL supports "Lifecycle = 'support'" if you type it
+directly into the Advanced search box.
+
 =cut
 

commit ddecbcb998385c9ad7e3b0c1e555ebfb2062c03e
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Thu Jun 25 13:47:21 2020 -0400

    Apply a few small changes from updated RT 5 docs

diff --git a/docs/query_builder.pod b/docs/query_builder.pod
index daf6b17223..6c6d1e27bb 100644
--- a/docs/query_builder.pod
+++ b/docs/query_builder.pod
@@ -8,11 +8,7 @@ to find exactly what you're looking for (and no more) are discussed below.
 The Query Builder is the heart of reporting in RT, which is covered in the
 L<Dashboard and Reports|docs/dashboards_reporting.pod> document.
 
-To follow along with the examples, go to
-L<issues.bestpractical.com|http://issues.bestpractical.com> and try the
-searches yourself.
-
-=head1 Example
+=head1 Basic Ticket Searches
 
 Let's look for tickets in the "RT" queue (RT's bugtracker for itself) that have
 been resolved in the last year. (These examples assume it's currently mid June,
@@ -152,10 +148,6 @@ add the following to your query:
 
 AND CF.{TransportType} IS NOT NULL
 
-And there are the basics of the query builder! To implement these basics to
-build reports, please see the Dashboard & Reports document. For definitions of
-piece of RT metadata, please see the Definitions of Ticket Metadata document.
-
 =head1 Searching Custom Fields
 
 If you use custom fields on your tickets, you might initially load the Query
@@ -176,3 +168,10 @@ directly into the Advanced search box.
 
 =cut
 
+=head1 Learn More
+
+To use the query builder to build and save reports, see
+L<Dashboard and Reports|docs/dashboards_reporting.pod>. For definitions of
+RT metadata, see L<Ticket Metadata|docs/ticket_metadata.pod>.
+
+=cut

commit 9b4134f6dc83d4e4c72d3a758e620aca4f00294d
Merge: a88446da38 ddecbcb998
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Jun 26 21:27:02 2020 +0800

    Merge branch '4.4/get-referenced-queues-more-search-items' into 4.4-trunk


-----------------------------------------------------------------------


More information about the rt-commit mailing list