From 0e7770dc71e3907e6f9c97c8e7cf0cb342a8941b Mon Sep 17 00:00:00 2001 From: Florian Mortgat <50440633+atm-florianm@users.noreply.github.com> Date: Thu, 7 Aug 2025 20:01:06 +0200 Subject: [PATCH] FIX: extrafields of type "int" not displayed on `projet/tasks.php` (#34896) + fix warning "Undefined variable $object" --- htdocs/core/tpl/extrafields_list_print_fields.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php index e7fb7e0ac2b..d2272a7702c 100644 --- a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php @@ -56,7 +56,7 @@ if (!empty($extrafieldsobjectkey) && !empty($extrafields->attributes[$extrafield } $value = $datenotinstring; } elseif (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$key], array('int'))) { - $value = (!empty($obj->$tmpkey) || $obj->$tmpkey === '0' ? $obj->$tmpkey : ''); + $value = $obj->$tmpkey ?? (isset($obj->array_options[$tmpkey]) ? $obj->array_options[$tmpkey] : null) ?? ''; } else { // The key may be in $obj->array_options if not in $obj $value = (isset($obj->$tmpkey) ? $obj->$tmpkey : @@ -71,7 +71,7 @@ if (!empty($extrafieldsobjectkey) && !empty($extrafields->attributes[$extrafield } } - $valuetoshow = $extrafields->showOutputField($key, $value, '', $extrafieldsobjectkey, null, $object); + $valuetoshow = $extrafields->showOutputField($key, $value, '', $extrafieldsobjectkey, null, $object ?? null); $title = dol_string_nohtmltag($valuetoshow); print '