diff --git a/addressbook/inc/class.soaddressbook.inc.php b/addressbook/inc/class.soaddressbook.inc.php index e138978d85..b33a55bc37 100644 --- a/addressbook/inc/class.soaddressbook.inc.php +++ b/addressbook/inc/class.soaddressbook.inc.php @@ -102,9 +102,9 @@ } if ($this->rights & PHPGW_ACL_ADD) { - $this->contacts->add($fields['owner'],$fields,$fields['access'],$fields['cat_id'],$fields['tid']); + $id = $this->contacts->add($fields['owner'],$fields,$fields['access'],$fields['cat_id'],$fields['tid']); } - return; + return $id; } function get_lastid() diff --git a/addressbook/inc/class.uiaddressbook.inc.php b/addressbook/inc/class.uiaddressbook.inc.php index 562cc293fc..f26ac025ba 100644 --- a/addressbook/inc/class.uiaddressbook.inc.php +++ b/addressbook/inc/class.uiaddressbook.inc.php @@ -591,15 +591,14 @@ { global $phpgw,$phpgw_info,$ab_id; - $addnew = $this->bo->read_entry($ab_id,$this->contacts->stock_contact_fields,$phpgw_info['user']['account_id']); + $addnew = $this->bo->read_entry(array('id' => $ab_id, 'fields' => $this->contacts->stock_contact_fields)); $addnew[0]['note'] .= "\nCopied from ".$phpgw->accounts->id2name($addnew[0]['owner']).", record #".$addnew[0]['id']."."; $addnew[0]['owner'] = $phpgw_info['user']['account_id']; - $addnew[0]['id'] = ''; + unset($addnew[0]['id']); $fields = $addnew[0]; - $this->bo->add_entry($fields); - $ab_id = $this->bo->get_lastid(); + $ab_id = $this->bo->add_entry($fields); Header("Location: " . $phpgw->link('/index.php',"menuaction=addressbook.uiaddressbook.edit&ab_id=$ab_id")); } diff --git a/phpgwapi/inc/class.contacts_ldap.inc.php b/phpgwapi/inc/class.contacts_ldap.inc.php index 697397ca1d..f9495da7f9 100644 --- a/phpgwapi/inc/class.contacts_ldap.inc.php +++ b/phpgwapi/inc/class.contacts_ldap.inc.php @@ -582,6 +582,7 @@ . addslashes($name) . "','" . addslashes($value) . "')",__LINE__,__FILE__); } } + return $this->nextid; } function field_exists($id,$field_name) diff --git a/phpgwapi/inc/class.contacts_sql.inc.php b/phpgwapi/inc/class.contacts_sql.inc.php index 7ba5befae4..74813cdd2d 100644 --- a/phpgwapi/inc/class.contacts_sql.inc.php +++ b/phpgwapi/inc/class.contacts_sql.inc.php @@ -41,11 +41,11 @@ var $ext_table='phpgw_addressbook_extra'; var $account_id; - var $stock_contact_fields; /* This is an array of almost the fields in the phpgw_addressbook table, except id,owner,lid,tid,access,cat_id */ - var $non_contact_fields; /* Here are the rest */ - var $email_types; /* VCard email type array */ - var $total_records; /* This will contain numrows for data retrieved */ - var $grants; /* This holds all of the users that have granted access to there entrys */ + var $stock_contact_fields; /* This is an array of almost the fields in the phpgw_addressbook table, except id,owner,lid,tid,access,cat_id */ + var $non_contact_fields; /* Here are the rest */ + var $email_types; /* VCard email type array */ + var $total_records; /* This will contain numrows for data retrieved */ + var $grants; /* This holds all of the users that have granted access to there entrys */ function contacts_($useacl=True) { @@ -259,7 +259,7 @@ $this->db->query("SELECT id,lid,tid,owner,access,cat_id $t_fields FROM $this->std_table WHERE id='$id'",__LINE__,__FILE__); $this->db->next_record(); - $return_fields[0]['id'] = $this->db->f('id'); + $return_fields[0]['id'] = $this->db->f('id'); $return_fields[0]['lid'] = $this->db->f('lid'); $return_fields[0]['tid'] = $this->db->f('tid'); $return_fields[0]['owner'] = $this->db->f('owner'); @@ -579,6 +579,7 @@ . addslashes($name) . "','" . addslashes($value) . "')",__LINE__,__FILE__); } } + return $id; } function field_exists($id,$field_name)