Pman/Roo.php
authorAlan Knowles <alan@akbkhome.com>
Thu, 11 Nov 2010 11:09:03 +0000 (19:09 +0800)
committerAlan Knowles <alan@akbkhome.com>
Thu, 11 Nov 2010 11:09:03 +0000 (19:09 +0800)
Pman/Roo.php

index c1e2580..b509c5c 100644 (file)
@@ -667,22 +667,20 @@ class Pman_Roo extends Pman
         $do->selectAdd(); // we need thsi as normally it's only cleared by an empty selectAs call.
         
         $selectAs = array(array(  $xx , '%s'));
-        
+         $has_distinct = false;
         if ($filter) {
             $cols = array();
-            $has_distinct = false;
+           
             foreach($xx as $c) {
                 if ($distinct && $distinct == $c) {
-                    $has_distinct=$c;
+                    $has_distinct = 'DISTINCT( ' . $do->tableName() .'.'. $has_distinct .' as ' . $has_distinct ;
                     continue;
                 }
                 if (in_array($c, $filter)) {
                     $cols[] = $c;
                 }
             }
-            if ($has_distinct) {
-                $do->selectAdd( 'DISTINCT( ' . $do->tableName() .'.'. $has_distinct .' as ' . $has_distinct );
-            }
+            
             $selectAs = array(array(  $cols , '%s'));
             
         }