allow to specify cats by there id again

This commit is contained in:
Ralf Becker 2004-09-02 10:17:37 +00:00
parent 9819f08b48
commit c6c034b291

View File

@ -93,9 +93,7 @@
return ''; return '';
} }
$cats = split('[,;]',$cats); foreach(split('[,;]',$cats) as $cat)
foreach($cats as $k => $cat)
{ {
if (isset($cat2id[$cat])) if (isset($cat2id[$cat]))
{ {
@ -107,7 +105,11 @@
{ {
$GLOBALS['phpgw']->categories = createobject('phpgwapi.categories'); $GLOBALS['phpgw']->categories = createobject('phpgwapi.categories');
} }
if ($id = $GLOBALS['phpgw']->categories->name2id( addslashes($cat) )) if (is_numeric($cat) && $GLOBALS['phpgw']->categories->id2name($cat) != '--')
{
$cat2id[$cat] = $ids[$cat] = $cat;
}
elseif ($id = $GLOBALS['phpgw']->categories->name2id( addslashes($cat) ))
{ // cat exists { // cat exists
$cat2id[$cat] = $ids[$cat] = $id; $cat2id[$cat] = $ids[$cat] = $id;
} }