Author: sevein
Date: Thu Aug 2 17:37:44 2012
New Revision: 12035
Log:
Use COALESCE also when sorting by title to include results where title is NULL
Modified:
trunk/lib/model/QubitInformationObject.php
Modified: trunk/lib/model/QubitInformationObject.php
==============================================================================
--- trunk/lib/model/QubitInformationObject.php Thu Aug 2 16:55:44 2012
(r12034)
+++ trunk/lib/model/QubitInformationObject.php Thu Aug 2 17:37:44 2012
(r12035)
@@ -1647,6 +1647,10 @@
// They way the results are sorted
// 'none' (default), 'title' or 'identifierTitle'
$sort = sfConfig::get('app_sort_treeview_informationobject', 'none');
+ if (isset($options['sort']))
+ {
+ $sort = $options['sort'];
+ }
// This is the array of objects that we are buldind
$results = array();
@@ -1655,15 +1659,10 @@
// iteration of the following loop
$current = $this;
- // Iteration counter
- $iterationCount = 0;
-
// Query the database and discard results by ACL, repeating the same
// operation until the number of results requested is fulfilled
do
{
- $iterationCount++;
-
$criteria = new Criteria;
$criteria->add(QubitInformationObject::PARENT_ID, $this->parentId);
@@ -1711,13 +1710,12 @@
if ('next' == $position)
{
// Add where clause with culture fallback support
- $criteria->add(
- 'title',
- '(CASE
+ $criteria->add('title',
+ 'COALESCE((CASE
WHEN (current.TITLE IS NOT NULL AND current.TITLE <> "")
THEN current.TITLE
ELSE source.TITLE
- END) > '.Propel::getConnection()->quote($current->title),
+ END), "") > '.Propel::getConnection()->quote($current->title),
Criteria::CUSTOM);
$criteria->addAscendingOrderByColumn('title');
@@ -1725,13 +1723,12 @@
else // 'previous'
{
// Add where clause with culture fallback support
- $criteria->add(
- 'title',
- '(CASE
+ $criteria->add('title',
+ 'COALESCE((CASE
WHEN (current.TITLE IS NOT NULL AND current.TITLE <> "")
THEN current.TITLE
ELSE source.TITLE
- END) < '.Propel::getConnection()->quote($current->title),
+ END), "") < '.Propel::getConnection()->quote($current->title),
Criteria::CUSTOM);
$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.