[Bps-public-commit] RT-Extension-rt_cpan_org branch, master, updated. a72f4ee1fff52631762777d94227f7003627bc2b

Thomas Sibley trs at bestpractical.com
Tue Jun 18 20:10:44 EDT 2013


The branch, master has been updated
       via  a72f4ee1fff52631762777d94227f7003627bc2b (commit)
      from  6d2145c25859018c035a0cdd47a78ded89c0c7ac (commit)

Summary of changes:
 patches/4.0.14-empty-order-by.patch | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 patches/4.0.14-empty-order-by.patch

- Log -----------------------------------------------------------------
commit a72f4ee1fff52631762777d94227f7003627bc2b
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Jun 18 17:09:10 2013 -0700

    Patch to fix invalid SQL caused by older OrderBy saved search prefs
    
    Three users have an older pref that causes incorrect search results:
    ABELTJE, HDP, and ANDK.

diff --git a/patches/4.0.14-empty-order-by.patch b/patches/4.0.14-empty-order-by.patch
new file mode 100644
index 0000000..a5b95ba
--- /dev/null
+++ b/patches/4.0.14-empty-order-by.patch
@@ -0,0 +1,30 @@
+From 1fdfabc9606dacf82535d52edbcdd98b6bbbc444 Mon Sep 17 00:00:00 2001
+From: Thomas Sibley <trs at bestpractical.com>
+Date: Tue, 18 Jun 2013 17:03:26 -0700
+Subject: [PATCH] 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.
+---
+ share/html/Elements/CollectionList | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+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 )
+-- 
+1.8.3.1
+

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



More information about the Bps-public-commit mailing list