function owner()
{
- $p = DB_DataObject::Factory('Person');
+ $p = DB_DataObject::Factory($this->tableName());
$p->get($this->owner_id);
return $p;
}
join_user_id_id.id IS NOT NULL
");
if($member->find(true)){
- $default_admin = DB_DataObject::factory('Person');
+ $default_admin = DB_DataObject::factory($this->tableName());
if(!$default_admin->get($member->user_id)){
$default_admin = false;
}
}
//var_dump($ff->Pman['local_autoauth']); var_dump($_SERVER); exit;
- $u = DB_DataObject::factory('Person');
+ $u = DB_DataObject::factory($this->tableName());
$ff = HTML_FlexyFramework::get();
if (!empty($ff->Pman['local_autoauth']) &&
(!empty($_SERVER['SERVER_ADDR'])) &&
}
// http basic auth..
- $u = DB_DataObject::factory('Person');
+ $u = DB_DataObject::factory($this->tableName());
if (!empty($_SERVER['PHP_AUTH_USER'])
&&
//}
//die("got this far?");
// not in session or not matched...
- $u = DB_DataObject::factory('Person');
+ $u = DB_DataObject::factory($this->tableName());
$u->whereAdd(' LENGTH(passwd) > 0');
$n = $u->count();
$_SESSION[get_class($this)][$sesPrefix .'-empty'] = $n;
if (empty( $_SESSION[get_class($this)][$sesPrefix .'-empty'] )) {
- $u = DB_DataObject::factory('Person');
+ $u = DB_DataObject::factory($this->tableName());
$u->whereAdd(' LENGTH(passwd) > 0');
$_SESSION[get_class($this)][$sesPrefix .'-empty'] = $u->count();
}
//$ce->initEnums();
- $u = DB_DataObject::factory('Person');
+ $u = DB_DataObject::factory($this->tableName());
$u->id = -1;
// if a company has been created fill that in in company_id_id
//$this->whereAdd(($this->tableName() == 'Person' ? 'Person' : "join_person_id_id") .
// ".id != ".$au->id);
- $this->whereAdd("Person.id != {$au->id}");
+ $this->whereAdd("{$this->tableName()}.id != {$au->id}");
}
if (!empty($q['query']['comptype_or_company_id'])) {
$id = (int) array_pop($bits);
$ct = $this->escape($bits[0]);
- $this->whereAdd(" join_company_id_id.comptype = '$ct' OR Person.company_id = $id");
+ $this->whereAdd(" join_company_id_id.comptype = '$ct' OR {$this->tableName()}.company_id = $id");
}
if ($q['query']['in_group'] == -1) {
// list all staff who are not in a group.
- $this->whereAdd("Person.id NOT IN (
+ $this->whereAdd("{$this->tableName()}.id NOT IN (
SELECT distinct(user_id) FROM $tn_gm LEFT JOIN
$tn_g ON $tn_g.id = $tn_gm.group_id
WHERE $tn_g.type = ".$q['query']['type']."
if(!empty($q['query']['name'])){
$this->whereAdd("
- Person.name LIKE '%{$this->escape($q['query']['name'])}%'
+ {$this->tableName()}.name LIKE '%{$this->escape($q['query']['name'])}%'
");
}
// project directory rules -- this may distrupt things.
$p = DB_DataObject::factory('ProjectDirectory');
+ // if project directories are set up, then we can apply project query rules..
if ($p->count()) {
$p->autoJoin();
$pids = $p->projects($au);
- if (isset($q['query']['project_id'])) {
+ if (isset($q['query']['project_id'])) {
$pid = (int)$q['query']['project_id'];
if (!in_array($pid, $pids)) {
$roo->jerr("Project not in users valid projects");
$pids = array($pid);
}
// project roles..
- if (empty($q['_anyrole'])) {
- $p->whereAdd("{$p->tableName()}.role != ''");
- }
- if (!empty($q['query']['role'])) {
- $role = $this->escape($q['query']['role']);
+ //if (empty($q['_anyrole'])) { // should be project_directry_role
+ // $p->whereAdd("{$p->tableName()}.role != ''");
+ // }
+ if (!empty($q['query']['role'])) { // should be project_directry_role
+ $role = $this->escape($q['query']['role']);
$p->whereAdd("{$p->tableName()}.role LIKE '%{$role}%'");
}
}
-
+ // fixme - this needs a more generic fix - it was from the mtrack_person code...
+ if (isset($q['query']['ticket_id'])) {
+ // find out what state the ticket is in.
+ $t = DB_DataObject::Factory('mtrack_ticket');
+ $t->autoJoin();
+ $t->get($q['query']['ticket_id']);
+
+ if (!$this->checkPerm('S', $au)) {
+ $roo->jerr("permssion denied to query state of ticket");
+ }
+
+ $p = DB_DataObject::factory('ProjectDirectory');
+ $pids = array($t->project_id);
+
+ $peps = $p->people($pids);
+
+ $this->whereAddIn($this->tableName().'.id', $peps, 'int');
+
+ //$this->whereAdd('join_prole != ''");
+
+ }
}
function setFromRoo($ar, $roo)
{
if (empty($this->email)) {
return true;
}
- $xx = DB_Dataobject::factory('Person');
+ $xx = DB_Dataobject::factory($this->tableName());
$xx->setFrom(array(
'email' => $this->email,
// 'company_id' => $x->company_id
// determine if it's staff!!!
$owncomp = DB_DataObject::Factory('Companies');
$owncomp->get('comptype', 'OWNER');
- $isStaff = ($this->company_id == $owncomp->id);
+ $isStaff = ($au->company_id == $owncomp->id);
if (!$isStaff) {