$GLOBALS and using $GLOBALS['phpgw']['accounts']

This commit is contained in:
Ralf Becker 2001-10-03 19:21:08 +00:00
parent 98f82ed2e0
commit bbb3385ee1

View File

@ -34,9 +34,7 @@
function boinfolog( $info_id = 0) function boinfolog( $info_id = 0)
{ {
global $phpgw; $this->enums = array(
$this->enums = array(
'priority' => array ( 'priority' => array (
'urgent' => 'urgent','high' => 'high','normal' => 'normal', 'urgent' => 'urgent','high' => 'high','normal' => 'normal',
'low' => 'low' ), 'low' => 'low' ),
@ -64,36 +62,30 @@
'note' => array( 'note' => array(
'ongoing' => 'ongoing', 'done' => 'done' 'ongoing' => 'ongoing', 'done' => 'done'
)); ));
$this->so = CreateObject('infolog.soinfolog'); $this->so = CreateObject('infolog.soinfolog');
$this->read( $info_id); $this->read( $info_id);
} }
function accountInfo($id,$account_data=0) function accountInfo($id,$account_data=0)
{ {
global $phpgw,$phpgw_info;
if (!$id) return ' '; if (!$id) return ' ';
if (!is_array($account_data)) if (!is_array($account_data))
{ {
$accounts = createobject('phpgwapi.accounts',$id); $GLOBALS['phpgw']->accounts->read_repository();
$accounts->db = $phpgw->db; $account_data = $GLOBALS['phpgw']->accounts->data;
$accounts->read_repository();
$account_data = $accounts->data;
} }
if ($phpgw_info['user']['preferences']['infolog']['longNames']) if ($GLOBALS['phpgw_info']['user']['preferences']['infolog']['longNames'])
{ {
return $account_data['firstname'].' '.$account_data['lastname']; return $account_data['firstname'].' '.$account_data['lastname'];
} }
return $account_data['account_lid']; return $account_data['account_lid'];
} }
function addr2name( $addr ) function addr2name( $addr )
{ {
global $phpgw;
$name = $addr['n_family']; $name = $addr['n_family'];
if ($addr['n_given']) if ($addr['n_given'])
{ {
@ -110,7 +102,7 @@
{ {
$name = $addr['org_name'].': '.$name; $name = $addr['org_name'].': '.$name;
} }
return $phpgw->strip_html($name); return $GLOBALS['phpgw']->strip_html($name);
} }
function readProj($proj_id) function readProj($proj_id)
@ -120,7 +112,7 @@
if (!is_object($this->projects)) if (!is_object($this->projects))
{ {
$this->projects = createobject('projects.projects'); $this->projects = createobject('projects.projects');
} }
if (list( $proj ) = $this->projects->read_single_project( $proj_id)) if (list( $proj ) = $this->projects->read_single_project( $proj_id))
{ {
return $proj; return $proj;
@ -182,15 +174,13 @@
function write($values) function write($values)
{ {
global $phpgw_info;
if ($values['responsible'] && $values['status'] == 'offer') if ($values['responsible'] && $values['status'] == 'offer')
{ {
$values['status'] = 'ongoing'; // have to match if not finished $values['status'] = 'ongoing'; // have to match if not finished
} }
if (!$values['info_id'] && !$values['owner']) if (!$values['info_id'] && !$values['owner'])
{ {
$values['owner'] = $phpgw_info['user']['account_id']; $values['owner'] = $this->so->user;
} }
$values['datecreated'] = time(); // is now MODIFICATION-date $values['datecreated'] = time(); // is now MODIFICATION-date
@ -200,8 +190,7 @@
} }
if ($values['addr_id'] && !$values['from']) if ($values['addr_id'] && !$values['from'])
{ {
$values['from'] = $this->addr2name( $this->readAddr( $values['from'] = $this->addr2name( $this->readAddr( $values['addr_id'] ));
$values['addr_id'] ));
} }
$this->so->write($values); $this->so->write($values);
} }