mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 09:23:28 +01:00
* Tracker: fix slow rendering of edit popup for hugh number of tracker-user
doublicate check was iterating through all options for each option, causing it to take eg. 25s for 7000 options
This commit is contained in:
parent
3156134a31
commit
82f9190c32
@ -333,27 +333,21 @@ class etemplate_widget_menupopup extends etemplate_widget
|
||||
{
|
||||
$backup_options = $options;
|
||||
|
||||
$values = array();
|
||||
foreach($options as $value => &$label)
|
||||
{
|
||||
// Of course once we re-index the options, we can't detect duplicates
|
||||
// so check here, as we re-index
|
||||
// Duplicates might happen if app programmer isn't paying attention and
|
||||
// either uses the same ID in the template, or adds the options twice
|
||||
if(!is_array($label) || is_array($label) && !array_key_exists('value',$label))
|
||||
$check_value = (string)(is_array($label) && array_key_exists('value', $label) ? $label['value'] : $value);
|
||||
if (isset($values[$check_value]))
|
||||
{
|
||||
$check_value = (string)(is_array($label) && array_key_exists('value', $label) ? $label['value'] : $value);
|
||||
if((string)$value === $check_value)
|
||||
{
|
||||
foreach($options as $key => $existing)
|
||||
{
|
||||
if(is_array($existing) && isset($existing['value']) && (string)$existing['value'] === $check_value && $key != $value)
|
||||
{
|
||||
unset($options[$value]);
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($options[$value]);
|
||||
continue;
|
||||
}
|
||||
$values[$check_value] = $label;
|
||||
|
||||
if (is_null($use_array_of_objects) && is_numeric($value) && (!is_array($label) || !isset($label['value'])))
|
||||
{
|
||||
$options = $backup_options;
|
||||
|
Loading…
Reference in New Issue
Block a user