Make sure we use the right app when cleaning select-cat value

This commit is contained in:
nathan 2023-02-24 14:23:11 -07:00
parent bbd41b4255
commit 04bedf30be

View File

@ -12,6 +12,7 @@
namespace EGroupware\Api\Etemplate\Widget; namespace EGroupware\Api\Etemplate\Widget;
use EGroupware\Api\Acl;
use EGroupware\Api\Etemplate; use EGroupware\Api\Etemplate;
use EGroupware\Api; use EGroupware\Api;
@ -432,6 +433,18 @@ class Select extends Etemplate\Widget
'', '',
$no_lang, $this->attrs['readonly'] ?? false, self::get_array(self::$request->content, $form_name), $form_name $no_lang, $this->attrs['readonly'] ?? false, self::get_array(self::$request->content, $form_name), $form_name
); );
// Remove unavailable from value
$application = self::expand_name($this->attrs['application'], 0, 0, '', '', self::$cont);
if(!$application || $application === $GLOBALS['egw']->categories->app_name)
{
$categories = $GLOBALS['egw']->categories;
}
else // we need to instanciate a new cat object for the correct application
{
$categories = new Api\Categories('', $application);
}
$value =& self::get_array(self::$request->content, $form_name, true);
$value = $categories->check_list(Acl::READ, $value);
break; break;
} }
} }