diff --git a/addressbook/inc/class.boaddressbook.inc.php b/addressbook/inc/class.boaddressbook.inc.php index bb6537f879..58f3af85d8 100644 --- a/addressbook/inc/class.boaddressbook.inc.php +++ b/addressbook/inc/class.boaddressbook.inc.php @@ -23,6 +23,9 @@ 'add_email' => True, 'update_entry' => True ); + + var $xml_functions = array(); + var $soap_functions = array( 'read_entries' => array( 'in' => array( @@ -109,6 +112,20 @@ if(isset($order)) { $this->order = $order; } if(isset($filter)) { $this->filter = $filter; } 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) @@ -162,17 +179,25 @@ 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; if($this->debug) { echo '
Total records="' . $this->total . '"'; } 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); } diff --git a/addressbook/inc/class.soaddressbook.inc.php b/addressbook/inc/class.soaddressbook.inc.php index 4a48c96eee..e138978d85 100644 --- a/addressbook/inc/class.soaddressbook.inc.php +++ b/addressbook/inc/class.soaddressbook.inc.php @@ -92,7 +92,7 @@ } } - function add_entry($userid,$fields) + function add_entry($fields) { $this->makeobj(); $fields['tid'] = trim($fields['tid']); @@ -102,7 +102,7 @@ } 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; } @@ -115,22 +115,22 @@ return $ab_id; } - function update_entry($userid,$fields) + function update_entry($fields) { $this->makeobj(); 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; } - function delete_entry($ab_id) + function delete_entry($data) { $this->makeobj(); if ($this->rights & PHPGW_ACL_DELETE) { - $this->contacts->delete($ab_id); + $this->contacts->delete($data['id']); } return; } diff --git a/addressbook/inc/class.uiaddressbook.inc.php b/addressbook/inc/class.uiaddressbook.inc.php index b8dfff69cc..562cc293fc 100644 --- a/addressbook/inc/class.uiaddressbook.inc.php +++ b/addressbook/inc/class.uiaddressbook.inc.php @@ -416,7 +416,12 @@ else { /* 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; } @@ -574,7 +579,8 @@ $fields['tid'] = 'n'; $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(); Header('Location: ' @@ -592,7 +598,7 @@ $addnew[0]['id'] = ''; $fields = $addnew[0]; - $this->bo->add_entry($fields['owner'],$fields); + $this->bo->add_entry($fields); $ab_id = $this->bo->get_lastid(); Header("Location: " . $phpgw->link('/index.php',"menuaction=addressbook.uiaddressbook.edit&ab_id=$ab_id")); @@ -643,7 +649,7 @@ { $fields = $this->get_form(); /* _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']) { @@ -653,6 +659,7 @@ { $userid = $phpgw_info['user']['account_id']; } + $fields['owner'] = $userid; $referer = urlencode($fields['referer']); unset($fields['referer']); @@ -664,7 +671,7 @@ } /* 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']) ) { @@ -680,7 +687,7 @@ /* merge in extra fields */ $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->template->set_file(array('edit' => 'edit.tpl')); @@ -719,7 +726,7 @@ 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']) { @@ -745,7 +752,7 @@ } 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')); } @@ -756,7 +763,7 @@ global $phpgw,$phpgw_info,$ab_id,$submit,$referer; /* 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); @@ -816,7 +823,7 @@ /* merge in extra fields */ $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']; diff --git a/addressbook/inc/class.uivcard.inc.php b/addressbook/inc/class.uivcard.inc.php index b2748e495d..03d97b82c7 100644 --- a/addressbook/inc/class.uivcard.inc.php +++ b/addressbook/inc/class.uivcard.inc.php @@ -88,7 +88,7 @@ } // 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); if ( (!$perms) && ($check[0]['owner'] != $phpgw_info['user']['account_id']) ) @@ -100,7 +100,7 @@ $extrafields = array('address2' => 'address2'); $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]; $email = $fields['email'];