Author: sevein
Date: Thu Aug  2 16:55:44 2012
New Revision: 12034

Log:
Use CONCAT plus COALESCE to avoid NULLs when sorting by identifierTitle

Modified:
   trunk/lib/model/QubitInformationObject.php

Modified: trunk/lib/model/QubitInformationObject.php
==============================================================================
--- trunk/lib/model/QubitInformationObject.php  Thu Aug  2 16:45:06 2012        
(r12033)
+++ trunk/lib/model/QubitInformationObject.php  Thu Aug  2 16:55:44 2012        
(r12034)
@@ -1646,7 +1646,7 @@
 
     // They way the results are sorted
     // 'none' (default), 'title' or 'identifierTitle'
-    $sort = sfConfig::get('app_sort_treeview_informationobject', 'title');
+    $sort = sfConfig::get('app_sort_treeview_informationobject', 'none');
 
     // This is the array of objects that we are buldind
     $results = array();
@@ -1675,13 +1675,29 @@
 
           if ('next' == $position)
           {
-            die("TODO");
+            // Add where clause with culture fallback support
+            $criteria->add(
+              'title',
+              'CONCAT(
+                  COALESCE(identifier, ""),
+                  COALESCE((CASE WHEN (current.TITLE IS NOT NULL AND 
current.TITLE <> "") THEN current.TITLE ELSE source.TITLE END), "")
+                ) > '.Propel::getConnection()->quote($current->title),
+              Criteria::CUSTOM);
+
             $criteria->addAscendingOrderByColumn('identifier');
             $criteria->addAscendingOrderByColumn('title');
           }
           else // 'previous'
           {
-            die("TODO");
+            // Add where clause with culture fallback support
+            $criteria->add(
+              'title',
+              'CONCAT(
+                  COALESCE(identifier, ""),
+                  COALESCE((CASE WHEN (current.TITLE IS NOT NULL AND 
current.TITLE <> "") THEN current.TITLE ELSE source.TITLE END), "")
+                ) < '.Propel::getConnection()->quote($current->title),
+              Criteria::CUSTOM);
+
             $criteria->addDescendingOrderByColumn('identifier');
             $criteria->addDescendingOrderByColumn('title');
           }

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to