Make contacts->add() return the id, since it finds it anyway

This commit is contained in:
Miles Lott 2001-08-09 00:32:59 +00:00
parent 09a1130896
commit 66013bfe3c
4 changed files with 13 additions and 12 deletions

View File

@ -102,9 +102,9 @@
} }
if ($this->rights & PHPGW_ACL_ADD) 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() function get_lastid()

View File

@ -591,15 +591,14 @@
{ {
global $phpgw,$phpgw_info,$ab_id; 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]['note'] .= "\nCopied from ".$phpgw->accounts->id2name($addnew[0]['owner']).", record #".$addnew[0]['id'].".";
$addnew[0]['owner'] = $phpgw_info['user']['account_id']; $addnew[0]['owner'] = $phpgw_info['user']['account_id'];
$addnew[0]['id'] = ''; unset($addnew[0]['id']);
$fields = $addnew[0]; $fields = $addnew[0];
$this->bo->add_entry($fields); $ab_id = $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")); Header("Location: " . $phpgw->link('/index.php',"menuaction=addressbook.uiaddressbook.edit&ab_id=$ab_id"));
} }

View File

@ -582,6 +582,7 @@
. addslashes($name) . "','" . addslashes($value) . "')",__LINE__,__FILE__); . addslashes($name) . "','" . addslashes($value) . "')",__LINE__,__FILE__);
} }
} }
return $this->nextid;
} }
function field_exists($id,$field_name) function field_exists($id,$field_name)

View File

@ -579,6 +579,7 @@
. addslashes($name) . "','" . addslashes($value) . "')",__LINE__,__FILE__); . addslashes($name) . "','" . addslashes($value) . "')",__LINE__,__FILE__);
} }
} }
return $id;
} }
function field_exists($id,$field_name) function field_exists($id,$field_name)