From 3980ba36923eb5e519703065ac8163f31b48b7c1 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Wed, 16 Feb 2011 17:56:00 +0000 Subject: [PATCH] Correct category formatting --- etemplate/inc/class.bo_merge.inc.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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; }