Make add work for multiple cats, fix edit to write ,$value, instead of $value

This commit is contained in:
Miles Lott 2001-05-26 11:25:08 +00:00
parent 33337decd9
commit 3bcb19e767
3 changed files with 10 additions and 3 deletions

View File

@ -196,7 +196,9 @@
$fields['access'] = 'public'; $fields['access'] = 'public';
} }
$fields["cat_id"] = $cat_id; $fields['cat_id'] = is_array($cat_id) ? implode(',',$cat_id) : $cat_id;
// make sure commas surround each value
$fields['cat_id'] = ',' . $fields['cat_id'] . ',';
addressbook_add_entry($phpgw_info['user']['account_id'],$fields,$fields['access'],$fields['cat_id']); addressbook_add_entry($phpgw_info['user']['account_id'],$fields,$fields['access'],$fields['cat_id']);
$ab_id = addressbook_get_lastid(); $ab_id = addressbook_get_lastid();

View File

@ -205,6 +205,8 @@
} }
$fields['cat_id'] = is_array($cat_id) ? implode(',',$cat_id) : $cat_id; $fields['cat_id'] = is_array($cat_id) ? implode(',',$cat_id) : $cat_id;
// make sure commas surround each value
$fields['cat_id'] = ',' . $fields['cat_id'] . ',';
if (($this->grants[$check[0]['owner']] & PHPGW_ACL_EDIT) && $check[0]['owner'] != $phpgw_info['user']['account_id']) if (($this->grants[$check[0]['owner']] & PHPGW_ACL_EDIT) && $check[0]['owner'] != $phpgw_info['user']['account_id'])
{ {

View File

@ -204,10 +204,13 @@
if ($cats[1]) if ($cats[1])
{ {
while (list($key,$thiscat) = each($cats)) while (list($key,$thiscat) = each($cats))
{
if ($thiscat)
{ {
$catinfo = $cat->return_single($thiscat); $catinfo = $cat->return_single($thiscat);
$catname .= $catinfo[0]['name'] . '; '; $catname .= $catinfo[0]['name'] . '; ';
} }
}
if (!$cat_id) if (!$cat_id)
{ {
$cat_id = $cats[0]; $cat_id = $cats[0];