From a6f8608ffd8f96408bde8a147627b81b282cf030 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Mar 2020 11:09:18 +0100 Subject: [PATCH] Fix when undefined key --- htdocs/core/customreports.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index b5379ef911b..753e30650ad 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -213,7 +213,7 @@ if ($action == 'viewgraph') { } } -// Get all possible values of fields when a 'group by' is set and save this into $arrayofvaluesforgroupby +// Get all possible values of fields when a 'group by' is set, and save this into $arrayofvaluesforgroupby if (is_array($search_groupby) && count($search_groupby)) { foreach($search_groupby as $gkey => $gval) { $gvalwithoutprefix = preg_replace('/^[a-z]+\./', '', $gval); @@ -262,6 +262,8 @@ if (is_array($search_groupby) && count($search_groupby)) { } if (!empty($object->fields[$gvalwithoutprefix]['arrayofkeyval'])) { $valuetranslated = $object->fields[$gvalwithoutprefix]['arrayofkeyval'][$obj->val]; + if (is_null($valuetranslated)) $valuetranslated = $langs->transnoentitiesnoconv("UndefinedKey"); + $valuetranslated = $langs->trans($valuetranslated); } $arrayofvaluesforgroupby['g_'.$gkey][$keytouse] = $valuetranslated;