mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 07:53:39 +01:00
Performance improvements for customfields where we have just 1 field, not the whole list
This commit is contained in:
parent
c63f465eb8
commit
d60d667bd3
@ -453,10 +453,10 @@ export class et2_customfields_list extends et2_valueWidget implements et2_IDetac
|
||||
{
|
||||
for(let key in data)
|
||||
{
|
||||
// Don't overwrite fields with global values
|
||||
if(global_data[key] && key !== 'fields')
|
||||
// Don't overwrite fields / customfields with global values
|
||||
if(global_data[key] && key !== 'fields' && !(key == "customfields" && typeof data.customfields != undefined))
|
||||
{
|
||||
data[key] = jQuery.extend(true, {}, data[key], global_data[key]);
|
||||
data[key] = {...data[key], ...global_data[key]};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -171,6 +171,17 @@ class Customfields extends Transformer
|
||||
$use_private = self::expand_name($this->attrs['private'] ?? null,0,0,'','',self::$cont);
|
||||
$this->attrs['type_filter'] = self::expand_name($this->attrs['type_filter'] ?? null,0,0,'','',self::$cont);
|
||||
|
||||
// check if name refers to a single custom field --> show only that
|
||||
$matches = null;
|
||||
if(($pos = strpos($form_name, $this->attrs['prefix'])) !== false && // allow the prefixed name to be an array index too
|
||||
preg_match($preg = '/' . $this->attrs['prefix'] . '([^\]]+)/', $form_name, $matches) && isset($fields[$name = $matches[1]]))
|
||||
{
|
||||
$fields = array($name => $fields[$name]);
|
||||
$value = self::get_array(self::$request->content, $form_name, false, true);
|
||||
$fields[$name]['value'] = $value;
|
||||
$form_name = $this->attrs['prefix'] . $name;
|
||||
}
|
||||
|
||||
foreach((array)$fields as $key => $field)
|
||||
{
|
||||
// remove private or non-private cf's, if only one kind should be displayed
|
||||
@ -193,16 +204,6 @@ class Customfields extends Transformer
|
||||
unset($fields[$key]);
|
||||
}
|
||||
}
|
||||
// check if name refers to a single custom field --> show only that
|
||||
$matches = null;
|
||||
if (($pos=strpos($form_name,$this->attrs['prefix'])) !== false && // allow the prefixed name to be an array index too
|
||||
preg_match($preg = '/'.$this->attrs['prefix'].'([^\]]+)/',$form_name,$matches) && isset($fields[$name=$matches[1]]))
|
||||
{
|
||||
$fields = array($name => $fields[$name]);
|
||||
$value = self::get_array(self::$request->content, $form_name, false, true);
|
||||
$fields[$name]['value'] = $value;
|
||||
$form_name = $this->attrs['prefix'] . $name;
|
||||
}
|
||||
|
||||
if(!is_array($fields)) $fields = array();
|
||||
switch($type = $this->type)
|
||||
|
Loading…
Reference in New Issue
Block a user