diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 5826e248b13..3483635c944 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4003,7 +4003,7 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode= if (verifCond($values[4])) { if ($values[3]) $langs->load($values[3]); - $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[5]),1); + $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', (! empty($object->id)?$object->id:''), $values[5]), 1); $head[$h][1] = $langs->trans($values[2]); $head[$h][2] = str_replace('+','',$values[1]); $h++; @@ -4013,7 +4013,7 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode= { if ($values[0] != $type) continue; if ($values[3]) $langs->load($values[3]); - $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[4]),1); + $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', (! empty($object->id)?$object->id:''), $values[4]), 1); $head[$h][1] = $langs->trans($values[2]); $head[$h][2] = str_replace('+','',$values[1]); $h++; @@ -4022,7 +4022,7 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode= { if ($values[0] != $type) continue; if ($values[2]) $langs->load($values[2]); - $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[3]),1); + $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', (! empty($object->id)?$object->id:''), $values[3]), 1); $head[$h][1] = $langs->trans($values[1]); $head[$h][2] = 'tab'.$values[1]; $h++;