mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 23:00:56 +01:00
Fix category select fails server-side validation, probably related to 8ec106f22b
This commit is contained in:
parent
5a093813ac
commit
9722716d1a
@ -669,20 +669,24 @@ 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
|
||||||
|
$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))
|
(!$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']);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user