diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 4a7047e67a1..8567ef595a0 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -916,7 +916,6 @@ class ExtraFields $this->attribute_list[$tab->name]=$tab->list; $this->attribute_totalizable[$tab->name]=$tab->totalizable; $this->attribute_entityid[$tab->name]=$tab->entity; - $this->attribute_entitylabel[$tab->name]=(empty($labelmulticompany[$tab->entity])?'Entity'.$tab->entity:$labelmulticompany[$tab->entity]); // New usage $this->attributes[$tab->elementtype]['type'][$tab->name]=$tab->type; @@ -935,7 +934,6 @@ class ExtraFields $this->attributes[$tab->elementtype]['list'][$tab->name]=$tab->list; $this->attributes[$tab->elementtype]['totalizable'][$tab->name]=$tab->totalizable; $this->attributes[$tab->elementtype]['entityid'][$tab->name]=$tab->entity; - $this->attributes[$tab->elementtype]['entitylabel'][$tab->name]=(empty($labelmulticompany[$tab->entity])?'Entity'.$tab->entity:$labelmulticompany[$tab->entity]); $this->attributes[$tab->elementtype]['enabled'][$tab->name]=$tab->enabled; $this->attributes[$tab->elementtype]['help'][$tab->name]=$tab->help; diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php index 7f3c4d7c8e5..0ddd3f5a8fa 100644 --- a/htdocs/core/tpl/admin_extrafields_view.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php @@ -94,7 +94,22 @@ if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafiel print ''.$extrafields->attributes[$elementtype]['list'][$key]."\n"; print ''.yn($extrafields->attributes[$elementtype]['totalizable'][$key])."\n"; if (! empty($conf->multicompany->enabled)) { - print ''.($extrafields->attributes[$elementtype]['entityid'][$key]==0?$langs->trans("All"):$extrafields->attributes[$elementtype]['entitylabel'][$key]).''; + print ''; + if (empty($extrafields->attributes[$elementtype]['entityid'][$key])) + { + print $langs->trans("All"); + } + else { + global $multicompanylabel_cache; + if (! is_array($multicompanylabel_cache)) $multicompanylabel_cache = array(); + if (empty($multicompanylabel_cache[$extrafields->attributes[$elementtype]['entityid'][$key]])) { + global $mc; + $mc->getInfo($extrafields->attributes[$elementtype]['entityid'][$key]); + $multicompanylabel_cache[$extrafields->attributes[$elementtype]['entityid'][$key]] = $mc->label ? $mc->label : $extrafields->attributes[$elementtype]['entityid'][$key]; + } + print $multicompanylabel_cache[$extrafields->attributes[$elementtype]['entityid'][$key]]; + } + print ''; } print ''.img_edit().''; print "  ".img_delete()."\n";