[Rt-commit] rt branch, 4.0/link-sort-order, created. rt-4.0.4-174-g6c0f79d
Alex Vandiver
alexmv at bestpractical.com
Tue Jan 10 12:31:05 EST 2012
The branch, 4.0/link-sort-order has been created
at 6c0f79dc4e8528aa148e63fd1756d3c6f2a87006 (commit)
- Log -----------------------------------------------------------------
commit 6c0f79dc4e8528aa148e63fd1756d3c6f2a87006
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Tue Jan 10 12:17:52 2012 -0500
Force numerical ID sorting in local tickets
The sort order on links was based on Target or Base, not LocalTarget or
LocalBase, which meant that it was left to the database's infernal
devices as to how to sort those for local tickets (whose Target/Base is
NULL, but which have a LocalTarget/LocalBase). On MySQL, for instance,
this led to lexical sorting: 1, 10, 11, 2, 3...
Sort by both LocalTarget/LocalBase as well as Target/Base.
diff --git a/lib/RT/Links.pm b/lib/RT/Links.pm
index 07f8774..0ad6849 100644
--- a/lib/RT/Links.pm
+++ b/lib/RT/Links.pm
@@ -91,15 +91,17 @@ sub Limit {
if ( ($args{'FIELD'} eq 'Target') or
($args{'FIELD'} eq 'LocalTarget') ) {
- $self->OrderBy (ALIAS => 'main',
- FIELD => 'Base',
- ORDER => 'ASC');
+ $self->OrderByCols(
+ { ALIAS => 'main', FIELD => 'LocalBase', ORDER => 'ASC' },
+ { ALIAS => 'main', FIELD => 'Base', ORDER => 'ASC' },
+ );
}
elsif ( ($args{'FIELD'} eq 'Base') or
($args{'FIELD'} eq 'LocalBase') ) {
- $self->OrderBy (ALIAS => 'main',
- FIELD => 'Target',
- ORDER => 'ASC');
+ $self->OrderByCols(
+ { ALIAS => 'main', FIELD => 'LocalTarget', ORDER => 'ASC' },
+ { ALIAS => 'main', FIELD => 'Target', ORDER => 'ASC' },
+ );
}
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list