Skip to content

Commit 6e111fe

Browse files
Jon BendtsenJonBendtsen
authored andcommitted
more PHP warnings fixes detected during #35096
1 parent eab145a commit 6e111fe

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

htdocs/core/customreports.php

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,11 @@
202202
$extrafields->fetch_name_optionals_label('all'); // We load all extrafields definitions for all objects
203203
//$extrafields->fetch_name_optionals_label($object->table_element_line);
204204

205-
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
205+
if (!empty($object->table_element)) {
206+
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
207+
} else {
208+
$search_array_options = array();
209+
}
206210

207211
$search_component_params = array('');
208212
$search_component_params_hidden = trim(GETPOST('search_component_params_hidden', 'alphanohtml'));
@@ -310,7 +314,11 @@
310314
$arrayofyaxis = array();
311315
$arrayofvaluesforgroupby = array();
312316

313-
$features = $object->element;
317+
if (!empty($object->element)) {
318+
$features = $object->element;
319+
} else {
320+
$features = '';
321+
}
314322
if (!empty($object->element_for_permission)) {
315323
$features = $object->element_for_permission;
316324
} else {
@@ -1134,10 +1142,14 @@
11341142
$dir = $conf->user->dir_temp;
11351143
dol_mkdir($dir);
11361144
// $customreportkey may be defined when using customreports.php as an include
1137-
$filenamekey = $dir.'/customreport_'.$object->element.(empty($customreportkey) ? '' : $customreportkey).'.png';
1138-
$fileurlkey = DOL_URL_ROOT.'/viewimage.php?modulepart=user&file=customreport_'.$object->element.(empty($customreportkey) ? '' : $customreportkey).'.png';
1145+
if (!empty($object->element)) {
1146+
$filenamekey = $dir.'/customreport_'.$object->element.(empty($customreportkey) ? '' : $customreportkey).'.png';
1147+
$fileurlkey = DOL_URL_ROOT.'/viewimage.php?modulepart=user&file=customreport_'.$object->element.(empty($customreportkey) ? '' : $customreportkey).'.png';
1148+
}
11391149

1140-
$px1->draw($filenamekey, $fileurlkey);
1150+
if (isset($filenamekey) && isset($fileurlkey)) {
1151+
$px1->draw($filenamekey, $fileurlkey);
1152+
}
11411153

11421154
$texttoshow = $langs->trans("NoRecordFound");
11431155
if (!GETPOSTISSET('search_measures') || !GETPOSTISSET('search_xaxis')) {

0 commit comments

Comments
 (0)