[Rt-commit] rt branch, 4.0/filter-empty-order-by, created. rt-4.0.13-84-g1fdfabc

Thomas Sibley trs at bestpractical.com
Tue Jun 18 20:08:40 EDT 2013


The branch, 4.0/filter-empty-order-by has been created
        at  1fdfabc9606dacf82535d52edbcdd98b6bbbc444 (commit)

- Log -----------------------------------------------------------------
commit 1fdfabc9606dacf82535d52edbcdd98b6bbbc444
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Jun 18 17:03:26 2013 -0700

    Always filter empty strings out of OrderBy
    
    Older OrderBy saved search preferences (which are arrays) may contain
    empty strings.  Passing them to OrderByCols() can cause invalid SQL.

diff --git a/share/html/Elements/CollectionList b/share/html/Elements/CollectionList
index 7e4ba15..33e2de2 100644
--- a/share/html/Elements/CollectionList
+++ b/share/html/Elements/CollectionList
@@ -68,9 +68,10 @@ if ( $Rows ) {
 # collection is ordered or not
 if ( @OrderBy && ($AllowSorting || !$Collection->{'order_by'}) ) {
     if ( $OrderBy[0] =~ /\|/ ) {
-        @OrderBy = grep length($_), split /\|/, $OrderBy[0];
+        @OrderBy = split /\|/, $OrderBy[0];
         @Order = split /\|/,$Order[0];
     }
+    @OrderBy = grep length, @OrderBy;
     $Collection->OrderByCols(
         map { { FIELD => $OrderBy[$_], ORDER => $Order[$_] } }
         ( 0 .. $#OrderBy )

-----------------------------------------------------------------------


More information about the Rt-commit mailing list