diff --git a/etemplate/inc/class.bo_merge.inc.php b/etemplate/inc/class.bo_merge.inc.php index 92f8dd9aa6..09c71016a6 100644 --- a/etemplate/inc/class.bo_merge.inc.php +++ b/etemplate/inc/class.bo_merge.inc.php @@ -232,10 +232,16 @@ abstract class bo_merge foreach(is_array($contact['cat_id']) ? $contact['cat_id'] : explode(',',$contact['cat_id']) as $cat_id) { if(!$cat_id) continue; - $cats[] = $GLOBALS['egw']->categories->id2name($cat_id,'path'); + $cats[$GLOBALS['egw']->categories->id2name($cat_id,'main')] = array(); + if($GLOBALS['egw']->categories->id2name($cat_id,'main') != $cat_id) + { + $cats[$GLOBALS['egw']->categories->id2name($cat_id,'main')][] = $GLOBALS['egw']->categories->id2name($cat_id,'name'); + } + } + foreach($cats as $main => $cat) { + $replacements['$$'.($prefix ? $prefix.'/':'').'categories$$'] .= $GLOBALS['egw']->categories->id2name($main,'name') + . (count($cat) > 0 ? ': ' : '') . implode(', ', $cats[$main]) . "\n"; } - $replacements['$$'.($prefix ? $prefix.'/':'').'categories$$'] = implode("\n",$cats); - return $replacements; }