diff options
author | Ivan Kohler <ivan@freeside.biz> | 2016-09-24 10:28:06 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2016-09-24 10:31:23 -0700 |
commit | 9ce482da3960ee43decee41fba53b78c12c3e52c (patch) | |
tree | f7e77a4a2154a3f259fc41f5c2282a752e4ba200 /rt/lib/RT/Report | |
parent | 6894828ab5a66e53ad6945cc14e6cd9f9c3b67f7 (diff) |
rt 4.2.13 ticket#13852
Diffstat (limited to 'rt/lib/RT/Report')
-rw-r--r-- | rt/lib/RT/Report/Tickets.pm | 25 | ||||
-rw-r--r-- | rt/lib/RT/Report/Tickets/Entry.pm | 2 |
2 files changed, 12 insertions, 15 deletions
diff --git a/rt/lib/RT/Report/Tickets.pm b/rt/lib/RT/Report/Tickets.pm index 19bca1852..06b34f716 100644 --- a/rt/lib/RT/Report/Tickets.pm +++ b/rt/lib/RT/Report/Tickets.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC # <sales@bestpractical.com> # # (Except where explicitly superseded by other copyright notices) @@ -673,27 +673,24 @@ sub SortEntries { for ( my $i = 0; $i < @groups; $i++ ) { my $group_by = $groups[$i]; my $idx = $i+1; - my $method; - # If this is a CF, traverse the values being used for labels. - # If they all look like numbers or undef, flag for a numeric sort - - my $looks_like_number; - if ( $group_by->{'KEY'} eq 'CF' ){ - $looks_like_number = 1; + my $order = $group_by->{'META'}{Sort} || 'label'; + my $method = $order =~ /label$/ ? 'LabelValue' : 'RawValue'; + unless ($order =~ /^numeric/) { + # Traverse the values being used for labels. + # If they all look like numbers or undef, flag for a numeric sort. + my $looks_like_number = 1; foreach my $item (@data){ - my $cf_label = $item->[0]->RawValue($group_by->{'NAME'}); + my $label = $item->[0]->$method($group_by->{'NAME'}); $looks_like_number = 0 - unless (not defined $cf_label) - or Scalar::Util::looks_like_number( $cf_label ); + unless (not defined $label) + or Scalar::Util::looks_like_number( $label ); } + $order = "numeric $order" if $looks_like_number; } - my $order = $looks_like_number ? 'numeric label' : 'label'; - $order = $group_by->{'META'}{Sort} if exists $group_by->{'META'}{Sort}; - if ( $order eq 'label' ) { push @SORT_OPS, sub { $_[0][$idx] cmp $_[1][$idx] }; $method = 'LabelValue'; diff --git a/rt/lib/RT/Report/Tickets/Entry.pm b/rt/lib/RT/Report/Tickets/Entry.pm index 24cb4f6ec..67017e8e5 100644 --- a/rt/lib/RT/Report/Tickets/Entry.pm +++ b/rt/lib/RT/Report/Tickets/Entry.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC # <sales@bestpractical.com> # # (Except where explicitly superseded by other copyright notices) |