Enhance validation for select-account widget, which doesn't load all options - check that selected account is visible to the user instead of loading all or failing

This commit is contained in:
Nathan Gray 2012-06-13 15:21:41 +00:00
parent fb3672f950
commit 60843f9a1a

View File

@ -91,7 +91,9 @@ class etemplate_widget_menupopup extends etemplate_widget
}
foreach((array) $value as $val)
{
if (!($this->attrs['multiple'] && !$val) && !isset($allowed[$val]))
// Special for select-account - selOptions doesn't always load all accounts
if($this->attrs['type'] == 'select-account' && !$GLOBALS['egw']->accounts->visible($val) && !isset($allowed[$val]) ||
$this->attrs['type'] != 'select-account' && !($this->attrs['multiple'] && !$val) && !isset($allowed[$val]))
{
self::set_validation_error($form_name,lang("'%1' is NOT allowed ('%2')!",$val,implode("','",array_keys($allowed))),'');
$value = '';