From b2da5d14f09594ff2a4cfe504dc8be70c1e94366 Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Mon, 26 Mar 2001 23:41:34 +0000 Subject: [PATCH] Fix addition of hr profiles --- addressbook/add.php | 2 +- addressbook/inc/class.contacts_sql.inc.php | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/addressbook/add.php b/addressbook/add.php index 0aed37282e..00cf191529 100755 --- a/addressbook/add.php +++ b/addressbook/add.php @@ -61,7 +61,7 @@ $addnew['owner'] = $phpgw_info["user"]["account_id"]; $addnew['id'] = ''; - if ($account=True) { addressbook_add_entry($addnew['owner'],$addnew,'','',True); } + if ($addnew['tid']) { addressbook_add_entry($addnew['owner'],$addnew,'','',$addnew['tid']); } else { addressbook_add_entry($addnew['owner'],$addnew); } $fields = addressbook_read_last_entry($qfields); diff --git a/addressbook/inc/class.contacts_sql.inc.php b/addressbook/inc/class.contacts_sql.inc.php index d9afac4455..3c89c1bf0c 100644 --- a/addressbook/inc/class.contacts_sql.inc.php +++ b/addressbook/inc/class.contacts_sql.inc.php @@ -483,14 +483,18 @@ return $return_fields; } - function add($owner,$fields,$access='',$cat_id='') + function add($owner,$fields,$access='',$cat_id='',$tid='n') { list($stock_fields,$stock_fieldnames,$extra_fields) = $this->split_stock_and_extras($fields); //$this->db->lock(array("contacts")); - $this->db->query("insert into $this->std_table (owner,access,cat_id," + if ($fields['lid']) { + $lid[0] = 'lid,'; + $lid[1] = $fields['lid']."','"; + } + $this->db->query("insert into $this->std_table (owner,access,cat_id,tid,".$lid[0] . implode(",",$this->stock_contact_fields) - . ") values ('$owner','$access','$cat_id','" + . ") values ('$owner','$access','$cat_id','$tid','".$lid[1] . implode("','",$this->loop_addslashes($stock_fields)) . "')",__LINE__,__FILE__); $this->db->query("select max(id) from $this->std_table ",__LINE__,__FILE__);