mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
Fix category select fails server-side validation, probably related to 8ec106f22b
This commit is contained in:
parent
5a093813ac
commit
9722716d1a
@ -669,36 +669,40 @@ class Select extends Etemplate\Widget
|
|||||||
$no_lang = True;
|
$no_lang = True;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'select-cat': // !$type == globals cats too, $type2: extraStyleMultiselect, $type3: application, if not current-app, $type4: parent-id, $type5=owner (-1=global),$type6=show missing
|
case 'select-cat':
|
||||||
if ((!$type3 || $type3 === $GLOBALS['egw']->categories->app_name) &&
|
// !$type == globals cats too, $type2: extraStyleMultiselect, $type3: application, if not current-app, $type4: parent-id, $type5=owner (-1=global),$type6=show missing
|
||||||
(!$type5 || $type5 == $GLOBALS['egw']->categories->account_id))
|
$application = self::expand_name($widget->attrs['application'], 0, 0, '', '', self::$cont) ?? $type3;
|
||||||
|
$globalCategories = self::expand_name($widget->attrs['globalCategories'], 0, 0, '', '', self::$cont) ?? $type;
|
||||||
|
|
||||||
|
if((!$application || $application === $GLOBALS['egw']->categories->app_name) &&
|
||||||
|
(!$type5 || $type5 == $GLOBALS['egw']->categories->account_id))
|
||||||
{
|
{
|
||||||
$categories = $GLOBALS['egw']->categories;
|
$categories = $GLOBALS['egw']->categories;
|
||||||
}
|
}
|
||||||
else // we need to instanciate a new cat object for the correct application
|
else // we need to instanciate a new cat object for the correct application
|
||||||
{
|
{
|
||||||
$categories = new Api\Categories($type5,$type3);
|
$categories = new Api\Categories($type5, $application);
|
||||||
}
|
}
|
||||||
// Allow text for global
|
// Allow text for global
|
||||||
$type = ($type && strlen($type) > 1 ? $type : !$type);
|
$globalCategories = ($globalCategories && strlen($globalCategories) > 1 ? $globalCategories : !$globalCategories);
|
||||||
// we cast $type4 (parent) to int, to get default of 0 if omitted
|
// we cast $type4 (parent) to int, to get default of 0 if omitted
|
||||||
foreach((array)$categories->return_sorted_array(0,False,'','','',$type,(int)$type4,true) as $cat)
|
foreach((array)$categories->return_sorted_array(0, False, '', '', '', $globalCategories, (int)$type4, true) as $cat)
|
||||||
{
|
{
|
||||||
$s = str_repeat(' ',$cat['level']) . stripslashes($cat['name']);
|
$s = str_repeat(' ', $cat['level']) . stripslashes($cat['name']);
|
||||||
|
|
||||||
if (Api\Categories::is_global($cat))
|
if(Api\Categories::is_global($cat))
|
||||||
{
|
{
|
||||||
$s .= Api\Categories::$global_marker;
|
$s .= Api\Categories::$global_marker;
|
||||||
}
|
}
|
||||||
$options[$cat['id']] = array(
|
$options[$cat['id']] = array(
|
||||||
'label' => $s,
|
'label' => $s,
|
||||||
'title' => $cat['description'],
|
'title' => $cat['description'],
|
||||||
// These are extra info for easy dealing with categories
|
// These are extra info for easy dealing with categories
|
||||||
// client side, without extra loading
|
// client side, without extra loading
|
||||||
'main' => (int)$cat['main'],
|
'main' => (int)$cat['main'],
|
||||||
'children' => $cat['children'] ?? null,
|
'children' => $cat['children'] ?? null,
|
||||||
//add different class per level to allow different styling for each category level:
|
//add different class per level to allow different styling for each category level:
|
||||||
'class' => "cat_level" . $cat['level'] . " cat_{$cat['id']}"
|
'class' => "cat_level" . $cat['level'] . " cat_{$cat['id']}"
|
||||||
);
|
);
|
||||||
// Send data too
|
// Send data too
|
||||||
if(is_array($cat['data']))
|
if(is_array($cat['data']))
|
||||||
|
Loading…
Reference in New Issue
Block a user