function switchUser($id)
{
+ $tbl = empty($ff->Pman['authTable']) ? 'Person' : $ff->Pman['authTable'];
+ $u = DB_DataObject::factory($tbl);
+ if (!$u->isAuth()) {
+ $this->err("not logged in");
+ }
+
+ $au = $u->getAuthUser();
+
+
// first check they have perms to do this..
- if (!$this->authUser || ($this->authUser->company_id_comptype != 'OWNER') || !$this->hasPerm('Core.Person', 'E')) {
+ if (!$au|| ($au->company_id_comptype != 'OWNER') || !$this->hasPerm('Core.Person', 'E')) {
$this->jerr("User switching not permitted");
}
- $old = clone($this->authUser);
- $tbl = empty($ff->Pman['authTable']) ? 'Person' : $ff->Pman['authTable'];
+ $old = clone($au);
+
$u = DB_DataObject::factory($tbl);
$u->get($id);
if (!$u->active()) {