X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=DataObjects%2FProjectDirectory.php;h=bb0ad337733426f70834c50997fb6fff1352393c;hb=ea0da667580412dfd01ac990d5d2d7edd65bbe8e;hp=4d9cf5c5edcbea4fb2aaa24424bf84c59646e9c2;hpb=68f70261dfea325e8879a48db644d1156c43a279;p=Pman.Core diff --git a/DataObjects/ProjectDirectory.php b/DataObjects/ProjectDirectory.php index 4d9cf5c5..bb0ad337 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,6 +94,7 @@ class Pman_Core_DataObjects_ProjectDirectory extends DB_DataObject function people($pr) { $c = clone ($this); + $c->autoJoin(); if (is_array($pr)) { $c->whereAddIn('project_id', $pr, 'int'); } else {