method_exists skip fatal error

This commit is contained in:
BB2A Anthony Berton 2022-03-18 16:34:44 +01:00
parent cef9cf8670
commit 006dc787c1

View File

@ -8778,8 +8778,10 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type,
dol_include_once($labeltemp[2]);
$obj = new $labeltemp[1]($db);
$function = $labeltemp[3];
$nbrec = $obj->$function($object->id, $obj);
$label .= '<span class="badge marginleftonlyshort">'.$nbrec.'</span>';
if (method_exists($obj, $function)) {
$nbrec = $obj->$function($object->id, $obj);
$label .= '<span class="badge marginleftonlyshort">'.$nbrec.'</span>';
}
}
} else {
$label = $langs->trans($values[2]);