From 7109acb41aec75adf945d90678889e5dafc53b28 Mon Sep 17 00:00:00 2001 From: slerena Date: Thu, 7 Oct 2010 15:18:51 +0000 Subject: [PATCH] 2010-10-07 Sancho Lerena * godmode/alerts/alert_list.list.php: Another ugly warning fixed due an undefined array. PLEASE dont use foreach on arrays non-checked ! git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3366 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 3 +++ pandora_console/godmode/alerts/alert_list.list.php | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 6d57b0be92..b8ce45fbcf 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,5 +1,8 @@ 2010-10-07 Sancho Lerena + * godmode/alerts/alert_list.list.php: Another ugly warning fixed due + an undefined array. PLEASE dont use foreach on arrays non-checked ! + * godmode/agentes/configurar_agente.php: Added custom fields to the global edit/insert code. Not really used here, but for the future. diff --git a/pandora_console/godmode/alerts/alert_list.list.php b/pandora_console/godmode/alerts/alert_list.list.php index 433b6e3ab7..210acaf8d0 100644 --- a/pandora_console/godmode/alerts/alert_list.list.php +++ b/pandora_console/godmode/alerts/alert_list.list.php @@ -44,9 +44,14 @@ $form_filter .= print_input_text ('template_name', $templateName, '', 12, 255, t $form_filter .= "\n"; $temp = get_agents(); $arrayAgents = array(); -foreach ($temp as $agentElement) { - $arrayAgents[$agentElement['id_agente']] = $agentElement['nombre']; + +# Avoid empty arrays, warning messages are UGLY ! +if ($temp){ + foreach ($temp as $agentElement) { + $arrayAgents[$agentElement['id_agente']] = $agentElement['nombre']; + } } + $form_filter .= "".__('Agents').""; $form_filter .= print_input_text_extended ('agent_name', $agentName, 'text-agent_name', '', 12, 100, false, '', array('style' => 'background: url(images/lightning.png) no-repeat right;'), true);