[Rt-commit] rt branch, 4.0/skip-empty-orderby-items, created. rt-4.0.4-138-g328ca2f
Jason May
jasonmay at bestpractical.com
Fri Dec 16 18:22:21 EST 2011
The branch, 4.0/skip-empty-orderby-items has been created
at 328ca2ff1a79fad7601e3245ec37518381e0081d (commit)
- Log -----------------------------------------------------------------
commit 328ca2ff1a79fad7601e3245ec37518381e0081d
Author: Jason May <jasonmay at bestpractical.com>
Date: Fri Dec 16 18:09:47 2011 -0500
When searching, skip empty OrderBy fields
This prevents...
Order By: AdminCC.EmailAddress
FinalPriority
[none]
Due
... from making DBIx::SB generate erroneous SQL with blank fields.
diff --git a/share/html/Elements/CollectionList b/share/html/Elements/CollectionList
index 765eeff..bb0b695 100644
--- a/share/html/Elements/CollectionList
+++ b/share/html/Elements/CollectionList
@@ -68,7 +68,7 @@ if ( $Rows ) {
# collection is ordered or not
if ( @OrderBy && ($AllowSorting || !$Collection->{'order_by'}) ) {
if ( $OrderBy[0] =~ /\|/ ) {
- @OrderBy = split /\|/, $OrderBy[0];
+ @OrderBy = grep length($_), split /\|/, $OrderBy[0];
@Order = split /\|/,$Order[0];
}
$Collection->OrderByCols(
diff --git a/t/web/search_order_by.t b/t/web/search_order_by.t
new file mode 100644
index 0000000..09ecf55
--- /dev/null
+++ b/t/web/search_order_by.t
@@ -0,0 +1,29 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use RT::Test tests => undef;
+
+# TODO generalize this into a series of (currently
+# unwritten) Advanced Search tests
+
+
+my $ticket = RT::Test->create_ticket(
+ Subject => 'test ticket',
+ Queue => 'General',
+);
+
+my ( $baseurl, $m ) = RT::Test->started_ok;
+ok $m->login, 'logged in as root';
+
+# Create a ticket with content and an attachment
+$m->get_ok( $baseurl . '/Search/Build.html' );
+
+$m->form_name('BuildQuery');
+$m->field(OrderBy => 'id||Due');
+$m->field(Query => 'id > 0');
+$m->click_button(name => 'DoSearch');
+
+$m->text_contains('Found 1 ticket');
+
+undef $m;
+done_testing();
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list