From b9007acbf18f6272509d35d3c9378142a5f8475e Mon Sep 17 00:00:00 2001 From: William Mead Date: Wed, 13 Mar 2024 14:03:27 +0100 Subject: [PATCH] Fixed PHP warnings --- .../comm/action/class/cactioncomm.class.php | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index bc6f454539a..d308ce7bd1c 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -192,9 +192,21 @@ class CActionComm $nump = $this->db->num_rows($resql); if ($nump) { $idforallfornewmodule = 96; - $TSystem = array(); - $TSystemAuto = array(); - $TModule = array(); + $TSystem = array( + 'id' => [], + 'code' => [], + 'all' => [] + ); + $TSystemAuto = array( + 'id' => [], + 'code' => [], + 'all' => [] + ); + $TModule = array( + 'id' => [], + 'code' => [], + 'all' => [] + ); $i = 0; while ($i < $nump) { $obj = $this->db->fetch_object($resql); @@ -319,8 +331,8 @@ class CActionComm } if ($onlyautoornot > 0 && preg_match('/^module/', $obj->type) && $obj->module) { - $TModule['code'][$obj->code] .= ' ('.$langs->trans("Module").': '.$obj->module.')'; - $TModule['all'][$obj->code]['label'] .= ' ('.$langs->trans("Module").': '.$obj->module.')'; + array_key_exists($obj->code, $TModule['code']) ? ($TModule['code'][$obj->code] .= ' ('.$langs->trans("Module").': '.$obj->module.')') : ($TModule['code'][$obj->code] = ' ('.$langs->trans("Module").': '.$obj->module.')'); + array_key_exists($obj->code, $TModule['all']) ? ($TModule['all'][$obj->code]['label'] .= ' ('.$langs->trans("Module").': '.$obj->module.')') : ($TModule['all'][$obj->code]['label'] = ' ('.$langs->trans("Module").': '.$obj->module.')'); } } $i++;