[Rt-commit] r3870 - in rt/branches/3.5-TESTING: . html/Elements
html/Search html/Search/Elements lib/RT lib/t/regression
robert at bestpractical.com
robert at bestpractical.com
Thu Sep 22 02:01:29 EDT 2005
Author: robert
Date: Thu Sep 22 02:01:28 2005
New Revision: 3870
Added:
rt/branches/3.5-TESTING/lib/t/regression/23cfsort.t (contents, props changed)
rt/branches/3.5-TESTING/lib/t/regression/24pawsort.t (contents, props changed)
Modified:
rt/branches/3.5-TESTING/ (props changed)
rt/branches/3.5-TESTING/html/Elements/TicketList
rt/branches/3.5-TESTING/html/Search/Build.html
rt/branches/3.5-TESTING/html/Search/Elements/DisplayOptions
rt/branches/3.5-TESTING/html/Search/Results.html
rt/branches/3.5-TESTING/lib/RT/Tickets_Overlay.pm
Log:
r3904 at bear: rspier | 2005-09-21 22:27:01 -0700
local branch for 3.5
r3905 at bear: rspier | 2005-09-21 23:01:01 -0700
- Sort By CustomField
- Sort by multiple fields in UI
- Ownership/PAW support
and tests for both
Modified: rt/branches/3.5-TESTING/html/Elements/TicketList
==============================================================================
--- rt/branches/3.5-TESTING/html/Elements/TicketList (original)
+++ rt/branches/3.5-TESTING/html/Elements/TicketList Thu Sep 22 02:01:28 2005
@@ -140,8 +140,17 @@
}
}
+if ($OrderBy =~ /\|/) {
+ # Multiple Sorts
+ my @OrderBy = split /\|/,$OrderBy;
+ my @Order = split /\|/,$Order;
+ $Collection->OrderByCols(
+ map { { FIELD => $OrderBy[$_], ORDER => $Order[$_] } } ( 0
+ .. $#OrderBy ) );;
+} else {
+ $Collection->OrderBy(FIELD => $OrderBy, ORDER => $Order);
+}
-$Collection->OrderBy(FIELD => $OrderBy, ORDER => $Order);
$Collection->RowsPerPage($Rows) if ($Rows);
$Collection->GotoPage($Page-1); # SB uses page 0 as the first page
my $TotalFound = $Collection->CountAll();
Modified: rt/branches/3.5-TESTING/html/Search/Build.html
==============================================================================
--- rt/branches/3.5-TESTING/html/Search/Build.html (original)
+++ rt/branches/3.5-TESTING/html/Search/Build.html Thu Sep 22 02:01:28 2005
@@ -144,6 +144,13 @@
# }}}
+if (ref $OrderBy eq "ARRAY") {
+ $OrderBy = join("|", @$OrderBy);
+}
+if (ref $Order eq "ARRAY") {
+ $Order = join("|", @$Order);
+}
+
# {{{ Attempt to load what we can from the session, set defaults
# We don't read or write to the session again until the end
Modified: rt/branches/3.5-TESTING/html/Search/Elements/DisplayOptions
==============================================================================
--- rt/branches/3.5-TESTING/html/Search/Elements/DisplayOptions (original)
+++ rt/branches/3.5-TESTING/html/Search/Elements/DisplayOptions Thu Sep 22 02:01:28 2005
@@ -51,15 +51,23 @@
</td>
<td valign=top>
<table valign=top>
+
+% for my $o (0..3) {
<tr>
<td class=label>
+% if ($o == 0) {
<&|/l&>Order by</&>:
-</td><td class=value>
+% }
+</td>
+<td class=value>
<select name="OrderBy">
-% foreach my $field (keys %fields) {
+% if ($o > 0) {
+<option value="">[none]</option>
+% }
+% foreach my $field (sort keys %fields) {
% next unless $field;
<option value=<%$field%>
-% if ($field =~ /^$OrderBy$/i) {
+% if ($field eq $OrderBy[$o]) {
SELECTED
% }
><&|/l&><%$field%></&></option>
@@ -67,18 +75,19 @@
</select>
<select name="Order">
<option value="ASC"
-% if ($Order eq "ASC") {
+% if ($Order[$o] eq "ASC") {
SELECTED
% }
-><&|/l&>Ascending</&></option>
+><&|/l&>Asc</&></option>
<option value="DESC"
-% if ($Order eq "DESC") {
+% if ($Order[$o] eq "DESC") {
SELECTED
% }
-><&|/l&>Descending</&></option>
+><&|/l&>Desc</&></option>
</select>
</td>
</tr>
+% }
<tr>
<td class=label>
<&|/l&>Rows per page</&>:
@@ -101,6 +110,23 @@
delete $fields{'EffectiveId'};
$fields{ $_ . '.EmailAddress' } = 1 foreach( qw(Requestor Cc AdminCc) );
+# Add all available CustomFields to the list of sortable columns.
+my @cfs = grep /^CustomField/, @{$ARGS{AvailableColumns}};
+$fields{$_}=1 for @cfs;
+
+# Add PAW sort
+$fields{'Custom.Ownership'} = 1;
+
+my @Order;
+my @OrderBy;
+if ($OrderBy =~ /\|/) {
+ @Order = split /\|/, $Order;
+ @OrderBy = split /\|/, $OrderBy;
+} else {
+ @Order = ( $Order );
+ @OrderBy = ( $OrderBy );
+}
+
</%INIT>
Modified: rt/branches/3.5-TESTING/html/Search/Results.html
==============================================================================
--- rt/branches/3.5-TESTING/html/Search/Results.html (original)
+++ rt/branches/3.5-TESTING/html/Search/Results.html Thu Sep 22 02:01:28 2005
@@ -118,8 +118,17 @@
$session{'i'}++;
$session{'tickets'} = RT::Tickets->new($session{'CurrentUser'}) ;
$session{'tickets'}->FromSQL($Query) if ($Query);
-$session{'tickets'}->OrderBy(FIELD => $OrderBy, ORDER => $Order);
+if ($OrderBy =~ /\|/) {
+ # Multiple Sorts
+ my @OrderBy = split /\|/,$OrderBy;
+ my @Order = split /\|/,$Order;
+ $session{'tickets'}->OrderByCols(
+ map { { FIELD => $OrderBy[$_], ORDER => $Order[$_] } } ( 0
+ .. $#OrderBy ) );;
+} else {
+ $session{'tickets'}->OrderBy(FIELD => $OrderBy, ORDER => $Order);
+}
$session{'CurrentSearchHash'} = {
Format => $Format,
@@ -131,7 +140,6 @@
};
-
if ( $session{'tickets'}->Query()) {
$ticketcount = $session{tickets}->CountAll();
$title = loc('Found [quant,_1,ticket]', $ticketcount);
@@ -152,7 +160,6 @@
if ($ARGS{'TicketsRefreshInterval'}) {
$session{'tickets_refresh_interval'} = $ARGS{'TicketsRefreshInterval'};
}
-
</%INIT>
<%CLEANUP>
$session{'tickets'}->PrepForSerialization();
Modified: rt/branches/3.5-TESTING/lib/RT/Tickets_Overlay.pm
==============================================================================
--- rt/branches/3.5-TESTING/lib/RT/Tickets_Overlay.pm (original)
+++ rt/branches/3.5-TESTING/lib/RT/Tickets_Overlay.pm Thu Sep 22 02:01:28 2005
@@ -138,6 +138,7 @@
Watcher => [ 'WATCHERFIELD', ],
LinkedTo => [ 'LINKFIELD', ],
CustomFieldValue => [ 'CUSTOMFIELD', ],
+ CustomField => [ 'CUSTOMFIELD', ],
CF => [ 'CUSTOMFIELD', ],
Updated => [ 'TRANSDATE', ],
RequestorGroup => [ 'MEMBERSHIPFIELD' => 'Requestor', ],
@@ -1065,63 +1066,57 @@
}
}
-=head2 KeywordLimit
-Limit based on Keywords
+=head2 _CustomFieldDecipher
-Meta Data:
- none
+Try and turn a CF descriptor into (cfid, cfname) object pair.
=cut
-sub _CustomFieldLimit {
- my ( $self, $_field, $op, $value, @rest ) = @_;
+sub _CustomFieldDecipher {
+ my ($self, $field) = @_;
- my %rest = @rest;
- my $field = $rest{SUBKEY} || die "No field specified";
+ my $queue = 0;
- # For our sanity, we can only limit on one queue at a time
- my $queue = 0;
+ if ( $field =~ /^(.+?)\.{(.+)}$/ ) {
+ $queue = $1;
+ $field = $2;
+ }
+ $field = $1 if $field =~ /^{(.+)}$/; # trim { }
- if ( $field =~ /^(.+?)\.{(.+)}$/ ) {
- $queue = $1;
- $field = $2;
- }
- $field = $1 if $field =~ /^{(.+)}$/; # trim { }
+ my $cfid;
+ if ($queue) {
+ my $q = RT::Queue->new( $self->CurrentUser );
+ $q->Load($queue) if ($queue);
-# If we're trying to find custom fields that don't match something, we
-# want tickets where the custom field has no value at all. Note that
-# we explicitly don't include the "IS NULL" case, since we would
-# otherwise end up with a redundant clause.
-
- my $null_columns_ok;
- if ( ( $op =~ /^NOT LIKE$/i ) or ( $op eq '!=' ) ) {
- $null_columns_ok = 1;
+ my $cf;
+ if ( $q->id ) {
+ # $queue = $q->Name; # should we normalize the queue?
+ $cf = $q->CustomField($field);
+ }
+ else {
+ $cf = RT::CustomField->new( $self->CurrentUser );
+ $cf->LoadByNameAndQueue( Queue => '0', Name => $field );
}
+ $cfid = $cf->id if $cf;
+ }
- my $cfid = 0;
- if ($queue) {
+ return ($queue, $field, $cfid);
- my $q = RT::Queue->new( $self->CurrentUser );
- $q->Load($queue) if ($queue);
+}
- my $cf;
- if ( $q->id ) {
- $cf = $q->CustomField($field);
- }
- else {
- $cf = RT::CustomField->new( $self->CurrentUser );
- $cf->LoadByNameAndQueue( Queue => '0', Name => $field );
- }
- $cfid = $cf->id;
+=head2 _CustomFieldJoin
- }
+Factor out the Join of custom fields so we can use it for sorting too
- my $TicketCFs;
- my $cfkey = $cfid ? $cfid : "$queue.$field";
+=cut
+
+sub _CustomFieldJoin {
+ my ($self, $cfkey, $cfid, $field) = @_;
+ my $TicketCFs;
# Perform one Join per CustomField
if ( $self->{_sql_object_cf_alias}{$cfkey} ) {
$TicketCFs = $self->{_sql_object_cf_alias}{$cfkey};
@@ -1178,6 +1173,42 @@
ENTRYAGGREGATOR => 'AND');
}
+
+ return $TicketCFs;
+}
+
+=head2 _CustomFieldLimit
+
+Limit based on CustomFields
+
+Meta Data:
+ none
+
+=cut
+
+sub _CustomFieldLimit {
+ my ( $self, $_field, $op, $value, @rest ) = @_;
+
+ my %rest = @rest;
+ my $field = $rest{SUBKEY} || die "No field specified";
+
+ # For our sanity, we can only limit on one queue at a time
+
+ my ($queue, $field, $cfid ) = $self->_CustomFieldDecipher( $field );
+
+# If we're trying to find custom fields that don't match something, we
+# want tickets where the custom field has no value at all. Note that
+# we explicitly don't include the "IS NULL" case, since we would
+# otherwise end up with a redundant clause.
+
+ my $null_columns_ok;
+ if ( ( $op =~ /^NOT LIKE$/i ) or ( $op eq '!=' ) ) {
+ $null_columns_ok = 1;
+ }
+
+ my $cfkey = $cfid ? $cfid : "$queue.$field";
+ my $TicketCFs = $self->_CustomFieldJoin( $cfkey, $cfid, $field );
+
$self->_OpenParen if ($null_columns_ok);
$self->_SQLLimit(
@@ -1230,11 +1261,64 @@
push @res, $row;
next;
}
- my ($field, $subkey) = split /\./, $row->{FIELD};
+ my ($field, $subkey) = split /\./, $row->{FIELD}, 2;
my $meta = $self->FIELDS->{ $field };
if( $meta->[0] eq 'WATCHERFIELD' ) {
my $users = $self->_WatcherJoin( $meta->[1], "order".$order++ );
push @res, { %$row, ALIAS => $users, FIELD => $subkey };
+ } elsif ( $meta->[0] eq 'CUSTOMFIELD' ) {
+ my ($queue, $field, $cfid ) = $self->_CustomFieldDecipher( $subkey );
+ my $cfkey = $cfid ? $cfid : "$queue.$field";
+ my $TicketCFs = $self->_CustomFieldJoin( $cfkey, $cfid, $field );
+ unless ($cfid) {
+ # For those cases where we are doing a join against the
+ # CF name, and don't have a CFid, use Unique to make sure
+ # we don't show duplicate tickets. NOTE: I'm pretty sure
+ # this will stay mixed in for the life of the
+ # class/package, and not just for the life of the object.
+ # Potential performance issue.
+ require DBIx::SearchBuilder::Unique;
+ DBIx::SearchBuilder::Unique->import;
+ }
+ my $CFvs = $self->Join(
+ TYPE => 'left',
+ ALIAS1 => $TicketCFs,
+ FIELD1 => 'CustomField',
+ TABLE2 => 'CustomFieldValues',
+ FIELD2 => 'CustomField',
+ );
+ $self->SUPER::Limit(
+ LEFTJOIN => $CFvs,
+ FIELD => 'Name',
+ QUOTEVALUE => 0,
+ VALUE => $TicketCFs . ".Content",
+ ENTRYAGGREGATOR => 'AND'
+ );
+
+ push @res, { %$row, ALIAS => $CFvs, FIELD => 'SortOrder' };
+ push @res, { %$row, ALIAS => $TicketCFs, FIELD => 'Content' };
+ } elsif ( $field eq "Custom" && $subkey eq "Ownership") {
+ # PAW logic is "reversed"
+ my $order = "ASC";
+ if (exists $row->{ORDER} ) {
+ my $o = $row->{ORDER};
+ delete $row->{ORDER};
+ $order = "DESC" if $o =~ /asc/i;
+ }
+
+ # Unowned
+ # Else
+
+ # Ticket.Owner 1 0 0
+ my $ownerId = $self->CurrentUser->Id;
+ push @res, { %$row, FIELD => "Owner=$ownerId", ORDER => $order } ;
+
+ # Unowned Tickets 0 1 0
+ my $nobodyId = $RT::Nobody->Id;
+ push @res, { %$row, FIELD => "Owner=$nobodyId", ORDER => $order } ;
+
+ push @res, { %$row, FIELD => "Priority", ORDER => $order } ;
+
} else {
push @res, $row;
}
@@ -2575,10 +2659,8 @@
delete $self->{'raw_rows'};
delete $self->{'rows'};
delete $self->{'count_all'};
-
my $sql = $self->Query; # Violating the _SQL namespace
if ( !$sql || $self->{'RecalcTicketLimits'} ) {
-
# "Restrictions to Clauses Branch\n";
my $clauseRef = eval { $self->_RestrictionsToClauses; };
if ($@) {
Added: rt/branches/3.5-TESTING/lib/t/regression/23cfsort.t
==============================================================================
--- (empty file)
+++ rt/branches/3.5-TESTING/lib/t/regression/23cfsort.t Thu Sep 22 02:01:28 2005
@@ -0,0 +1,139 @@
+#!/home/perl/bin/perl
+
+use Test::More qw/no_plan/;
+use RT;
+RT::LoadConfig();
+RT::Init();
+
+use strict;
+use warnings;
+
+use RT::Tickets;
+use RT::Queue;
+use RT::CustomField;
+
+my($ret,$msg);
+
+
+# Test Sorting by custom fields.
+
+# ---- Create a queue to test with.
+my $queue = "CFSortQueue-$$";
+my $queue_obj = RT::Queue->new($RT::SystemUser);
+($ret, $msg) = $queue_obj->Create(Name => $queue,
+ Description => 'queue for custom field sort testing');
+ok($ret, "$queue test queue creation. $msg");
+
+# ---- Create some custom fields. We're not currently using all of
+# them to test with, but the more the merrier.
+my $cfO = RT::CustomField->new($RT::SystemUser);
+my $cfA = RT::CustomField->new($RT::SystemUser);
+my $cfB = RT::CustomField->new($RT::SystemUser);
+my $cfC = RT::CustomField->new($RT::SystemUser);
+
+($ret, $msg) = $cfO->Create( Name => 'Order',
+ Queue => 0,
+ SortOrder => 1,
+ Description => q[Something to compare results for, since we can't guarantee ticket ID],
+ Type=> 'FreeformSingle');
+ok($ret, "Custom Field Order created");
+
+($ret, $msg) = $cfA->Create( Name => 'Alpha',
+ Queue => $queue_obj->id,
+ SortOrder => 1,
+ Description => 'A Testing custom field',
+ Type=> 'FreeformSingle');
+ok($ret, "Custom Field Alpha created");
+
+($ret, $msg) = $cfB->Create( Name => 'Beta',
+ Queue => $queue_obj->id,
+ Description => 'A Testing custom field',
+ Type=> 'FreeformSingle');
+ok($ret, "Custom Field Beta created");
+
+($ret, $msg) = $cfC->Create( Name => 'Charlie',
+ Queue => $queue_obj->id,
+ Description => 'A Testing custom field',
+ Type=> 'FreeformSingle');
+ok($ret, "Custom Field Charlie created");
+
+# ----- Create some tickets to test with. Assign them some values to
+# make it easy to sort with.
+my $t1 = RT::Ticket->new($RT::SystemUser);
+$t1->Create( Queue => $queue_obj->Id,
+ Subject => 'One',
+ );
+$t1->AddCustomFieldValue(Field => $cfO->Id, Value => '1');
+$t1->AddCustomFieldValue(Field => $cfA->Id, Value => '2');
+$t1->AddCustomFieldValue(Field => $cfB->Id, Value => '1');
+$t1->AddCustomFieldValue(Field => $cfC->Id, Value => 'BBB');
+
+my $t2 = RT::Ticket->new($RT::SystemUser);
+$t2->Create( Queue => $queue_obj->Id,
+ Subject => 'Two',
+ );
+$t2->AddCustomFieldValue(Field => $cfO->Id, Value => '2');
+$t2->AddCustomFieldValue(Field => $cfA->Id, Value => '1');
+$t2->AddCustomFieldValue(Field => $cfB->Id, Value => '2');
+$t2->AddCustomFieldValue(Field => $cfC->Id, Value => 'AAA');
+
+# helper
+sub check_order {
+ my ($tx, @order) = @_;
+ my @results;
+ while (my $t = $tx->Next) {
+ push @results, $t->CustomFieldValues($cfO->Id)->First->Content;
+ }
+ my $results = join (" ", at results);
+ my $order = join(" ", at order);
+ is( $results, $order );
+}
+
+# The real tests start here
+my $tx = new RT::Tickets( $RT::SystemUser );
+
+
+# Make sure we can sort in both directions on a queue specific field.
+$tx->FromSQL(qq[queue="$queue"] );
+$tx->OrderBy( FIELD => "CF.${queue}.{Charlie}", ORDER => 'DES' );
+is($tx->Count,2);
+check_order( $tx, 1, 2);
+
+$tx->FromSQL(qq[queue="$queue"] );
+$tx->OrderBy( FIELD => "CF.${queue}.{Charlie}", ORDER => 'ASC' );
+is($tx->Count,2);
+check_order( $tx, 2, 1);
+
+# When ordering by _global_ CustomFields, if more than one queue has a
+# CF named Charlie, things will go bad. So, these results are uniqued
+# in Tickets_Overlay.
+$tx->FromSQL(qq[queue="$queue"] );
+$tx->OrderBy( FIELD => "CF.{Charlie}", ORDER => 'DES' );
+is($tx->Count,2);
+check_order( $tx, 1, 2);
+
+# Add a new ticket, to test sorting on multiple columns.
+my $t3 = RT::Ticket->new($RT::SystemUser);
+$t3->Create( Queue => $queue_obj->Id,
+ Subject => 'Three',
+ );
+$t3->AddCustomFieldValue(Field => $cfO->Id, Value => '3');
+$t3->AddCustomFieldValue(Field => $cfA->Id, Value => '3');
+$t3->AddCustomFieldValue(Field => $cfB->Id, Value => '2');
+$t3->AddCustomFieldValue(Field => $cfC->Id, Value => 'AAA');
+
+$tx->FromSQL(qq[queue="$queue"] );
+$tx->OrderByCols({FIELD => "CF.${queue}.{Charlie}", ORDER => 'ASC'},
+ {FIELD => "CF.${queue}.{Alpha}", ORDER => 'DES'}
+ );
+is($tx->Count,3);
+check_order( $tx, 3, 2, 1);
+
+# Reverse the order of the secondary column, which changes the order
+# of the first two tickets.
+$tx->FromSQL(qq[queue="$queue"] );
+$tx->OrderByCols({FIELD => "CF.${queue}.{Charlie}", ORDER => 'ASC'},
+ {FIELD => "CF.${queue}.{Alpha}", ORDER => 'ASC'}
+ );
+is($tx->Count,3);
+check_order( $tx, 2, 3, 1);
Added: rt/branches/3.5-TESTING/lib/t/regression/24pawsort.t
==============================================================================
--- (empty file)
+++ rt/branches/3.5-TESTING/lib/t/regression/24pawsort.t Thu Sep 22 02:01:28 2005
@@ -0,0 +1,104 @@
+#!/home/perl/bin/perl
+
+use Test::More qw/no_plan/;
+use RT;
+RT::LoadConfig();
+RT::Init();
+
+use strict;
+use warnings;
+
+use RT::Tickets;
+use RT::Queue;
+use RT::CustomField;
+
+my($ret,$msg);
+
+# Test Paw Sort
+
+
+
+# ---- Create a queue to test with.
+my $queue = "PAWSortQueue-$$";
+my $queue_obj = RT::Queue->new($RT::SystemUser);
+($ret, $msg) = $queue_obj->Create(Name => $queue,
+ Description => 'queue for custom field sort testing');
+ok($ret, "$queue test queue creation. $msg");
+
+
+# ---- Create some users
+
+my $me = RT::User->new($RT::SystemUser);
+($ret, $msg) = $me->Create(Name => "Me$$", EmailAddress => $$.'create-me-1 at example.com');
+($ret, $msg) = $me->PrincipalObj->GrantRight(Object =>$queue_obj, Right => 'OwnTicket');
+($ret, $msg) = $me->PrincipalObj->GrantRight(Object =>$queue_obj, Right => 'SeeQueue');
+($ret, $msg) = $me->PrincipalObj->GrantRight(Object =>$queue_obj, Right => 'ShowTicket');
+my $you = RT::User->new($RT::SystemUser);
+($ret, $msg) = $you->Create(Name => "You$$", EmailAddress => $$.'create-you-1 at example.com');
+($ret, $msg) = $you->PrincipalObj->GrantRight(Object =>$queue_obj, Right => 'OwnTicket');
+($ret, $msg) = $you->PrincipalObj->GrantRight(Object =>$queue_obj, Right => 'SeeQueue');
+($ret, $msg) = $you->PrincipalObj->GrantRight(Object =>$queue_obj, Right => 'ShowTicket');
+
+my $nobody = RT::User->new($RT::SystemUser);
+$nobody->Load('nobody');
+
+
+# ----- Create some tickets to test with. Assign them some values to
+# make it easy to sort with.
+
+my @tickets = (
+ [qw[1 10], $me],
+ [qw[2 20], $me],
+ [qw[3 20], $you],
+ [qw[4 30], $you],
+ [qw[5 5], $nobody],
+ [qw[6 55], $nobody],
+ );
+for (@tickets) {
+ my $t = RT::Ticket->new($RT::SystemUser);
+ $t->Create( Queue => $queue_obj->Id,
+ Subject => $_->[0],
+ Owner => $_->[2]->Id,
+ Priority => $_->[1],
+ );
+}
+
+sub check_order {
+ my ($tx, @order) = @_;
+ my @results;
+ while (my $t = $tx->Next) {
+ push @results, $t->Subject;
+ }
+ my $results = join (" ", at results);
+ my $order = join(" ", at order);
+ is( $results, $order );
+}
+
+
+# The real tests start here
+
+my $cme = new RT::CurrentUser( $me );
+my $metx = new RT::Tickets( $cme );
+# Make sure we can sort in both directions on a queue specific field.
+$metx->FromSQL(qq[queue="$queue"] );
+$metx->OrderBy( FIELD => "Custom.Ownership", ORDER => 'ASC' );
+is($metx->Count,6);
+check_order( $metx, qw[2 1 6 5 4 3]);
+
+$metx->OrderBy( FIELD => "Custom.Ownership", ORDER => 'DESC' );
+is($metx->Count,6);
+check_order( $metx, reverse qw[2 1 6 5 4 3]);
+
+
+
+my $cyou = new RT::CurrentUser( $you );
+my $youtx = new RT::Tickets( $cyou );
+# Make sure we can sort in both directions on a queue specific field.
+$youtx->FromSQL(qq[queue="$queue"] );
+$youtx->OrderBy( FIELD => "Custom.Ownership", ORDER => 'ASC' );
+is($youtx->Count,6);
+check_order( $youtx, qw[4 3 6 5 2 1]);
+
+__END__
+
+
More information about the Rt-commit
mailing list