mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 00:13:35 +01:00
Working to changeover to use of arrays for all bo functions, fix some other
broken calls that were in limbo
This commit is contained in:
parent
7849d1ecbb
commit
09a1130896
@ -23,6 +23,9 @@
|
|||||||
'add_email' => True,
|
'add_email' => True,
|
||||||
'update_entry' => True
|
'update_entry' => True
|
||||||
);
|
);
|
||||||
|
|
||||||
|
var $xml_functions = array();
|
||||||
|
|
||||||
var $soap_functions = array(
|
var $soap_functions = array(
|
||||||
'read_entries' => array(
|
'read_entries' => array(
|
||||||
'in' => array(
|
'in' => array(
|
||||||
@ -109,6 +112,20 @@
|
|||||||
if(isset($order)) { $this->order = $order; }
|
if(isset($order)) { $this->order = $order; }
|
||||||
if(isset($filter)) { $this->filter = $filter; }
|
if(isset($filter)) { $this->filter = $filter; }
|
||||||
if(isset($fcat_id)) { $this->cat_id = $fcat_id; }
|
if(isset($fcat_id)) { $this->cat_id = $fcat_id; }
|
||||||
|
|
||||||
|
/* Preliminary xml function exposure */
|
||||||
|
$this->xml_functions = array(
|
||||||
|
'read_entry' => array(
|
||||||
|
'function' => 'read_entry',
|
||||||
|
'signature' => array(array($xmlrpcStruct)),
|
||||||
|
'docstring' => lang('Read a single entry by passing the id and fieldlist.')
|
||||||
|
),
|
||||||
|
'read_entries' => array(
|
||||||
|
'function' => 'read_entries',
|
||||||
|
'signature' => array(array($xmlrpcStruct)),
|
||||||
|
'docstring' => lang('Read a list of entries.')
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function save_sessiondata($data)
|
function save_sessiondata($data)
|
||||||
@ -162,17 +179,25 @@
|
|||||||
return $cleaned;
|
return $cleaned;
|
||||||
}
|
}
|
||||||
|
|
||||||
function read_entries($start,$limit,$qcols,$qfilter)
|
function read_entries($data)
|
||||||
{
|
{
|
||||||
$entries = $this->so->read_entries($start,$limit,$qcols,$this->query,$qfilter,$this->sort,$this->order);
|
$entries = $this->so->read_entries(
|
||||||
|
$data['start'],
|
||||||
|
$data['limit'],
|
||||||
|
$data['fields'],
|
||||||
|
$this->query,
|
||||||
|
$data['filter'],
|
||||||
|
$this->sort,
|
||||||
|
$this->order
|
||||||
|
);
|
||||||
$this->total = $this->so->contacts->total_records;
|
$this->total = $this->so->contacts->total_records;
|
||||||
if($this->debug) { echo '<br>Total records="' . $this->total . '"'; }
|
if($this->debug) { echo '<br>Total records="' . $this->total . '"'; }
|
||||||
return $this->strip_html($entries);
|
return $this->strip_html($entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
function read_entry($id,$fields)
|
function read_entry($data)
|
||||||
{
|
{
|
||||||
$entry = $this->so->read_entry($id,$fields);
|
$entry = $this->so->read_entry($data['id'],$data['fields']);
|
||||||
return $this->strip_html($entry);
|
return $this->strip_html($entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_entry($userid,$fields)
|
function add_entry($fields)
|
||||||
{
|
{
|
||||||
$this->makeobj();
|
$this->makeobj();
|
||||||
$fields['tid'] = trim($fields['tid']);
|
$fields['tid'] = trim($fields['tid']);
|
||||||
@ -102,7 +102,7 @@
|
|||||||
}
|
}
|
||||||
if ($this->rights & PHPGW_ACL_ADD)
|
if ($this->rights & PHPGW_ACL_ADD)
|
||||||
{
|
{
|
||||||
$this->contacts->add($userid,$fields,$fields['access'],$fields['cat_id'],$fields['tid']);
|
$this->contacts->add($fields['owner'],$fields,$fields['access'],$fields['cat_id'],$fields['tid']);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -115,22 +115,22 @@
|
|||||||
return $ab_id;
|
return $ab_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_entry($userid,$fields)
|
function update_entry($fields)
|
||||||
{
|
{
|
||||||
$this->makeobj();
|
$this->makeobj();
|
||||||
if ($this->rights & PHPGW_ACL_EDIT)
|
if ($this->rights & PHPGW_ACL_EDIT)
|
||||||
{
|
{
|
||||||
$this->contacts->update($fields['ab_id'],$userid,$fields,$fields['access'],$fields['cat_id']);
|
$this->contacts->update($fields['ab_id'],$fields['owner'],$fields,$fields['access'],$fields['cat_id']);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function delete_entry($ab_id)
|
function delete_entry($data)
|
||||||
{
|
{
|
||||||
$this->makeobj();
|
$this->makeobj();
|
||||||
if ($this->rights & PHPGW_ACL_DELETE)
|
if ($this->rights & PHPGW_ACL_DELETE)
|
||||||
{
|
{
|
||||||
$this->contacts->delete($ab_id);
|
$this->contacts->delete($data['id']);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -416,7 +416,12 @@
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* read the entry list */
|
/* read the entry list */
|
||||||
$entries = $this->bo->read_entries($this->start,$this->limit,$columns_to_display,$qfilter);
|
$entries = $this->bo->read_entries(array(
|
||||||
|
'start' => $this->start,
|
||||||
|
'limit' => $this->limit,
|
||||||
|
'fields' => $columns_to_display,
|
||||||
|
'filter' => $qfilter
|
||||||
|
));
|
||||||
$total_records = $this->bo->total;
|
$total_records = $this->bo->total;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -574,7 +579,8 @@
|
|||||||
$fields['tid'] = 'n';
|
$fields['tid'] = 'n';
|
||||||
$referer = urlencode($referer);
|
$referer = urlencode($referer);
|
||||||
|
|
||||||
$this->bo->add_entry($phpgw_info['user']['account_id'],$fields);
|
$fields['owner'] = $phpgw_info['user']['account_id'];
|
||||||
|
$this->bo->add_entry($fields);
|
||||||
$ab_id = $this->bo->get_lastid();
|
$ab_id = $this->bo->get_lastid();
|
||||||
|
|
||||||
Header('Location: '
|
Header('Location: '
|
||||||
@ -592,7 +598,7 @@
|
|||||||
$addnew[0]['id'] = '';
|
$addnew[0]['id'] = '';
|
||||||
$fields = $addnew[0];
|
$fields = $addnew[0];
|
||||||
|
|
||||||
$this->bo->add_entry($fields['owner'],$fields);
|
$this->bo->add_entry($fields);
|
||||||
$ab_id = $this->bo->get_lastid();
|
$ab_id = $this->bo->get_lastid();
|
||||||
|
|
||||||
Header("Location: " . $phpgw->link('/index.php',"menuaction=addressbook.uiaddressbook.edit&ab_id=$ab_id"));
|
Header("Location: " . $phpgw->link('/index.php',"menuaction=addressbook.uiaddressbook.edit&ab_id=$ab_id"));
|
||||||
@ -643,7 +649,7 @@
|
|||||||
{
|
{
|
||||||
$fields = $this->get_form();
|
$fields = $this->get_form();
|
||||||
/* _debug_array($fields);exit; */
|
/* _debug_array($fields);exit; */
|
||||||
$check = $this->bo->read_entry($fields['ab_id'],array('owner' => 'owner', 'tid' => 'tid'));
|
$check = $this->bo->read_entry(array('id' => $ab_id, 'fields' => array('owner' => 'owner','tid' => 'tid')));
|
||||||
|
|
||||||
if (($this->contacts->grants[$check[0]['owner']] & PHPGW_ACL_EDIT) && $check[0]['owner'] != $phpgw_info['user']['account_id'])
|
if (($this->contacts->grants[$check[0]['owner']] & PHPGW_ACL_EDIT) && $check[0]['owner'] != $phpgw_info['user']['account_id'])
|
||||||
{
|
{
|
||||||
@ -653,6 +659,7 @@
|
|||||||
{
|
{
|
||||||
$userid = $phpgw_info['user']['account_id'];
|
$userid = $phpgw_info['user']['account_id'];
|
||||||
}
|
}
|
||||||
|
$fields['owner'] = $userid;
|
||||||
$referer = urlencode($fields['referer']);
|
$referer = urlencode($fields['referer']);
|
||||||
unset($fields['referer']);
|
unset($fields['referer']);
|
||||||
|
|
||||||
@ -664,7 +671,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* First, make sure they have permission to this entry */
|
/* First, make sure they have permission to this entry */
|
||||||
$check = $this->bo->read_entry($ab_id,array('owner' => 'owner', 'tid' => 'tid'));
|
$check = $this->bo->read_entry(array('id' => $ab_id, 'fields' => array('owner' => 'owner','tid' => 'tid')));
|
||||||
|
|
||||||
if ( !$this->contacts->check_perms($this->contacts->grants[$check[0]['owner']],PHPGW_ACL_EDIT) && ($check[0]['owner'] != $phpgw_info['user']['account_id']) )
|
if ( !$this->contacts->check_perms($this->contacts->grants[$check[0]['owner']],PHPGW_ACL_EDIT) && ($check[0]['owner'] != $phpgw_info['user']['account_id']) )
|
||||||
{
|
{
|
||||||
@ -680,7 +687,7 @@
|
|||||||
|
|
||||||
/* merge in extra fields */
|
/* merge in extra fields */
|
||||||
$qfields = $this->contacts->stock_contact_fields + $this->extrafields + $customfields;
|
$qfields = $this->contacts->stock_contact_fields + $this->extrafields + $customfields;
|
||||||
$fields = $this->bo->read_entry($ab_id,$qfields);
|
$fields = $this->bo->read_entry(array('id' => $ab_id, 'fields' => $qfields));
|
||||||
$this->addressbook_form('edit','menuaction=addressbook.uiaddressbook.edit',lang('Edit'),$fields[0],$customfields);
|
$this->addressbook_form('edit','menuaction=addressbook.uiaddressbook.edit',lang('Edit'),$fields[0],$customfields);
|
||||||
|
|
||||||
$this->template->set_file(array('edit' => 'edit.tpl'));
|
$this->template->set_file(array('edit' => 'edit.tpl'));
|
||||||
@ -719,7 +726,7 @@
|
|||||||
Header('Location: ' . $phpgw->link('/index.php','menuaction=addressbook.uiaddressbook.get_list'));
|
Header('Location: ' . $phpgw->link('/index.php','menuaction=addressbook.uiaddressbook.get_list'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$check = $this->bo->read_entry($ab_id,array('owner' => 'owner', 'tid' => 'tid'));
|
$check = $this->bo->read_entry(array('id' => $ab_id, 'fields' => array('owner' => 'owner','tid' => 'tid')));
|
||||||
|
|
||||||
if (($this->contacts->grants[$check[0]['owner']] & PHPGW_ACL_DELETE) && $check[0]['owner'] != $phpgw_info['user']['account_id'])
|
if (($this->contacts->grants[$check[0]['owner']] & PHPGW_ACL_DELETE) && $check[0]['owner'] != $phpgw_info['user']['account_id'])
|
||||||
{
|
{
|
||||||
@ -745,7 +752,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->bo->delete_entry($ab_id);
|
$this->bo->delete_entry(array('id' => $ab_id));
|
||||||
|
|
||||||
@Header('Location: ' . $phpgw->link('/addressbook/index.php','menuaction=addressbook.uiaddressbook.get_list'));
|
@Header('Location: ' . $phpgw->link('/addressbook/index.php','menuaction=addressbook.uiaddressbook.get_list'));
|
||||||
}
|
}
|
||||||
@ -756,7 +763,7 @@
|
|||||||
global $phpgw,$phpgw_info,$ab_id,$submit,$referer;
|
global $phpgw,$phpgw_info,$ab_id,$submit,$referer;
|
||||||
|
|
||||||
/* First, make sure they have permission to this entry */
|
/* First, make sure they have permission to this entry */
|
||||||
$check = $this->bo->read_entry($ab_id,array('owner' => 'owner'));
|
$check = $this->bo->read_entry(array('id' => $ab_id, 'fields' => array('owner' => 'owner','tid' => 'tid')));
|
||||||
|
|
||||||
$perms = $this->contacts->check_perms($this->contacts->grants[$check[0]['owner']],PHPGW_ACL_READ);
|
$perms = $this->contacts->check_perms($this->contacts->grants[$check[0]['owner']],PHPGW_ACL_READ);
|
||||||
|
|
||||||
@ -816,7 +823,7 @@
|
|||||||
/* merge in extra fields */
|
/* merge in extra fields */
|
||||||
$qfields = $this->contacts->stock_contact_fields + $this->extrafields + $customfields;
|
$qfields = $this->contacts->stock_contact_fields + $this->extrafields + $customfields;
|
||||||
|
|
||||||
$fields = $this->bo->read_entry($ab_id,$qfields);
|
$fields = $this->bo->read_entry(array('id' => $ab_id, 'fields' => $qfields));
|
||||||
|
|
||||||
$record_owner = $fields[0]['owner'];
|
$record_owner = $fields[0]['owner'];
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// First, make sure they have permission to this entry
|
// First, make sure they have permission to this entry
|
||||||
$check = $this->bo->read_entry($ab_id,array('owner' => 'owner'));
|
$check = $this->bo->read_entry(array('id' => $ab_id, 'fields' => array('owner' => 'owner')));
|
||||||
$perms = $this->contacts->check_perms($this->contacts->grants[$check[0]['owner']],PHPGW_ACL_READ);
|
$perms = $this->contacts->check_perms($this->contacts->grants[$check[0]['owner']],PHPGW_ACL_READ);
|
||||||
|
|
||||||
if ( (!$perms) && ($check[0]['owner'] != $phpgw_info['user']['account_id']) )
|
if ( (!$perms) && ($check[0]['owner'] != $phpgw_info['user']['account_id']) )
|
||||||
@ -100,7 +100,7 @@
|
|||||||
$extrafields = array('address2' => 'address2');
|
$extrafields = array('address2' => 'address2');
|
||||||
$qfields = $this->contacts->stock_contact_fields + $extrafields;
|
$qfields = $this->contacts->stock_contact_fields + $extrafields;
|
||||||
|
|
||||||
$fieldlist = $this->bo->read_entry($ab_id,$qfields);
|
$fieldlist = $this->bo->read_entry(array('id' => $ab_id, 'fields' => $qfields));
|
||||||
$fields = $fieldlist[0];
|
$fields = $fieldlist[0];
|
||||||
|
|
||||||
$email = $fields['email'];
|
$email = $fields['email'];
|
||||||
|
Loading…
Reference in New Issue
Block a user