mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-17 02:41:02 +01:00
fix for the optgroupfeature, which messed up some callback checking (validation) of the selected values.
This is since the assumption of being an array as value of the selectkey is a sufficient marker to recognize an optgroup does not always match for optgroups only. Projectmember roles dialog employs select options with label/title arrays as value
This commit is contained in:
parent
a0e5556c62
commit
5f9104250b
@ -1493,18 +1493,24 @@ foreach($sess as $key => $val)
|
|||||||
if (!isset($GLOBALS['egw_info']['etemplate']['to_process'][$form_name]))
|
if (!isset($GLOBALS['egw_info']['etemplate']['to_process'][$form_name]))
|
||||||
{
|
{
|
||||||
// fix for optgroup's
|
// fix for optgroup's
|
||||||
|
$options=array();
|
||||||
foreach($sels as $key => $val)
|
foreach($sels as $key => $val)
|
||||||
{
|
{
|
||||||
|
# we want the key anyway, even if this allowes more values than wanted (the name/key of the optgroup if there is one,
|
||||||
|
# the keys of the arrays in case you have key/value pair(s) as value for the value of your option ).
|
||||||
|
$options[$key]=$key;
|
||||||
if (is_array($val))
|
if (is_array($val))
|
||||||
{
|
{
|
||||||
$sels += array_keys($val);
|
foreach(array_keys($val) as $key2)
|
||||||
unset($sels[$key]);
|
{
|
||||||
|
$options[$key2]=$key2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$GLOBALS['egw_info']['etemplate']['to_process'][$form_name] = array(
|
$GLOBALS['egw_info']['etemplate']['to_process'][$form_name] = array(
|
||||||
'type' => $cell['type'],
|
'type' => $cell['type'],
|
||||||
'needed' => $cell['needed'],
|
'needed' => $cell['needed'],
|
||||||
'allowed' => array_keys($sels),
|
'allowed' => array_keys($options),
|
||||||
'multiple'=> $multiple,
|
'multiple'=> $multiple,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user