X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=DataObjects%2FProjectDirectory.php;h=471269a81a6342bba7632c871fee1ed002a5dcba;hb=5a4e5c1dc7b96c1d46cb0be649648c104ecb50a9;hp=4df19fd75f720df32cac2b740962887ffe6cd1e8;hpb=c1714ac7f7efd07af214ad108ac7ec6478494cd7;p=Pman.Core diff --git a/DataObjects/ProjectDirectory.php b/DataObjects/ProjectDirectory.php index 4df19fd7..471269a8 100644 --- a/DataObjects/ProjectDirectory.php +++ b/DataObjects/ProjectDirectory.php @@ -68,12 +68,22 @@ class Pman_Core_DataObjects_ProjectDirectory extends DB_DataObject */ function projects($au) { + if (empty($au)) { + $p = DB_DataObject::Factory('Projects'); + $p->get('code', '*PUBLIC'); + return array($p->id); + + } $c = clone ($this); + if (is_array($au)) { $c->whereAddIn('person_id', $au, 'int'); } else { $c->person_id = $au->id; } + $c->selectAdd(); + // people may have multiple roles for a project.. + $c->selectAdd('distinct(project_id) as project_id'); return $c->fetchAll('project_id'); } /** @@ -84,11 +94,15 @@ class Pman_Core_DataObjects_ProjectDirectory extends DB_DataObject function people($pr) { $c = clone ($this); + echo '
';print_R($this);exit;
+        $c->autoJoin();
         if (is_array($pr)) {
             $c->whereAddIn('project_id', $pr, 'int');
         } else {
             $c->project_id = $pr->id;
         }
+        $c->selectAdd();
+        $c->selectAdd('person_id');
         return $c->fetchAll('person_id');
         
          
@@ -114,7 +128,7 @@ class Pman_Core_DataObjects_ProjectDirectory extends DB_DataObject
         $xx = DB_Dataobject::factory('ProjectDirectory');
         $xx->setFrom(array(
             'project_id' => $this->project_id,
-            'person_id' => $this->person_id,
+            'person_id'  => $this->person_id,
             'company_id' => $this->company_id,
         ));