From 47de296d7e40da013dcedcb9574ed9836d5f7477 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Mar 2024 13:20:37 +0100 Subject: [PATCH] Fix to allow include several times the customreport --- htdocs/core/customreports.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index ca7d4fb26c2..5e5d6297d56 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -1118,10 +1118,11 @@ if ($mode == 'graph') { $dir = $conf->user->dir_temp; dol_mkdir($dir); - $filenamenb = $dir.'/customreport_'.$object->element.'.png'; - $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=user&file=customreport_'.$object->element.'.png'; + // $customreportkey may be defined when using customreports.php as an include + $filenamekey = $dir.'/customreport_'.$object->element.(empty($customreportkey) ? '' : $customreportkey).'.png'; + $fileurlkey = DOL_URL_ROOT.'/viewimage.php?modulepart=user&file=customreport_'.$object->element.(empty($customreportkey) ? '' : $customreportkey).'.png'; - $px1->draw($filenamenb, $fileurlnb); + $px1->draw($filenamekey, $fileurlkey); $texttoshow = $langs->trans("NoRecordFound"); if (!GETPOSTISSET('search_measures') || !GETPOSTISSET('search_xaxis')) {