forked from extern/egroupware
Make contacts->add() return the id, since it finds it anyway
This commit is contained in:
parent
09a1130896
commit
66013bfe3c
@ -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()
|
||||||
|
@ -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"));
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
|
@ -41,11 +41,11 @@
|
|||||||
var $ext_table='phpgw_addressbook_extra';
|
var $ext_table='phpgw_addressbook_extra';
|
||||||
|
|
||||||
var $account_id;
|
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 $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 $non_contact_fields; /* Here are the rest */
|
||||||
var $email_types; /* VCard email type array */
|
var $email_types; /* VCard email type array */
|
||||||
var $total_records; /* This will contain numrows for data retrieved */
|
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 $grants; /* This holds all of the users that have granted access to there entrys */
|
||||||
|
|
||||||
function contacts_($useacl=True)
|
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->query("SELECT id,lid,tid,owner,access,cat_id $t_fields FROM $this->std_table WHERE id='$id'",__LINE__,__FILE__);
|
||||||
$this->db->next_record();
|
$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]['lid'] = $this->db->f('lid');
|
||||||
$return_fields[0]['tid'] = $this->db->f('tid');
|
$return_fields[0]['tid'] = $this->db->f('tid');
|
||||||
$return_fields[0]['owner'] = $this->db->f('owner');
|
$return_fields[0]['owner'] = $this->db->f('owner');
|
||||||
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user