diff --git a/addressbook/add.php b/addressbook/add.php index 741d10cce1..da760fe4ac 100755 --- a/addressbook/add.php +++ b/addressbook/add.php @@ -196,7 +196,9 @@ $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']); $ab_id = addressbook_get_lastid(); diff --git a/addressbook/edit.php b/addressbook/edit.php index e2d0903496..e71007c52b 100755 --- a/addressbook/edit.php +++ b/addressbook/edit.php @@ -205,6 +205,8 @@ } $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']) { diff --git a/addressbook/view.php b/addressbook/view.php index d9f75531c4..07626f7c77 100755 --- a/addressbook/view.php +++ b/addressbook/view.php @@ -205,8 +205,11 @@ { while (list($key,$thiscat) = each($cats)) { - $catinfo = $cat->return_single($thiscat); - $catname .= $catinfo[0]['name'] . '; '; + if ($thiscat) + { + $catinfo = $cat->return_single($thiscat); + $catname .= $catinfo[0]['name'] . '; '; + } } if (!$cat_id) {