From 4ba6cf34940d937c64b6f11e7aee685f1e246234 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Mon, 28 Nov 2011 17:44:22 +0000 Subject: [PATCH] 2011-11-28 Sergio Martin * operation/incidents/incident_detail.php operation/integria_incidents/incident.incident.php operation/events/events_list.php: Fixed some bugs of the create incident from event form included the change of target url when integria incidents are enabled bug: 3438251 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5189 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 9 +++++++++ pandora_console/operation/events/events_list.php | 8 +++++++- .../operation/incidents/incident_detail.php | 13 +++++++------ .../integria_incidents/incident.incident.php | 13 +++++++++++-- 4 files changed, 34 insertions(+), 9 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 5182b34d81..0c01a4d280 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2011-11-28 Sergio Martin + + * operation/incidents/incident_detail.php + operation/integria_incidents/incident.incident.php + operation/events/events_list.php: Fixed some bugs of the + create incident from event form included the change of + target url when integria incidents are enabled + bug: 3438251 + 2011-11-28 Juan Manuel Ramon * operation/events/export_csv.php: Added filter to CSV importation diff --git a/pandora_console/operation/events/events_list.php b/pandora_console/operation/events/events_list.php index aa31c218c0..c8eae2edaf 100644 --- a/pandora_console/operation/events/events_list.php +++ b/pandora_console/operation/events/events_list.php @@ -516,7 +516,13 @@ foreach ($result as $event) { // Create incident from this event if (check_acl ($config["id_user"], $event["id_grupo"], "IW") == 1) { - $data[4] .= ''; + if(isset($config['integria_enabled']) && $config['integria_enabled'] == 1) { + $incidents_path = 'integria_incidents/incident&tab=editor'; + } + else { + $incidents_path = 'incidents/incident_detail&insert_form'; + } + $data[4] .= ''; $data[4] .= html_print_image ("images/page_lightning.png", true, array ("title" => __('Create incident from event'))); $data[4] .= ''; diff --git a/pandora_console/operation/incidents/incident_detail.php b/pandora_console/operation/incidents/incident_detail.php index fdecfdfe3f..d885d8e324 100755 --- a/pandora_console/operation/incidents/incident_detail.php +++ b/pandora_console/operation/incidents/incident_detail.php @@ -178,16 +178,17 @@ elseif (isset ($_GET["insert_form"])) { $texto = ""; $usuario = $config["id_user"]; $id_creator = $config["id_user"]; - + $id_grupo = 0; + if (isset ($_GET["from_event"])) { $event = get_parameter ("from_event"); - $titulo = events_get_description ($event); + $texto = io_safe_output(events_get_description ($event)); + $titulo = ui_print_truncate_text(events_get_description ($event), 75, false, true, false); $id_grupo = events_get_group ($event); - $origen = "Pandora FMS event"; + $origen = "Pandora FMS Event"; unset ($event); } $prioridad = 0; - $id_grupo = 0; } else { db_pandora_audit("HACK","Trying to get to incident details in an unusual way"); @@ -271,9 +272,9 @@ foreach ($return as $row) { // Only owner could change source or user with Incident management privileges if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $config["id_user"])) { - html_print_select ($fields, "origen_form", $estado, '', '', '', false, false, false, 'w135'); + html_print_select ($fields, "origen_form", $origen, '', '', '', false, false, false, 'w135'); } else { - html_print_select ($fields, "origen_form", $estado, '', '', '', false, false, false, 'w135', true); + html_print_select ($fields, "origen_form", $origen, '', '', '', false, false, false, 'w135', true); } echo ''.__('Group').''; diff --git a/pandora_console/operation/integria_incidents/incident.incident.php b/pandora_console/operation/integria_incidents/incident.incident.php index d76d8dcd43..a0d47ebd89 100644 --- a/pandora_console/operation/integria_incidents/incident.incident.php +++ b/pandora_console/operation/integria_incidents/incident.incident.php @@ -20,6 +20,8 @@ global $result_sources; global $result_groups; global $result_users; +require_once ("include/functions_events.php"); //To get events group information + $resolutions[0] = __('None'); if (isset ($result_resolutions['resolution'])) { foreach($result_resolutions['resolution'] as $res) { @@ -63,8 +65,15 @@ if(!isset($result['id_incidencia'])) { $result['id_task'] = 0; $result['descripcion'] = ''; $result['epilog'] = ''; + + if (isset ($_GET["from_event"])) { + $event = get_parameter ("from_event"); + $result['descripcion'] = io_safe_output(events_get_description ($event)); + $result['titulo'] = ui_print_truncate_text($result['descripcion'], 75, false, true, false); + unset ($event); + } } - + $table->width = "98%"; $table->class = "databox"; @@ -73,7 +82,7 @@ $table->colspan[0][0] = 3; $table->colspan[3][0] = 3; $table->colspan[4][0] = 3; -$table->data[0][0] = "".__('Title')."
".html_print_input_text("title", $result['titulo'], '', 50, 255, true); +$table->data[0][0] = "".__('Title')."
".html_print_input_text("title", $result['titulo'], '', 80, 255, true); if(isset($result['id_incidencia'])) { $table->data[1][2] = "".__('Assigned user')."
".html_print_select ($users, 'id_user', $result['id_usuario'], '', '', 0, true, false, false); }