Author: david
Date: Thu Aug 23 10:17:03 2012
New Revision: 12175

Log:
Use leading space to find prev/next values properly in identifier+title sort. 
Fix concatenation of current node identifier+title+lft(padded) by using PHP 
concat.  Fixes issue 1327

Modified:
   trunk/lib/model/QubitInformationObject.php

Modified: trunk/lib/model/QubitInformationObject.php
==============================================================================
--- trunk/lib/model/QubitInformationObject.php  Thu Aug 23 00:02:47 2012        
(r12174)
+++ trunk/lib/model/QubitInformationObject.php  Thu Aug 23 10:17:03 2012        
(r12175)
@@ -1692,18 +1692,19 @@
 
           $criteria = QubitCultureFallback::addFallbackCriteria($criteria, 
'QubitInformationObject');
 
+          $concatCurrent  = $current->__get('identifier') ?: " ";
+          $concatCurrent .= $current->title;
+          $concatCurrent .= str_pad($current->lft, 12, '0', STR_PAD_LEFT);
+          $concatCurrent = Propel::getConnection()->quote($concatCurrent);
+
           if ('next' == $position)
           {
             $criteria->add('title',
               'CONCAT(
-                  COALESCE(identifier, ""),
+                  COALESCE(identifier, " "),
                   COALESCE((CASE WHEN (current.TITLE IS NOT NULL AND 
current.TITLE <> "") THEN current.TITLE ELSE source.TITLE END), ""),
                   LPAD(lft, 12, 0))
-                >
-               CONCAT(
-                
COALESCE('.Propel::getConnection()->quote($current->identifier).', ""),
-                COALESCE('.Propel::getConnection()->quote($current->title).', 
""),
-                LPAD('.Propel::getConnection()->quote($current->lft).', 12, 
0))',
+                > '.$concatCurrent,
               Criteria::CUSTOM);
 
             $criteria->addAscendingOrderByColumn('identifier');
@@ -1714,14 +1715,10 @@
           {
             $criteria->add('title',
               'CONCAT(
-                COALESCE(identifier, ""),
+                COALESCE(identifier, " "),
                 COALESCE((CASE WHEN (current.TITLE IS NOT NULL AND 
current.TITLE <> "") THEN current.TITLE ELSE source.TITLE END), ""),
                 LPAD(lft, 12, 0))
-                <
-               CONCAT(
-                
COALESCE('.Propel::getConnection()->quote($current->identifier).', ""),
-                COALESCE('.Propel::getConnection()->quote($current->title).', 
""),
-                LPAD('.Propel::getConnection()->quote($current->lft).', 12, 
0))',
+                < '.$concatCurrent,
               Criteria::CUSTOM);
 
             $criteria->addDescendingOrderByColumn('identifier');

-- 
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