From a93cb8b5727d1f211e37b02643d2762d2011818d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 26 Apr 2023 10:56:52 +0200 Subject: [PATCH] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 29 +++++++++++++----------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 39a24f830b2..a101181d7cb 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -735,21 +735,24 @@ abstract class CommonObject $MAX_EXTRAFIELDS_TO_SHOW_IN_TOOLTIP = getDolGlobalInt('MAX_EXTRAFIELDS_TO_SHOW_IN_TOOLTIP', 5); $datas = $this->getTooltipContentArray($params); - + $count = 0; // Add extrafields if (!empty($extrafields->attributes[$this->table_element]['label'])) { - if ($extrafields->attributes[$this->table_element]['count'] < $MAX_EXTRAFIELDS_TO_SHOW_IN_TOOLTIP) { - foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) { - if (!empty($extrafields->attributes[$this->table_element]['langfile'][$key])) { - $langs->load($extrafields->attributes[$this->table_element]['langfile'][$key]); - } - $labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]); - if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') { - $datas[$key]= '
'. $labelextra . ''; - } else { - $value = (empty($this->array_options['options_' . $key]) ? '' : $this->array_options['options_' . $key]); - $datas[$key]= '
'. $labelextra . ': ' . $extrafields->showOutputField($key, $value, '', $this->table_element); - } + foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) { + if ($count >= $MAX_EXTRAFIELDS_TO_SHOW_IN_TOOLTIP) { + $datas['more_extrafields'] = '
.../...'; + break; + } + if (!empty($extrafields->attributes[$this->table_element]['langfile'][$key])) { + $langs->load($extrafields->attributes[$this->table_element]['langfile'][$key]); + } + $labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]); + if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') { + $datas[$key]= '
'. $labelextra . ''; + } else { + $value = (empty($this->array_options['options_' . $key]) ? '' : $this->array_options['options_' . $key]); + $datas[$key]= '
'. $labelextra . ': ' . $extrafields->showOutputField($key, $value, '', $this->table_element); + $count++; } } }