diff --git a/addressbook/inc/class.soaddressbook.inc.php b/addressbook/inc/class.soaddressbook.inc.php index 91db7deb5b..438eb88dd2 100644 --- a/addressbook/inc/class.soaddressbook.inc.php +++ b/addressbook/inc/class.soaddressbook.inc.php @@ -104,7 +104,18 @@ } if ($this->rights & PHPGW_ACL_ADD) { - $id = $this->contacts->add($fields['owner'],$fields,$fields['access'],$fields['cat_id'],$fields['tid']); + $ab_id = $fields['ab_id']; + $owner = $fields['owner']; + $access = $fields['access']; + $cat_id = $fields['cat_id']; + $tid = $fields['tid']; + unset($fields['owner']); + unset($fields['access']); + unset($fields['cat_id']); + unset($fields['ab_id']); + unset($fields['tid']); + + $id = $this->contacts->add($owner,$fields,$access,$cat_id,$tid); } return $id; } @@ -120,9 +131,17 @@ { if ($this->rights & PHPGW_ACL_EDIT) { - $owner = $fields['owner']; + $ab_id = $fields['ab_id']; + $owner = $fields['owner']; + $access = $fields['access']; + $cat_id = $fields['cat_id']; unset($fields['owner']); - $this->contacts->update($fields['ab_id'],$owner,$fields,$fields['access'],$fields['cat_id']); + unset($fields['access']); + unset($fields['cat_id']); + unset($fields['ab_id']); + unset($fields['tid']); + + $this->contacts->update($ab_id,$owner,$fields,$access,$cat_id); } return; } diff --git a/phpgwapi/inc/class.contacts_sql.inc.php b/phpgwapi/inc/class.contacts_sql.inc.php index d2b625d96a..84aff6998f 100644 --- a/phpgwapi/inc/class.contacts_sql.inc.php +++ b/phpgwapi/inc/class.contacts_sql.inc.php @@ -538,19 +538,22 @@ function add($owner,$fields,$access='',$cat_id='',$tid='n') { - list($stock_fields,$stock_fieldnames,$extra_fields) = $this->split_stock_and_extras($fields); - - $fields['tid'] = trim($fields['tid']); - if(empty($fields['tid'])) + $tid = $fields['tid'] ? trim($fields['tid']) : $tid; + unset($fields['tid']); + if(empty($tid)) { - $fields['tid'] = 'n'; + $tid = 'n'; } if ($fields['lid']) { $lid[0] = 'lid,'; $lid[1] = $fields['lid']."','"; + unset($fields['lid']); } + + list($stock_fields,$stock_fieldnames,$extra_fields) = $this->split_stock_and_extras($fields); + $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','$tid','".$lid[1]