From eac3a6cf86ac872f7cb868468fd715a44d08f634 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Mar 2022 16:38:57 +0100 Subject: [PATCH] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 517d09ba453..89ba7147694 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8771,15 +8771,18 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, complete_substitutions_array($substitutionarray, $langs, $object, array('needforkey'=>$values[2])); $label = make_substitutions($reg[1], $substitutionarray); } else { - $labeltemp = explode(',', $values[2]); + $labeltemp = explode(':', $values[2]); $label = $langs->trans($labeltemp[0]); if (!empty($labeltemp[1]) && is_object($object) && !empty($object->id)) { dol_include_once($labeltemp[2]); - $obj = new $labeltemp[1]($db); - $function = $labeltemp[3]; - if (method_exists($obj, $function)) { - $nbrec = $obj->$function($object->id, $obj); - $label .= ''.$nbrec.''; + $classtoload = $labeltemp[1]; + if (class_exists($classtoload)) { + $obj = new $classtoload($db); + $function = $labeltemp[3]; + if (method_exists($obj, $function)) { + $nbrec = $obj->$function($object->id, $obj); + $label .= ''.$nbrec.''; + } } } }