Correct category formatting

This commit is contained in:
Nathan Gray 2011-02-16 17:56:00 +00:00
parent 0c97c3bd10
commit 3980ba3692

View File

@ -232,10 +232,16 @@ abstract class bo_merge
foreach(is_array($contact['cat_id']) ? $contact['cat_id'] : explode(',',$contact['cat_id']) as $cat_id) foreach(is_array($contact['cat_id']) ? $contact['cat_id'] : explode(',',$contact['cat_id']) as $cat_id)
{ {
if(!$cat_id) continue; 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; return $replacements;
} }