DataObjects/Office.php
authorEdward <edward@roojs.com>
Mon, 27 May 2013 07:17:30 +0000 (15:17 +0800)
committerEdward <edward@roojs.com>
Mon, 27 May 2013 07:17:30 +0000 (15:17 +0800)
DataObjects/Office.php

index 1ae9a32..e99ea56 100644 (file)
@@ -28,7 +28,13 @@ class Pman_Core_DataObjects_Office extends DB_DataObject
     {
         //DB_DataObject::debugLevel(1);
         $tn  = $this->tableName();
-        $this->selectAdd("   i18n_translate('c' , {$tn}.country, 'en') as office_id_country_name");
+        if (isset($q['_distinct']) && in_array('office_id_country_name', explode(',', $q['_distinct'])))
+            $this->selectAdd("   distinct( i18n_translate('c' , {$tn}.country, 'en')) as  office_id_country_name");
+        } else {
+            $this->selectAdd("   i18n_translate('c' , {$tn}.country, 'en') as office_id_country_name");
+        }
+        
+        
         $this->_extra_cols = array('office_id_country_name');
     }