From 2056ed6897766b534db348f242c9bab05e2b6986 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 23 Jul 2007 09:21:22 +0000 Subject: [PATCH] remove not (longer) existing or inaccessible cats --- etemplate/inc/class.select_widget.inc.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/etemplate/inc/class.select_widget.inc.php b/etemplate/inc/class.select_widget.inc.php index 6b3b597890..64cdea290b 100644 --- a/etemplate/inc/class.select_widget.inc.php +++ b/etemplate/inc/class.select_widget.inc.php @@ -171,9 +171,20 @@ if ($readonly) // for readonly we dont need to fetch all cat's, nor do we need to indent them by level { $cell['no_lang'] = True; - foreach(is_array($value) ? $value : (strpos($value,',') !== false ? explode(',',$value) : array($value)) as $id) + if ($value) { - if ($id) $cell['sel_options'][$id] = stripslashes($GLOBALS['egw']->categories->id2name($id)); + if (!is_array($value)) $value = explode(',',$value); + foreach($value as $key => $id) + { + if ($id && ($name = stripslashes($GLOBALS['egw']->categories->id2name($id))) && $name != '--') + { + $cell['sel_options'][$id] = $name; + } + else + { + unset($value[$key]); // remove not (longer) existing or inaccessible cats + } + } } break; }