From 14ee5f417116c31d37f6a7c1077ad680f5bcaa9d Mon Sep 17 00:00:00 2001 From: Aldrioth Date: Fri, 29 Jul 2011 11:06:14 +0000 Subject: [PATCH] 2011-07-29 Tomas Palacios * operation/integria_incidents/incident.incident.php: fixed a bug regarding an empty foreach and an undefined variable call. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4651 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- .../integria_incidents/incident.incident.php | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/pandora_console/operation/integria_incidents/incident.incident.php b/pandora_console/operation/integria_incidents/incident.incident.php index 39137ca02d..d76d8dcd43 100644 --- a/pandora_console/operation/integria_incidents/incident.incident.php +++ b/pandora_console/operation/integria_incidents/incident.incident.php @@ -21,26 +21,31 @@ global $result_groups; global $result_users; $resolutions[0] = __('None'); -foreach($result_resolutions['resolution'] as $res) { - $resolutions[$res['id']] = $res['name']; +if (isset ($result_resolutions['resolution'])) { + foreach($result_resolutions['resolution'] as $res) { + $resolutions[$res['id']] = $res['name']; + } } - -foreach($result_status['status'] as $st) { - $status[$st['id']] = $st['name']; +if (isset ($result_status['status'])) { + foreach($result_status['status'] as $st) { + $status[$st['id']] = $st['name']; + } } - -foreach($result_sources['source'] as $src) { - $sources[$src['id']] = $src['name']; +if (isset ($result_sources['source'])) { + foreach($result_sources['source'] as $src) { + $sources[$src['id']] = $src['name']; + } } - -foreach($result_groups['group'] as $gr) { - $groups[$gr['id']] = $gr['name']; +if (isset ($result_groups['group'])) { + foreach($result_groups['group'] as $gr) { + $groups[$gr['id']] = $gr['name']; + } } - -foreach($result_users['id_user'] as $usr) { - $users[$usr] = $usr; +if (isset ($result_users['id_user'])) { + foreach($result_users['id_user'] as $usr) { + $users[$usr] = $usr; + } } - if(!isset($result['id_incidencia'])) { $result['titulo'] = ''; $result['sla_disabled'] = 0; @@ -75,8 +80,9 @@ if(isset($result['id_incidencia'])) { else { $table->data[1][2] = ""; } - -$table->data[1][0] = "".__('Group')."
".html_print_select ($groups, 'group', $result['id_grupo'], '', '', 0, true, false, false); +if (isset($groups)){ + $table->data[1][0] = "".__('Group')."
".html_print_select ($groups, 'group', $result['id_grupo'], '', '', 0, true, false, false); +} $table->data[1][1] = "".__('Priority')."
".html_print_select (incidents_get_priorities (), 'priority', $result['prioridad'], '', '', 0, true, false, false); $table->data[1][2] = "".__('Creator')."
".$result['id_creator'];