FIX: extrafields of type "int" not displayed on projet/tasks.php (#34896)

+ fix warning "Undefined variable $object"
This commit is contained in:
Florian Mortgat 2025-08-07 20:01:06 +02:00 committed by GitHub
parent 2c073b37c0
commit 0e7770dc71
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 '<td'.($cssclass ? ' class="'.$cssclass.'"' : ''); // TODO Add 'css' and 'cssview' and 'csslist' for extrafields and use here 'csslist'