[Rt-commit] rt branch, 4.4/use-status-active, created. rt-4.4.0-58-g170cefb

Shawn Moore shawn at bestpractical.com
Wed Feb 24 13:43:41 EST 2016


The branch, 4.4/use-status-active has been created
        at  170cefb09805403c952136b5015edead57c879b0 (commit)

- Log -----------------------------------------------------------------
commit b2159722beb062b138f9d348e8d343ba6e9f06c0
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 05:35:13 2016 +0000

    Fix variable name in ShowQueue
    
        Label is what we display to the user; value is what we use internally

diff --git a/share/html/Ticket/Elements/ShowQueue b/share/html/Ticket/Elements/ShowQueue
index 1e4b444..5b14cb5 100644
--- a/share/html/Ticket/Elements/ShowQueue
+++ b/share/html/Ticket/Elements/ShowQueue
@@ -46,22 +46,22 @@
 %#
 %# END BPS TAGGED BLOCK }}}
 % if ( $query ) {
-<a href="<% RT->Config->Get('WebPath') %>/Search/Results.html?Query=<% $query |u,n %>"><% $value %></a>
+<a href="<% RT->Config->Get('WebPath') %>/Search/Results.html?Query=<% $query |u,n %>"><% $label %></a>
 % } else {
-<% $value %>
+<% $label %>
 % }
 <%ARGS>
 $Ticket => undef
 $QueueObj
 </%ARGS>
 <%INIT>
-my $value = $QueueObj->Name;
+my $label = $QueueObj->Name;
 my $query;
 
 if ( $Ticket and $Ticket->CurrentUserHasRight('SeeQueue') ) {
     # Grab the queue name anyway if the current user can
     # see the queue based on his role for this ticket
-    $value = $QueueObj->__Value('Name');
+    $label = $QueueObj->__Value('Name');
     if ( $session{CurrentUser}->Privileged ) {
         my @statuses = $QueueObj->ActiveStatusArray();
         s{(['\\])}{\\$1}g for @statuses;
@@ -69,6 +69,6 @@ if ( $Ticket and $Ticket->CurrentUserHasRight('SeeQueue') ) {
     }
 }
 
-$value = '#'. $QueueObj->id
-    unless defined $value && length $value;
+$label = '#'. $QueueObj->id
+    unless defined $label && length $label;
 </%INIT>

commit 0890b14f461254929431eb33f1acbbd682bf6b17
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 05:36:46 2016 +0000

    Use Status = '__Active__' for ShowQueue
    
    Fixes: I#31696

diff --git a/share/html/Ticket/Elements/ShowQueue b/share/html/Ticket/Elements/ShowQueue
index 5b14cb5..baa1250 100644
--- a/share/html/Ticket/Elements/ShowQueue
+++ b/share/html/Ticket/Elements/ShowQueue
@@ -63,9 +63,7 @@ if ( $Ticket and $Ticket->CurrentUserHasRight('SeeQueue') ) {
     # see the queue based on his role for this ticket
     $label = $QueueObj->__Value('Name');
     if ( $session{CurrentUser}->Privileged ) {
-        my @statuses = $QueueObj->ActiveStatusArray();
-        s{(['\\])}{\\$1}g for @statuses;
-        $query = "Queue = " . $QueueObj->id . " AND ( ". join(" OR ", map {"Status = '$_'"} @statuses) . " )";
+        $query = "Queue = " . $QueueObj->id . " AND Status = '__Active__'";
     }
 }
 

commit df1699d9c4ee304c7a9d240c6bbc403437245c0e
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 05:40:49 2016 +0000

    Use queue name rather than queue id in ShowQueue search link
    
        This is the same escaping code we've long since used in
        the QueueList. Using the queue by ID in a search is very
        surprising and not at all self-documenting.

diff --git a/share/html/Ticket/Elements/ShowQueue b/share/html/Ticket/Elements/ShowQueue
index baa1250..f15acfe 100644
--- a/share/html/Ticket/Elements/ShowQueue
+++ b/share/html/Ticket/Elements/ShowQueue
@@ -63,7 +63,9 @@ if ( $Ticket and $Ticket->CurrentUserHasRight('SeeQueue') ) {
     # see the queue based on his role for this ticket
     $label = $QueueObj->__Value('Name');
     if ( $session{CurrentUser}->Privileged ) {
-        $query = "Queue = " . $QueueObj->id . " AND Status = '__Active__'";
+        my $queue_name_parameter = $label;
+        $queue_name_parameter =~ s/(['\\])/\\$1/g; #'
+        $query = "Queue = '$queue_name_parameter' AND Status = '__Active__'";
     }
 }
 

commit e9dcc3e9f10bc7ff057c20aa7d5f8205a9229a8c
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 05:47:20 2016 +0000

    Use Status = '__Active__' for queuelist links
    
    Fixes: I#31695

diff --git a/share/html/Elements/QueueSummaryByLifecycle b/share/html/Elements/QueueSummaryByLifecycle
index 04953db..4bc1d24 100644
--- a/share/html/Elements/QueueSummaryByLifecycle
+++ b/share/html/Elements/QueueSummaryByLifecycle
@@ -70,7 +70,7 @@ for my $queue (@queues) {
 <tr class="<% $i%2 ? 'oddline' : 'evenline'%>" >
 
 <td>
-    <a href="<% $link_all->($queue, \@cur_statuses) %>" title="<% $queue->{Description} %>"><% $queue->{Name} %></a>
+    <a href="<% $link_all->($queue) %>" title="<% $queue->{Description} %>"><% $queue->{Name} %></a>
 </td>
 
 %   for my $status (@cur_statuses) {
@@ -93,10 +93,8 @@ my $build_search_link = sub {
 };
 
 my $link_all = sub {
-    my ($queue, $all_statuses) = @_;
-    my @escaped = @{$all_statuses};
-    s{(['\\])}{\\$1}g for @escaped;
-    return $build_search_link->($queue->{Name}, "(".join(" OR ", map "Status = '$_'", @escaped).")");
+    my ($queue) = @_;
+    return $build_search_link->($queue->{Name}, "Status = '__Active__'");
 };
 
 my $link_status = sub {
diff --git a/share/html/Elements/QueueSummaryByStatus b/share/html/Elements/QueueSummaryByStatus
index f9ec66c..bbb4c76 100644
--- a/share/html/Elements/QueueSummaryByStatus
+++ b/share/html/Elements/QueueSummaryByStatus
@@ -59,12 +59,11 @@ my $i = 0;
 for my $queue (@queues) {
     $i++;
     my $lifecycle = $lifecycle{ lc $queue->{'Lifecycle'} };
-    my @queue_statuses = grep { $lifecycle->IsValid($_) } @statuses;
 </%PERL>
 <tr class="<% $i%2 ? 'oddline' : 'evenline'%>" >
 
 <td>
-    <a href="<% $link_all->($queue, \@queue_statuses) %>" title="<% $queue->{Description} %>"><% $queue->{Name} %></a>
+    <a href="<% $link_all->($queue) %>" title="<% $queue->{Description} %>"><% $queue->{Name} %></a>
 </td>
 
 <%perl>
@@ -92,8 +91,8 @@ my $build_search_link = sub {
 };
 
 my $link_all = sub {
-    my ($queue, $all_statuses) = @_;
-    return $build_search_link->($queue->{Name}, "(".join(" OR ", map "Status = '$_'", @$all_statuses).")");
+    my ($queue) = @_;
+    return $build_search_link->($queue->{Name}, "Status = '__Active__'");
 };
 
 my $link_status = sub {

commit 560fe2f83056e330e1b78dc9c74ce531e8208d78
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 05:51:14 2016 +0000

    This syntax highlighting hint is no longer relevant
    
        This belongs on the line with the escaping regular expression,
        which was moved in d48afa23. It went unnoticed presumably because
        emacs colors leaning toothpicks more correctly than vim.

diff --git a/share/html/Elements/QueueSummaryByLifecycle b/share/html/Elements/QueueSummaryByLifecycle
index 4bc1d24..420ccd6 100644
--- a/share/html/Elements/QueueSummaryByLifecycle
+++ b/share/html/Elements/QueueSummaryByLifecycle
@@ -150,7 +150,7 @@ my @escaped = @statuses;
 s{(['\\])}{\\$1}g for @escaped;
 my $query =
     "(".
-    join(" OR ", map {"Status = '$_'"} @escaped) #'
+    join(" OR ", map {"Status = '$_'"} @escaped)
     .") AND (".
     join(' OR ', map "Queue = ".$_->{id}, @queues)
     .")";

commit e9119915e8b2321115404037463a8a8437ec241d
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 05:54:02 2016 +0000

    Use Status = '__Active__' for queuelist report query
    
        Passing statuses _was_ supported but is used by neither core nor RTIR
        (which ships its own QueueSummary template)
    
        Along the way, ByLifecycle received a bugfix, d48afa23, which
        ByStatus did not. This commit obsoletes that bugfix, restoring some
        parity between these two templates.

diff --git a/share/html/Elements/QueueSummaryByLifecycle b/share/html/Elements/QueueSummaryByLifecycle
index 420ccd6..a768412 100644
--- a/share/html/Elements/QueueSummaryByLifecycle
+++ b/share/html/Elements/QueueSummaryByLifecycle
@@ -132,12 +132,11 @@ for my $queue (@queues) {
     $lifecycle{ lc $cycle->Name } = $cycle;
 }
 
-unless (@statuses) {
-    my %seen;
-    foreach my $set ( 'initial', 'active' ) {
-        foreach my $lifecycle ( map $lifecycle{$_}, sort keys %lifecycle ) {
-            push @statuses, grep !$seen{ lc $_ }++, $lifecycle->Valid($set);
-        }
+my @statuses;
+my %seen;
+foreach my $set ( 'initial', 'active' ) {
+    foreach my $lifecycle ( map $lifecycle{$_}, sort keys %lifecycle ) {
+        push @statuses, grep !$seen{ lc $_ }++, $lifecycle->Valid($set);
     }
 }
 
@@ -146,12 +145,8 @@ my $statuses = {};
 
 use RT::Report::Tickets;
 my $report = RT::Report::Tickets->new( RT->SystemUser );
-my @escaped = @statuses;
-s{(['\\])}{\\$1}g for @escaped;
 my $query =
-    "(".
-    join(" OR ", map {"Status = '$_'"} @escaped)
-    .") AND (".
+    "(Status = '__Active__') AND (".
     join(' OR ', map "Queue = ".$_->{id}, @queues)
     .")";
 $query = 'id < 0' unless @queues;
@@ -165,5 +160,4 @@ while ( my $entry = $report->Next ) {
 </%INIT>
 <%ARGS>
 $queue_filter => undef
- at statuses => ()
 </%ARGS>
diff --git a/share/html/Elements/QueueSummaryByStatus b/share/html/Elements/QueueSummaryByStatus
index bbb4c76..812ba4b 100644
--- a/share/html/Elements/QueueSummaryByStatus
+++ b/share/html/Elements/QueueSummaryByStatus
@@ -129,12 +129,11 @@ for my $queue (@queues) {
     $lifecycle{ lc $cycle->Name } = $cycle;
 }
 
-unless (@statuses) {
-    my %seen;
-    foreach my $set ( 'initial', 'active' ) {
-        foreach my $lifecycle ( map $lifecycle{$_}, sort keys %lifecycle ) {
-            push @statuses, grep !$seen{ lc $_ }++, $lifecycle->Valid($set);
-        }
+my @statuses;
+my %seen;
+foreach my $set ( 'initial', 'active' ) {
+    foreach my $lifecycle ( map $lifecycle{$_}, sort keys %lifecycle ) {
+        push @statuses, grep !$seen{ lc $_ }++, $lifecycle->Valid($set);
     }
 }
 
@@ -144,9 +143,7 @@ my $statuses = {};
 use RT::Report::Tickets;
 my $report = RT::Report::Tickets->new( RT->SystemUser );
 my $query =
-    "(".
-    join(" OR ", map {s{(['\\])}{\\$1}g; "Status = '$_'"} @statuses) #'
-    .") AND (".
+    "(Status = '__Active__') AND (".
     join(' OR ', map "Queue = ".$_->{id}, @queues)
     .")";
 $query = 'id < 0' unless @queues;
@@ -160,5 +157,4 @@ while ( my $entry = $report->Next ) {
 </%INIT>
 <%ARGS>
 $queue_filter => undef
- at statuses => ()
 </%ARGS>

commit 2513da78368d172fdf3a32ac84dd01c780f6e40e
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 06:15:18 2016 +0000

    Use Status = '__Active__' for ExtendedStatus dependency search link

diff --git a/share/html/Elements/RT__Ticket/ColumnMap b/share/html/Elements/RT__Ticket/ColumnMap
index d695ba3..33e32ed 100644
--- a/share/html/Elements/RT__Ticket/ColumnMap
+++ b/share/html/Elements/RT__Ticket/ColumnMap
@@ -132,9 +132,7 @@ $COLUMN_MAP = {
                     return \'<em>', loc('(pending approval)'), \'</em>';
                 }
                 else {
-                    my $Query = "DependedOnBy = " . $Ticket->id;
-                    $Query .= " AND (" . join(" OR ", map { "Status = '$_'" } RT::Queue->ActiveStatusArray) . ")";
-
+                    my $Query = "DependedOnBy = " . $Ticket->id . " AND Status = '__Active__'";
                     my $SearchURL = RT->Config->Get('WebPath') . '/Search/Results.html?' . $m->comp('/Elements/QueryString', Query => $Query);
 
                     if ($count == 1) {

commit a1aa7e35a8a7aac66943cebac392a62100216fc6
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 06:20:42 2016 +0000

    Use Status = '__Active__' for Assets->Ticket search

diff --git a/share/html/Elements/RT__Asset/ColumnMap b/share/html/Elements/RT__Asset/ColumnMap
index ecf6993..618501d 100644
--- a/share/html/Elements/RT__Asset/ColumnMap
+++ b/share/html/Elements/RT__Asset/ColumnMap
@@ -97,8 +97,7 @@ my $COLUMN_MAP = {
         title     => 'Active tickets', # loc
         value     => sub {
             my $Asset = shift;
-            my $Query = "RefersTo = 'asset:" . $Asset->id . "'";
-            $Query .= " AND (" . join(" OR ", map { "Status = '$_'" } RT::Queue->ActiveStatusArray) . ")";
+            my $Query = "RefersTo = 'asset:" . $Asset->id . "' AND Status = '__Active__'";
             my $SearchURL = RT->Config->Get('WebPath') . '/Search/Results.html?' . $m->comp('/Elements/QueryString', Query => $Query);
             return \'[ <a href="',$SearchURL,\'">Active</a> ]';
         }
@@ -107,8 +106,7 @@ my $COLUMN_MAP = {
         title     => 'Inactive tickets', # loc
         value     => sub {
             my $Asset = shift;
-            my $Query = "RefersTo = 'asset:" . $Asset->id . "'";
-            $Query .= " AND (" . join(" OR ", map { "Status = '$_'" } RT::Queue->InactiveStatusArray) . ")";
+            my $Query = "RefersTo = 'asset:" . $Asset->id . "' AND Status = '__Inactive__'";
             my $SearchURL = RT->Config->Get('WebPath') . '/Search/Results.html?' . $m->comp('/Elements/QueryString', Query => $Query);
             return \'[ <a href="',$SearchURL,\'">Inactive</a> ]';
         }

commit 2d20155bfdec978f3b2a0fd335b55eae9275ecf5
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 24 18:26:27 2016 +0000

    Use Status = '__Active__' for simple search status:active

diff --git a/lib/RT/Search/Simple.pm b/lib/RT/Search/Simple.pm
index ac7b226..6fad6be 100644
--- a/lib/RT/Search/Simple.pm
+++ b/lib/RT/Search/Simple.pm
@@ -256,9 +256,9 @@ sub HandleContent   { return content   => "Content LIKE '$_[1]'"; }
 sub HandleId        { $_[1] =~ s/^#//; return id => "Id = $_[1]"; }
 sub HandleStatus    {
     if ($_[1] =~ /^active$/i and !$_[2]) {
-        return status => map {s/(['\\])/\\$1/g; "Status = '$_'"} RT::Queue->ActiveStatusArray();
+        return status => "Status = '__Active__'";
     } elsif ($_[1] =~ /^inactive$/i and !$_[2]) {
-        return status => map {s/(['\\])/\\$1/g; "Status = '$_'"} RT::Queue->InactiveStatusArray();
+        return status => "Status = '__Inactive__'";
     } elsif ($_[1] =~ /^any$/i and !$_[2]) {
         return 'status';
     } else {
diff --git a/t/web/simple_search.t b/t/web/simple_search.t
index 710efb1..bdfaacb 100644
--- a/t/web/simple_search.t
+++ b/t/web/simple_search.t
@@ -61,10 +61,10 @@ ok $two_words_queue && $two_words_queue->id, 'loaded or created a queue';
     is $parser->QueryToSQL('owner:root at localhost'), "( Owner.EmailAddress = 'root\@localhost' ) AND $active", "Email address as owner";
 
     is $parser->QueryToSQL("resolved me"), "( Owner.id = '__CurrentUser__' ) AND ( Status = 'resolved' )", "correct parsing";
-    is $parser->QueryToSQL("resolved active me"), "( Owner.id = '__CurrentUser__' ) AND ( Status = 'resolved' OR Status = 'new' OR Status = 'open' OR Status = 'stalled' )", "correct parsing";
-    is $parser->QueryToSQL("status:active"), $active, "Explicit active search";
+    is $parser->QueryToSQL("resolved active me"), "( Owner.id = '__CurrentUser__' ) AND ( Status = 'resolved' OR Status = '__Active__' )", "correct parsing";
+    is $parser->QueryToSQL("status:active"), "( Status = '__Active__' )", "Explicit active search";
     is $parser->QueryToSQL("status:'active'"), "( Status = 'active' )", "Quoting active makes it the actual word";
-    is $parser->QueryToSQL("inactive me"), "( Owner.id = '__CurrentUser__' ) AND $inactive", "correct parsing";
+    is $parser->QueryToSQL("inactive me"), "( Owner.id = '__CurrentUser__' ) AND ( Status = '__Inactive__' )", "correct parsing";
 
     is $parser->QueryToSQL("cf.Foo:bar"), "( 'CF.{Foo}' LIKE 'bar' ) AND $active", "correct parsing of CFs";
     is $parser->QueryToSQL(q{cf."don't foo?":'bar n\\' baz'}), qq/( 'CF.{don\\'t foo?}' LIKE 'bar n\\' baz' ) AND $active/, "correct parsing of CFs with quotes";

commit 81b07c7dad26320b22f5ed85e98247f2fc7890a3
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 06:26:22 2016 +0000

    Use Status = '__Active__' for OnlySearchActiveTicketsInSimpleSearch

diff --git a/lib/RT/Search/Simple.pm b/lib/RT/Search/Simple.pm
index 6fad6be..ac44252 100644
--- a/lib/RT/Search/Simple.pm
+++ b/lib/RT/Search/Simple.pm
@@ -188,7 +188,7 @@ sub Finalize {
     # limits ourselves, and we're not limited by id
     if (not $limits->{status} and not $limits->{id}
         and RT::Config->Get('OnlySearchActiveTicketsInSimpleSearch', $self->TicketsObj->CurrentUser)) {
-        $limits->{status} = [map {s/(['\\])/\\$1/g; "Status = '$_'"} RT::Queue->ActiveStatusArray()];
+        $limits->{status} = ["Status = '__Active__'"];
     }
 
     # Respect the "only search these queues" limit if we didn't
diff --git a/t/ticket/simple_search.t b/t/ticket/simple_search.t
index 02bf733..bdd51b4 100644
--- a/t/ticket/simple_search.t
+++ b/t/ticket/simple_search.t
@@ -22,20 +22,18 @@ ok( $id, $msg );
 
 use_ok("RT::Search::Simple");
 
-my $active_statuses = join( " OR ", map "Status = '$_'", RT::Queue->ActiveStatusArray());
-
 my $tickets = RT::Tickets->new(RT->SystemUser);
 my $quick = RT::Search::Simple->new(Argument => "",
                                  TicketsObj => $tickets);
 my @tests = (
     "General new open root"     => "( Owner = 'root' ) AND ( Queue = 'General' ) AND ( Status = 'new' OR Status = 'open' )", 
-    "General"              => "( Queue = 'General' ) AND ( $active_statuses )",
+    "General"              => "( Queue = 'General' ) AND ( Status = '__Active__' )",
     "General any"          => "( Queue = 'General' )",
-    "fulltext:jesse"       => "( Content LIKE 'jesse' ) AND ( $active_statuses )",
-    $queue                 => "( Queue = '$queue' ) AND ( $active_statuses )",
-    "root $queue"          => "( Owner = 'root' ) AND ( Queue = '$queue' ) AND ( $active_statuses )",
-    "notauser $queue"      => "( Subject LIKE 'notauser' ) AND ( Queue = '$queue' ) AND ( $active_statuses )",
-    "notauser $queue root" => "( Subject LIKE 'notauser' ) AND ( Owner = 'root' ) AND ( Queue = '$queue' ) AND ( $active_statuses )");
+    "fulltext:jesse"       => "( Content LIKE 'jesse' ) AND ( Status = '__Active__' )",
+    $queue                 => "( Queue = '$queue' ) AND ( Status = '__Active__' )",
+    "root $queue"          => "( Owner = 'root' ) AND ( Queue = '$queue' ) AND ( Status = '__Active__' )",
+    "notauser $queue"      => "( Subject LIKE 'notauser' ) AND ( Queue = '$queue' ) AND ( Status = '__Active__' )",
+    "notauser $queue root" => "( Subject LIKE 'notauser' ) AND ( Owner = 'root' ) AND ( Queue = '$queue' ) AND ( Status = '__Active__' )");
 
 while (my ($from, $to) = splice @tests, 0, 2) {
     is($quick->QueryToSQL($from), $to, "<$from> -> <$to>");
diff --git a/t/web/simple_search.t b/t/web/simple_search.t
index bdfaacb..41ba6a4 100644
--- a/t/web/simple_search.t
+++ b/t/web/simple_search.t
@@ -18,47 +18,45 @@ ok $two_words_queue && $two_words_queue->id, 'loaded or created a queue';
 
 {
     my $tickets = RT::Tickets->new( RT->SystemUser );
-    my $active = "( ".join( " OR ", map "Status = '$_'", RT::Queue->ActiveStatusArray())." )";
-    my $inactive = "( ".join( " OR ", map "Status = '$_'", RT::Queue->InactiveStatusArray())." )";
 
     require RT::Search::Simple;
     my $parser = RT::Search::Simple->new(
         TicketsObj => $tickets,
         Argument   => '',
     );
-    is $parser->QueryToSQL("foo"), "( Subject LIKE 'foo' ) AND $active", "correct parsing";
-    is $parser->QueryToSQL("1 foo"), "( Subject LIKE 'foo' AND Subject LIKE '1' ) AND $active", "correct parsing";
+    is $parser->QueryToSQL("foo"), "( Subject LIKE 'foo' ) AND ( Status = '__Active__' )", "correct parsing";
+    is $parser->QueryToSQL("1 foo"), "( Subject LIKE 'foo' AND Subject LIKE '1' ) AND ( Status = '__Active__' )", "correct parsing";
     is $parser->QueryToSQL("1"), "( Id = 1 )", "correct parsing";
     is $parser->QueryToSQL("#1"), "( Id = 1 )", "correct parsing";
-    is $parser->QueryToSQL("'1'"), "( Subject LIKE '1' ) AND $active", "correct parsing";
+    is $parser->QueryToSQL("'1'"), "( Subject LIKE '1' ) AND ( Status = '__Active__' )", "correct parsing";
 
     is $parser->QueryToSQL("foo bar"),
-        "( Subject LIKE 'foo' AND Subject LIKE 'bar' ) AND $active",
+        "( Subject LIKE 'foo' AND Subject LIKE 'bar' ) AND ( Status = '__Active__' )",
         "correct parsing";
     is $parser->QueryToSQL("'foo bar'"),
-        "( Subject LIKE 'foo bar' ) AND $active",
+        "( Subject LIKE 'foo bar' ) AND ( Status = '__Active__' )",
         "correct parsing";
 
     is $parser->QueryToSQL("'foo \\' bar'"),
-        "( Subject LIKE 'foo \\' bar' ) AND $active",
+        "( Subject LIKE 'foo \\' bar' ) AND ( Status = '__Active__' )",
         "correct parsing";
     is $parser->QueryToSQL('"foo \' bar"'),
-        "( Subject LIKE 'foo \\' bar' ) AND $active",
+        "( Subject LIKE 'foo \\' bar' ) AND ( Status = '__Active__' )",
         "correct parsing";
     is $parser->QueryToSQL('"\f\o\o"'),
-        "( Subject LIKE '\\\\f\\\\o\\\\o' ) AND $active",
+        "( Subject LIKE '\\\\f\\\\o\\\\o' ) AND ( Status = '__Active__' )",
         "correct parsing";
 
-    is $parser->QueryToSQL("General"), "( Queue = 'General' ) AND $active", "correct parsing";
-    is $parser->QueryToSQL("'Two Words'"), "( Subject LIKE 'Two Words' ) AND $active", "correct parsing";
-    is $parser->QueryToSQL("queue:'Two Words'"), "( Queue = 'Two Words' ) AND $active", "correct parsing";
-    is $parser->QueryToSQL("subject:'Two Words'"), "$active AND ( Subject LIKE 'Two Words' )", "correct parsing";
+    is $parser->QueryToSQL("General"), "( Queue = 'General' ) AND ( Status = '__Active__' )", "correct parsing";
+    is $parser->QueryToSQL("'Two Words'"), "( Subject LIKE 'Two Words' ) AND ( Status = '__Active__' )", "correct parsing";
+    is $parser->QueryToSQL("queue:'Two Words'"), "( Queue = 'Two Words' ) AND ( Status = '__Active__' )", "correct parsing";
+    is $parser->QueryToSQL("subject:'Two Words'"), "( Status = '__Active__' ) AND ( Subject LIKE 'Two Words' )", "correct parsing";
 
-    is $parser->QueryToSQL("me"), "( Owner.id = '__CurrentUser__' ) AND $active", "correct parsing";
-    is $parser->QueryToSQL("'me'"), "( Subject LIKE 'me' ) AND $active", "correct parsing";
-    is $parser->QueryToSQL("owner:me"), "( Owner.id = '__CurrentUser__' ) AND $active", "correct parsing";
-    is $parser->QueryToSQL("owner:'me'"), "( Owner = 'me' ) AND $active", "correct parsing";
-    is $parser->QueryToSQL('owner:root at localhost'), "( Owner.EmailAddress = 'root\@localhost' ) AND $active", "Email address as owner";
+    is $parser->QueryToSQL("me"), "( Owner.id = '__CurrentUser__' ) AND ( Status = '__Active__' )", "correct parsing";
+    is $parser->QueryToSQL("'me'"), "( Subject LIKE 'me' ) AND ( Status = '__Active__' )", "correct parsing";
+    is $parser->QueryToSQL("owner:me"), "( Owner.id = '__CurrentUser__' ) AND ( Status = '__Active__' )", "correct parsing";
+    is $parser->QueryToSQL("owner:'me'"), "( Owner = 'me' ) AND ( Status = '__Active__' )", "correct parsing";
+    is $parser->QueryToSQL('owner:root at localhost'), "( Owner.EmailAddress = 'root\@localhost' ) AND ( Status = '__Active__' )", "Email address as owner";
 
     is $parser->QueryToSQL("resolved me"), "( Owner.id = '__CurrentUser__' ) AND ( Status = 'resolved' )", "correct parsing";
     is $parser->QueryToSQL("resolved active me"), "( Owner.id = '__CurrentUser__' ) AND ( Status = 'resolved' OR Status = '__Active__' )", "correct parsing";
@@ -66,8 +64,8 @@ ok $two_words_queue && $two_words_queue->id, 'loaded or created a queue';
     is $parser->QueryToSQL("status:'active'"), "( Status = 'active' )", "Quoting active makes it the actual word";
     is $parser->QueryToSQL("inactive me"), "( Owner.id = '__CurrentUser__' ) AND ( Status = '__Inactive__' )", "correct parsing";
 
-    is $parser->QueryToSQL("cf.Foo:bar"), "( 'CF.{Foo}' LIKE 'bar' ) AND $active", "correct parsing of CFs";
-    is $parser->QueryToSQL(q{cf."don't foo?":'bar n\\' baz'}), qq/( 'CF.{don\\'t foo?}' LIKE 'bar n\\' baz' ) AND $active/, "correct parsing of CFs with quotes";
+    is $parser->QueryToSQL("cf.Foo:bar"), "( 'CF.{Foo}' LIKE 'bar' ) AND ( Status = '__Active__' )", "correct parsing of CFs";
+    is $parser->QueryToSQL(q{cf."don't foo?":'bar n\\' baz'}), qq/( 'CF.{don\\'t foo?}' LIKE 'bar n\\' baz' ) AND ( Status = '__Active__' )/, "correct parsing of CFs with quotes";
 }
 
 my $ticket_found_1 = RT::Ticket->new($RT::SystemUser);

commit 0e579707289d98a31da2aa07a9dbfa721d85dbb6
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 06:29:56 2016 +0000

    Use Status = '__Active__' for self service queries

diff --git a/share/html/SelfService/Closed.html b/share/html/SelfService/Closed.html
index fdce958..822733a 100644
--- a/share/html/SelfService/Closed.html
+++ b/share/html/SelfService/Closed.html
@@ -49,7 +49,7 @@
 
 <& /SelfService/Elements/MyRequests,
     %ARGS,
-    status          => [ RT::Queue->InactiveStatusArray ],
+    status          => '__Inactive__',
     title           => loc('My closed tickets'),
     BaseURL         => RT->Config->Get('WebPath') ."/SelfService/Closed.html?",
     Page            => $Page,
diff --git a/share/html/SelfService/Elements/MyRequests b/share/html/SelfService/Elements/MyRequests
index d0b04c3..8a988d0 100644
--- a/share/html/SelfService/Elements/MyRequests
+++ b/share/html/SelfService/Elements/MyRequests
@@ -62,16 +62,18 @@
 $title ||= loc("My [_1] tickets", $friendly_status);
 my $id = $session{'CurrentUser'}->id;
 my $Query = "( Watcher.id = $id )";
-if ( @status ) {
-    @status = map {s/(['\\])/\\$1/g; "Status = '$_'"} @status;
-    $Query .= " AND ( " . join(' OR ', @status ) . " )";
+
+if ($status) {
+    $status =~ s/(['\\])/\\$1/g;
+    $Query .= " AND Status = '$status'";
 }
+
 my $Format = RT->Config->Get('DefaultSelfServiceSearchResultFormat');
 </%INIT>
 <%ARGS>
 $title => undef
 $friendly_status => loc('open')
- at status => ()
+$status => undef
 $BaseURL => undef
 $Page => 1
 @Order => ('ASC')
diff --git a/share/html/SelfService/index.html b/share/html/SelfService/index.html
index c5aad9f..6f3251d 100644
--- a/share/html/SelfService/index.html
+++ b/share/html/SelfService/index.html
@@ -48,7 +48,7 @@
 <& /SelfService/Elements/Header, Title => loc('Open tickets') &>
 <& /SelfService/Elements/MyRequests,
     %ARGS,
-    status          => [ RT::Queue->ActiveStatusArray() ],
+    status  => '__Active__',
     title   => loc('My open tickets'),
     BaseURL => RT->Config->Get('WebPath') ."/SelfService/?",
     Page    => $Page, 

commit 276567fa59a41328a5a6638c403c241d6063f417
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 06:31:49 2016 +0000

    Use Status = '__Active__' for requestor ticket lists
    
        The condition's "name" is unused.

diff --git a/share/html/Ticket/Elements/ShowRequestorTicketsActive b/share/html/Ticket/Elements/ShowRequestorTicketsActive
index 3d945bc..99adba1 100644
--- a/share/html/Ticket/Elements/ShowRequestorTicketsActive
+++ b/share/html/Ticket/Elements/ShowRequestorTicketsActive
@@ -48,9 +48,7 @@
 <& ShowRequestorTickets, %ARGS, Description => loc('active'), conditions => $conditions, Rows => $Rows  &>
 <%INIT>
 unless ( @$conditions ) {
-    foreach (RT::Queue->ActiveStatusArray()) {
-        push @$conditions, { cond => "Status = '$_'", name => loc($_) };
-    }
+    push @$conditions, { cond => "Status = '__Active__'" };
 }
 </%INIT>
 <%ARGS>
diff --git a/share/html/Ticket/Elements/ShowRequestorTicketsInactive b/share/html/Ticket/Elements/ShowRequestorTicketsInactive
index eb08c4c..fa8e6df 100644
--- a/share/html/Ticket/Elements/ShowRequestorTicketsInactive
+++ b/share/html/Ticket/Elements/ShowRequestorTicketsInactive
@@ -48,9 +48,7 @@
 <& ShowRequestorTickets, %ARGS, Description => loc('inactive'), conditions => $conditions, Rows => $Rows &>
 <%INIT>
 unless ( @$conditions ) {
-    foreach (RT::Queue->InactiveStatusArray()) {
-        push @$conditions, { cond => "Status = '$_'", name => loc($_) };
-    }
+    push @$conditions, { cond => "Status = '__Inactive__'" };
 }
 </%INIT>
 <%ARGS>

commit ced56fbbd8951dcea234fee4b7f24b318260086b
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 06:35:24 2016 +0000

    Use Status = '__Active__' for user ticket portlets
    
        The condition's "name" is unused.

diff --git a/share/html/User/Elements/Portlets/ActiveTickets b/share/html/User/Elements/Portlets/ActiveTickets
index 8ed8c58..665ae7d 100644
--- a/share/html/User/Elements/Portlets/ActiveTickets
+++ b/share/html/User/Elements/Portlets/ActiveTickets
@@ -58,9 +58,7 @@
 &>
 <%INIT>
 unless ( @$conditions ) {
-    foreach (RT::Queue->ActiveStatusArray()) {
-        push @$conditions, { cond => "Status = '$_'", name => loc($_) };
-    }
+    push @$conditions, { cond => "Status = '__Active__'" };
 }
 </%INIT>
 <%ARGS>
diff --git a/share/html/User/Elements/Portlets/InactiveTickets b/share/html/User/Elements/Portlets/InactiveTickets
index a768427..7507fe0 100644
--- a/share/html/User/Elements/Portlets/InactiveTickets
+++ b/share/html/User/Elements/Portlets/InactiveTickets
@@ -58,9 +58,7 @@
 &>
 <%INIT>
 unless ( @$conditions ) {
-    foreach (RT::Queue->InactiveStatusArray()) {
-        push @$conditions, { cond => "Status = '$_'", name => loc($_) };
-    }
+    push @$conditions, { cond => "Status = '__Inactive__'" };
 }
 </%INIT>
 <%ARGS>

commit 170cefb09805403c952136b5015edead57c879b0
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Thu Feb 18 18:30:57 2016 -0500

    Use Status = '__Active__' for reminders
    
    Fixes: I#31178

diff --git a/share/html/Elements/ShowReminders b/share/html/Elements/ShowReminders
index 2101a26..460e1e7 100644
--- a/share/html/Elements/ShowReminders
+++ b/share/html/Elements/ShowReminders
@@ -90,7 +90,7 @@ if ( my $ticket= $targets->First ) {
 my $reminders = RT::Tickets->new($session{'CurrentUser'});
 my $tsql = 'Type = "reminder"' .
            ' AND ( Owner = "Nobody" OR Owner ="' . $session{'CurrentUser'}->id . '")' .
-           ' AND ( Status = "new" OR Status = "open" )';
+           ' AND Status = "__Active__"';
 
 $tsql .= ' AND ( Due < "now" OR Due IS NULL )' if $OnlyOverdue;
 

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


More information about the rt-commit mailing list