Some fixes to ensure we don't put accting fields into the extra table

This commit is contained in:
Miles Lott 2001-09-09 22:55:43 +00:00
parent dd199143a4
commit f3be3189e4
2 changed files with 30 additions and 8 deletions

View File

@ -104,7 +104,18 @@
} }
if ($this->rights & PHPGW_ACL_ADD) 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; return $id;
} }
@ -120,9 +131,17 @@
{ {
if ($this->rights & PHPGW_ACL_EDIT) 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']); 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; return;
} }

View File

@ -538,19 +538,22 @@
function add($owner,$fields,$access='',$cat_id='',$tid='n') function add($owner,$fields,$access='',$cat_id='',$tid='n')
{ {
list($stock_fields,$stock_fieldnames,$extra_fields) = $this->split_stock_and_extras($fields); $tid = $fields['tid'] ? trim($fields['tid']) : $tid;
unset($fields['tid']);
$fields['tid'] = trim($fields['tid']); if(empty($tid))
if(empty($fields['tid']))
{ {
$fields['tid'] = 'n'; $tid = 'n';
} }
if ($fields['lid']) if ($fields['lid'])
{ {
$lid[0] = 'lid,'; $lid[0] = 'lid,';
$lid[1] = $fields['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] $this->db->query("INSERT INTO $this->std_table (owner,access,cat_id,tid,".$lid[0]
. implode(",",$this->stock_contact_fields) . implode(",",$this->stock_contact_fields)
. ") VALUES ('$owner','$access','$cat_id','$tid','".$lid[1] . ") VALUES ('$owner','$access','$cat_id','$tid','".$lid[1]