X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Flib%2FRT%2FReport%2FTickets.pm;h=06b34f716ecff2407eba852af33166dd26ef15c2;hp=19bca18529df174070343764761414b0874b005e;hb=7322f2afedcc2f427e997d1535a503613a83f088;hpb=ae14e320388fa5e7f400bff1c251ef885b7952e6 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 # # # (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';