From fbccaeead5e4eb10e304f4b743fd3f186936fa50 Mon Sep 17 00:00:00 2001
From: alexhigh <alex@artica.es>
Date: Mon, 18 Aug 2014 12:53:59 +0000
Subject: [PATCH] 2014-08-18  Alejandro Gallardo <alejandro.gallardo@artica.es>

	* pandoradb.sql,
	  pandoradb.data.postgreSQL.sql,
	  pandoradb.data.oracle.sql,
	  extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql,
	  extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql,
	  extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql:
	Added some inserts with the new action and command to create
	a ticket in Integria IMS.

	* include/styles/pandora.css: Fixed the header style.

	* operation/menu.php: Now the incidents statistics menu option
	takes the user to the correct place if the "Integria incidents"
	option is selected.

	* operation/integria_incidents/incident.incident.php: Fixed the
	incident edition.

	* operation/integria_incidents/incident.php: Improved the tab
	images.

	* operation/integria_incidents/incident.workunits.php: Now the
	default time of the incident workunits is 0.

	* operation/integria_incidents/incident_detail.php: File removed.

	* operation/integria_incidents/incident_statistics.php: Now this
	section show the real statistics of the Integria IMS incidents.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10431 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
---
 pandora_console/ChangeLog                     |  31 ++
 .../pandoradb_migrate_5.0.x_to_5.1.mysql.sql  |  13 +-
 .../pandoradb_migrate_5.0.x_to_5.1.oracle.sql |  13 +-
 ...doradb_migrate_5.0.x_to_5.1.postgreSQL.sql |  13 +-
 pandora_console/include/styles/pandora.css    |   7 +-
 .../integria_incidents/incident.incident.php  |  39 +-
 .../integria_incidents/incident.list.php      |  40 +-
 .../operation/integria_incidents/incident.php |  19 +-
 .../integria_incidents/incident.workunits.php |   2 +-
 .../integria_incidents/incident_detail.php    | 440 ------------------
 .../incident_statistics.php                   |  42 +-
 pandora_console/operation/menu.php            |   6 +-
 pandora_console/pandoradb.data.oracle.sql     |   2 +
 pandora_console/pandoradb.data.postgreSQL.sql |   2 +
 pandora_console/pandoradb_data.sql            |   3 +-
 15 files changed, 152 insertions(+), 520 deletions(-)
 delete mode 100755 pandora_console/operation/integria_incidents/incident_detail.php

diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog
index 16853751da..a5efc0233d 100644
--- a/pandora_console/ChangeLog
+++ b/pandora_console/ChangeLog
@@ -1,3 +1,34 @@
+2014-08-18  Alejandro Gallardo <alejandro.gallardo@artica.es>
+	
+	* pandoradb.sql,
+	  pandoradb.data.postgreSQL.sql,
+	  pandoradb.data.oracle.sql,
+	  extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql,
+	  extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql,
+	  extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql:
+	Added some inserts with the new action and command to create
+	a ticket in Integria IMS.
+
+	* include/styles/pandora.css: Fixed the header style.
+
+	* operation/menu.php: Now the incidents statistics menu option
+	takes the user to the correct place if the "Integria incidents"
+	option is selected.
+
+	* operation/integria_incidents/incident.incident.php: Fixed the
+	incident edition.
+
+	* operation/integria_incidents/incident.php: Improved the tab
+	images.
+
+	* operation/integria_incidents/incident.workunits.php: Now the
+	default time of the incident workunits is 0.
+
+	* operation/integria_incidents/incident_detail.php: File removed.
+
+	* operation/integria_incidents/incident_statistics.php: Now this
+	section show the real statistics of the Integria IMS incidents.
+
 2014-08-14  Miguel de Dios <miguel.dedios@artica.es>
 	
 	* godmode/update_manager/update_manager.online.php,
diff --git a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql
index 5516382577..beb9d06a26 100644
--- a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql
+++ b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql
@@ -233,4 +233,15 @@ DELETE FROM `trecon_script` WHERE id_recon_script=1;
 -- ---------------------------------------------------------------------
 -- Table `tagente_modulo`
 -- ---------------------------------------------------------------------
-ALTER TABLE tagente_modulo MODIFY COLUMN `post_process` double(18,15) default 0;
\ No newline at end of file
+ALTER TABLE tagente_modulo MODIFY COLUMN `post_process` double(18,15) default 0;
+
+/* 2014/08/18 */
+-- ---------------------------------------------------------------------
+-- Table `talert_commands`
+-- ---------------------------------------------------------------------
+INSERT INTO `talert_commands` (`name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES ('Integria&#x20;IMS&#x20;Ticket','Internal&#x20;type','This&#x20;alert&#x20;create&#x20;a&#x20;ticket&#x20;into&#x20;your&#x20;Integria&#x20;IMS.',1,'[\"Integria&#x20;IMS&#x20;API&#x20;path\",\"Integria&#x20;IMS&#x20;API&#x20;pass\",\"Integria&#x20;IMS&#x20;user\",\"Ticket&#x20;title\",\"Ticket&#x20;group&#x20;ID\",\"Ticket&#x20;priority\",\"Ticket&#x20;description\"]','[\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very&#x20;Serious\",\"\"]');
+
+-- ---------------------------------------------------------------------
+-- Table `talert_actions`
+-- ---------------------------------------------------------------------
+INSERT INTO `talert_actions` (`name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`) VALUES ('Create&#x20;a&#x20;ticket&#x20;in&#x20;Integria&#x20;IMS',13,'http://localhost/integria/include/api.php','1234','admin','_agent_:&#x20;_alert_name_','1','3','_alert_description_','','','',0,0);
\ No newline at end of file
diff --git a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql
index 72541bbd9a..c06a2a865e 100644
--- a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql
+++ b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql
@@ -221,4 +221,15 @@ DELETE FROM trecon_script WHERE id_recon_script=1;
 -- ---------------------------------------------------------------------
 -- Table `tagente_modulo`
 -- ---------------------------------------------------------------------
-ALTER TABLE tagente_modulo MODIFY COLUMN post_process NUMBER(18,15) default 0;
\ No newline at end of file
+ALTER TABLE tagente_modulo MODIFY COLUMN post_process NUMBER(18,15) default 0;
+
+/* 2014/08/18 */
+-- ---------------------------------------------------------------------
+-- Table `talert_commands`
+-- ---------------------------------------------------------------------
+INSERT INTO talert_commands (name, command, description, internal, fields_descriptions, fields_values) VALUES ('Integria&#x20;IMS&#x20;Ticket','Internal&#x20;type','This&#x20;alert&#x20;create&#x20;a&#x20;ticket&#x20;into&#x20;your&#x20;Integria&#x20;IMS.',1,'[\"Integria&#x20;IMS&#x20;API&#x20;path\",\"Integria&#x20;IMS&#x20;API&#x20;pass\",\"Integria&#x20;IMS&#x20;user\",\"Ticket&#x20;title\",\"Ticket&#x20;group&#x20;ID\",\"Ticket&#x20;priority\",\"Ticket&#x20;description\"]','[\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very&#x20;Serious\",\"\"]');
+
+-- ---------------------------------------------------------------------
+-- Table `talert_actions`
+-- ---------------------------------------------------------------------
+INSERT INTO talert_actions (name, id_alert_command, field1, field2, field3, field4, field5, field6, field7, field8, field9, field10, id_group, action_threshold) VALUES ('Create&#x20;a&#x20;ticket&#x20;in&#x20;Integria&#x20;IMS',13,'http://localhost/integria/include/api.php','1234','admin','_agent_:&#x20;_alert_name_','1','3','_alert_description_','','','',0,0);
\ No newline at end of file
diff --git a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql
index 1dc1da9aa5..844fb2cde3 100644
--- a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql
+++ b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql
@@ -195,4 +195,15 @@ DELETE FROM "trecon_script" WHERE "id_recon_script"=1;
 -- ---------------------------------------------------------------------
 -- Table `tagente_modulo`
 -- ---------------------------------------------------------------------
-ALTER TABLE "tagente_modulo" MODIFY COLUMN "post_process" NUMERIC(18,15) default 0;
\ No newline at end of file
+ALTER TABLE "tagente_modulo" MODIFY COLUMN "post_process" NUMERIC(18,15) default 0;
+
+/* 2014/08/18 */
+-- ---------------------------------------------------------------------
+-- Table `talert_commands`
+-- ---------------------------------------------------------------------
+INSERT INTO "talert_commands" ("name", "command", "description", "internal", "fields_descriptions", "fields_values") VALUES ('Integria&#x20;IMS&#x20;Ticket','Internal&#x20;type','This&#x20;alert&#x20;create&#x20;a&#x20;ticket&#x20;into&#x20;your&#x20;Integria&#x20;IMS.',1,'[\"Integria&#x20;IMS&#x20;API&#x20;path\",\"Integria&#x20;IMS&#x20;API&#x20;pass\",\"Integria&#x20;IMS&#x20;user\",\"Ticket&#x20;title\",\"Ticket&#x20;group&#x20;ID\",\"Ticket&#x20;priority\",\"Ticket&#x20;description\"]','[\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very&#x20;Serious\",\"\"]');
+
+-- ---------------------------------------------------------------------
+-- Table `talert_actions`
+-- ---------------------------------------------------------------------
+INSERT INTO "talert_actions" ("name", "id_alert_command", "field1", "field2", "field3", "field4", "field5", "field6", "field7", "field8", "field9", "field10", "id_group", "action_threshold") VALUES ('Create&#x20;a&#x20;ticket&#x20;in&#x20;Integria&#x20;IMS',13,'http://localhost/integria/include/api.php','1234','admin','_agent_:&#x20;_alert_name_','1','3','_alert_description_','','','',0,0);
\ No newline at end of file
diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css
index 3c3f29993e..964b3f787d 100644
--- a/pandora_console/include/styles/pandora.css
+++ b/pandora_console/include/styles/pandora.css
@@ -284,7 +284,7 @@ div#menu {
 
 div#head {
 	font-size: 8pt;
-	width: 960px;
+	width: 100%;
 	height: 62px; 
 	padding-top: 0px;
 	margin-bottom: 8px;
@@ -1871,11 +1871,10 @@ div#main {
 	min-width: 720px;
 }
 div#head {
-	width: auto;
-	height: auto;
-	background-color: #333;
+	width: 100%;
 	height: 47px;
 	min-width: 882px;
+	background-color: #333;
 	color: white;
 }
 
diff --git a/pandora_console/operation/integria_incidents/incident.incident.php b/pandora_console/operation/integria_incidents/incident.incident.php
index d288837352..7d55bc4aaa 100644
--- a/pandora_console/operation/integria_incidents/incident.incident.php
+++ b/pandora_console/operation/integria_incidents/incident.incident.php
@@ -16,7 +16,6 @@
 global $result;
 global $result_resolutions;
 global $result_status;
-global $result_sources;
 global $result_groups;
 global $result_users;
 
@@ -33,11 +32,6 @@ if (isset ($result_status['status'])) {
 		$status[$st['id']] = $st['name'];
 	}
 }
-if (isset ($result_sources['source'])) {
-	foreach($result_sources['source'] as $src) {
-		$sources[$src['id']] = $src['name'];
-	}
-}
 if (isset ($result_groups['group'])) {
 	foreach($result_groups['group'] as $gr) {
 		$groups[$gr['id']] = $gr['name'];
@@ -60,7 +54,6 @@ if(!isset($result['id_incidencia'])) {
 	$result['prioridad'] = 0;
 	$result['resolution'] = 0;
 	$result['id_parent'] = 0;
-	$result['origen'] = 0;
 	$result['id_incident_type'] = 0;
 	$result['id_task'] = 0;
 	$result['id_creator'] = $config['id_user'];
@@ -87,22 +80,22 @@ $table->colspan[3][0] = 3;
 $table->colspan[4][0] = 3;
 
 $table->data[0][0] = "<b>".__('Title')."</b><br/>".html_print_input_text("title", $result['titulo'], '', 80, 255, true);
-if (isset($result['id_incidencia'])) {
-	$table->data[1][2] = "<b>".__('Assigned user')."</b><br/>".html_print_select ($users, 'id_user_assigned', $result['id_usuario'], '', '', 0, true, false, false);
-}
-else {
-	$table->data[1][2] = "";
-}
+
+$table->data[0][1] = "<b>".__('Creator')."</b><br/>".$result['id_creator'];
+
 if (isset($groups)) {
 	$table->data[1][0] = "<b>".__('Group')."</b><br/>".html_print_select ($groups, 'group', $result['id_grupo'], '', '', 0, true, false, false);
 }
+
 $table->data[1][1] = "<b>".__('Priority')."</b><br/>".html_print_select (incidents_get_priorities (), 'priority', $result['prioridad'], '', '', 0, true, false, false);
-$table->data[0][1] = "<b>".__('Creator')."</b><br/>".$result['id_creator'];
 
 if (isset($result['id_incidencia'])) {
-	$table->data[2][0] = "<b>".__('Source')."</b><br/>".html_print_select ($sources, 'source', $result['origen'], '', '', 0, true, false, false);
-	$table->data[2][1] = "<b>".__('Resolution')."</b><br/>".html_print_select ($resolutions, 'resolution', $result['resolution'], '', '', 0, true, false, false);
-	$table->data[2][2] = "<b>".__('Status')."</b><br/>".html_print_select ($status, 'status', $result['estado'], '', '', 0, true, false, false);
+	$table->data[1][2] = "<b>".__('Assigned user')."</b><br/>".html_print_select ($users, 'id_user_assigned', $result['id_usuario'], '', '', 0, true, false, false);
+}
+
+if (isset($result['id_incidencia'])) {
+	$table->data[2][0] = "<b>".__('Resolution')."</b><br/>".html_print_select ($resolutions, 'resolution', $result['resolution'], '', '', 0, true, false, false);
+	$table->data[2][1] = "<b>".__('Status')."</b><br/>".html_print_select ($status, 'status', $result['estado'], '', '', 0, true, false, false);
 }
 
 if (is_array($result['descripcion'])) {
@@ -111,14 +104,14 @@ if (is_array($result['descripcion'])) {
 
 $table->data[3][0] = "<b>".__('Description')."</b><br/>".html_print_textarea("description", 10, 6, $result['descripcion'] , '', true);
 
-if(isset($result['id_incidencia'])) {
-if(is_array($result['epilog'])) {
-	$result['epilog'] = implode(',', $result['epilog']);
-}
-$table->data[4][0] = "<b>".__('Resolution epilog')."</b><br/>".html_print_textarea("epilog", 10, 6, $result['epilog'] , '', true);
+if (isset($result['id_incidencia'])) {
+	if(is_array($result['epilog'])) {
+		$result['epilog'] = implode(',', $result['epilog']);
+	}
+	$table->data[4][0] = "<b>".__('Resolution epilog')."</b><br/>".html_print_textarea("epilog", 10, 6, $result['epilog'] , '', true);
 }
 
-if(isset($result['id_incidencia'])) {
+if (isset($result['id_incidencia'])) {
 	echo "<form method='post' action=''>";
 	html_print_table($table);
 	html_print_submit_button(__('Update'), 'submit_button', false, "class='sub upd'");
diff --git a/pandora_console/operation/integria_incidents/incident.list.php b/pandora_console/operation/integria_incidents/incident.list.php
index 2d4b29c3da..d9139bce02 100644
--- a/pandora_console/operation/integria_incidents/incident.list.php
+++ b/pandora_console/operation/integria_incidents/incident.list.php
@@ -91,19 +91,18 @@ $table->size = array ();
 $table->align = array ();
 
 $table->head[0] = __('ID');
-//$table->head[1] = __('SLA');
-$table->head[2] = __('Incident');
-$table->head[3] = __('Group');
-$table->head[4] = __('Status')."<br/><i>".__('Resolution')."</i>";
-$table->head[5] = __('Priority');
-$table->head[6] = __('Updated')."<br/><i>".__('Started')."</i>";
-$table->head[7] = __('Details');
-$table->head[8] = __('Creator');
-$table->head[9] = __('Owner');
-$table->head[10] = __('Action');
+$table->head[1] = __('Incident');
+$table->head[2] = __('Group');
+$table->head[3] = __('Status')."<br/><i>".__('Resolution')."</i>";
+$table->head[4] = __('Priority');
+$table->head[5] = __('Updated')."<br/><i>".__('Started')."</i>";
+$table->head[6] = __('Details');
+$table->head[7] = __('Creator');
+$table->head[8] = __('Owner');
+$table->head[9] = __('Action');
 
+$table->align[3] = "center";
 $table->align[4] = "center";
-$table->align[5] = "center";
 
 if(isset($result['incident'][0]) && is_array($result['incident'][0])) {
 	$incidents = $result['incident'];
@@ -125,16 +124,15 @@ foreach ($incidents as $row) {
 	$data = array();
 
 	$data[0] = '<a href="index.php?login=1&sec=workspace&sec2=operation/integria_incidents/incident&tab=incident&id_incident='.$row["id_incidencia"].'">'.$row["id_incidencia"].'</a>';
-	//$data[1] = "";
-	$data[2] = '<a href="index.php?login=1&sec=workspace&sec2=operation/integria_incidents/incident&tab=incident&id_incident='.$row["id_incidencia"].'">'.substr(io_safe_output($row["titulo"]),0,45).'</a>';
-	$data[3] = $groups[$row["id_grupo"]];
-	$data[4] = $status[$row["estado"]]."<br/><i>".$resolutions[$row["resolution"]]."</i>";
-	$data[5] = incidents_print_priority_img ($row["prioridad"], true);
-	$data[6] = ui_print_timestamp ($row["actualizacion"], true)."<br/><i>" . ui_print_timestamp ($row["inicio"], true)."</i>";
-	$data[7] = $row["workunits_hours"]." ".__('Hours')."<br/>".$row["workunits_count"]." ".__('Workunits');
-	$data[8] = $row["id_creator"];
-	$data[9] = $row["id_usuario"];
-	$data[10] = "<a href='index.php?sec=workspace&sec2=operation/integria_incidents/incident&delete_incident=".$row['id_incidencia']."'>".html_print_image("images/cross.png", true, array('title' => __('Delete incident')))."</a><a href='index.php?login=1&sec=workspace&sec2=operation/integria_incidents/incident&tab=incident&id_incident=".$row["id_incidencia"]."'>".html_print_image("images/config.png", true, array('title' => __('View incident details')))."</a>";
+	$data[1] = '<a href="index.php?login=1&sec=workspace&sec2=operation/integria_incidents/incident&tab=incident&id_incident='.$row["id_incidencia"].'">'.substr(io_safe_output($row["titulo"]),0,45).'</a>';
+	$data[2] = $groups[$row["id_grupo"]];
+	$data[3] = $status[$row["estado"]]."<br/><i>".$resolutions[$row["resolution"]]."</i>";
+	$data[4] = incidents_print_priority_img ($row["prioridad"], true);
+	$data[5] = ui_print_timestamp ($row["actualizacion"], true)."<br/><i>" . ui_print_timestamp ($row["inicio"], true)."</i>";
+	$data[6] = $row["workunits_hours"]." ".__('Hours')."<br/>".$row["workunits_count"]." ".__('Workunits');
+	$data[7] = !empty($row["id_creator"]) ? $row["id_creator"] : __('None');
+	$data[8] = !empty($row["id_usuario"]) ? $row["id_usuario"] : __('None');
+	$data[9] = "<a href='index.php?sec=workspace&sec2=operation/integria_incidents/incident&delete_incident=".$row['id_incidencia']."'>".html_print_image("images/cross.png", true, array('title' => __('Delete incident')))."</a><a href='index.php?login=1&sec=workspace&sec2=operation/integria_incidents/incident&tab=incident&id_incident=".$row["id_incidencia"]."'>".html_print_image("images/config.png", true, array('title' => __('View incident details')))."</a>";
 
 	array_push ($table->data, $data);
 }
diff --git a/pandora_console/operation/integria_incidents/incident.php b/pandora_console/operation/integria_incidents/incident.php
index b654bc03be..df203d9960 100755
--- a/pandora_console/operation/integria_incidents/incident.php
+++ b/pandora_console/operation/integria_incidents/incident.php
@@ -51,23 +51,23 @@ else {
 		'list' => array(
 			'active' => false,
 			'text' => '<a href="index.php?login=1&sec=incidencias&sec2=operation/integria_incidents/incident&tab=list">' . 
-				html_print_image ("images/page_white_text.png", true, array ("title" => __('Incidents'))) .'</a>'),
+				html_print_image ("images/list.png", true, array ("title" => __('Incidents'))) .'</a>'),
 		'incident' => array(
 			'active' => false,
 			'text' => '<a href="index.php?login=1&sec=incidencias&sec2=operation/integria_incidents/incident&tab=incident&id_incident='.$id_incident.'">' . 
-				html_print_image ("images/eye.png", true, array ("title" => __('Incident details'))) .'</a>'),
+				html_print_image ("images/zoom_mc.png", true, array ("title" => __('Incident details'))) .'</a>'),
 		'workunits' => array(
 			'active' => false,
 			'text' => '<a href="index.php?login=1&sec=incidencias&sec2=operation/integria_incidents/incident&tab=workunits&id_incident='.$id_incident.'">' . 
-				html_print_image ("images/computer.png", true, array ("title" => __('Workunits'))) .'</a>'),
+				html_print_image ("images/star_white.png", true, array ("title" => __('Workunits'))) .'</a>'),
 		'files' => array(
 			'active' => false,
 			'text' => '<a href="index.php?login=1&sec=incidencias&sec2=operation/integria_incidents/incident&tab=files&id_incident='.$id_incident.'"">' . 
-				html_print_image ("images/file.png", true, array ("title" => __('Files'))) .'</a>'),
+				html_print_image ("images/save_mc.png", true, array ("title" => __('Files'))) .'</a>'),
 		'tracking' => array(
 			'active' => false,
 			'text' => '<a href="index.php?login=1&sec=incidencias&sec2=operation/integria_incidents/incident&tab=tracking&id_incident='.$id_incident.'"">' . 
-				html_print_image ("images/comments.png", true, array ("title" => __('Tracking'))) .'</a>'));
+				html_print_image ("images/gm_log.png", true, array ("title" => __('Tracking'))) .'</a>'));
 }
 
 $buttons[$tab]['active'] = true;
@@ -81,10 +81,9 @@ if ($update_incident == 1) {
 	$values[3] = urlencode(io_safe_output(get_parameter('epilog')));
 	$values[4] = get_parameter('group');
 	$values[5] = get_parameter('priority');
-	$values[6] = get_parameter('source');
-	$values[7] = get_parameter('resolution');
-	$values[8] = get_parameter('status');
-	$values[9] = get_parameter('id_user_assigned');
+	$values[6] = get_parameter('resolution');
+	$values[7] = get_parameter('status');
+	$values[8] = get_parameter('id_user_assigned');
 	
 	$params = implode($token, $values);
 	
@@ -275,7 +274,6 @@ switch ($tab) {
 		}
 		$url_resolutions =  $integria_api."&op=get_incidents_resolutions";
 		$url_status =  $integria_api."&op=get_incidents_status";
-		$url_sources =  $integria_api."&op=get_incidents_sources";
 		$url_groups =  $integria_api."&op=get_groups&params=0";
 		$url_users =  $integria_api."&op=get_users";
 		break;
@@ -322,7 +320,6 @@ if (xml_parse(xml_parser_create(), $xml)) {
 		case 'incident':
 			$result_resolutions = incidents_xml_to_array(incidents_call_api($url_resolutions));
 			$result_status = incidents_xml_to_array(incidents_call_api($url_status));
-			$result_sources = incidents_xml_to_array(incidents_call_api($url_sources));
 			$result_groups = incidents_xml_to_array(incidents_call_api($url_groups));
 			$result_users = incidents_xml_to_array(incidents_call_api($url_users));
 			require_once('incident.incident.php');
diff --git a/pandora_console/operation/integria_incidents/incident.workunits.php b/pandora_console/operation/integria_incidents/incident.workunits.php
index edaf01fae5..448015216b 100644
--- a/pandora_console/operation/integria_incidents/incident.workunits.php
+++ b/pandora_console/operation/integria_incidents/incident.workunits.php
@@ -23,7 +23,7 @@ $table->data = array();
 $table->colspan[1][0] = 3;
 
 $profiles = array();
-$default_time = "0.25";
+$default_time = "0";
 $table->data[0][0] = "<b>".__('Time used')."</b><br/>".html_print_input_text ('time_used', $default_time, '', 10, 255, true);
 $table->data[0][1] = "<b>".__('Have cost')."</b><br/>".html_print_checkbox ('have_cost', '', false, true);
 $table->data[0][2] = "<b>".__('Public')."</b><br/>".html_print_checkbox ('public', '', true, true);
diff --git a/pandora_console/operation/integria_incidents/incident_detail.php b/pandora_console/operation/integria_incidents/incident_detail.php
deleted file mode 100755
index b1722223a4..0000000000
--- a/pandora_console/operation/integria_incidents/incident_detail.php
+++ /dev/null
@@ -1,440 +0,0 @@
-<?php
-
-// Pandora FMS - http://pandorafms.com
-// ==================================================
-// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
-// Please see http://pandorafms.org for full contribution list
-
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation for version 2.
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-
-// Load global vars
-
-global $config;
-require_once ("include/functions_incidents.php");
-require_once ("include/functions_events.php"); //To get events group information
-require_once ($config['homedir'] . "/include/functions_users.php");
-
-check_login ();
-
-if (! check_acl ($config["id_user"], 0, "IR")) {
- 	// Doesn't have access to this page
-	db_pandora_audit("ACL Violation", "Trying to access incident details");
-	require ("general/noaccess.php");
-	exit;
-}
-
-$inicio = get_system_time (); //Just inits the variable
-$actualizacion = get_system_time ();
-
-// EDITION MODE
-if (isset ($_GET["id"])) {
-	$id_inc = (int) get_parameter_get ("id", 0);
-	
-	// Obtain group of this incident
-	$row = db_get_row ("tincidencia","id_incidencia",$id_inc);
-	
-	// Get values
-	$titulo = $row["titulo"];
-	$texto = $row["descripcion"];
-	$inicio = strtotime ($row["inicio"]); 
-	$actualizacion = strtotime ($row["actualizacion"]);
-	$estado = $row["estado"];
-	$prioridad = $row["prioridad"];
-	$origen = $row["origen"];
-	$usuario = $row["id_usuario"]; //owner
-	$id_grupo = $row["id_grupo"];
-	$id_creator = $row["id_creator"]; //creator
-	$id_lastupdate = $row["id_lastupdate"]; //last updater
-	
-	// Note add - everybody that can read incidents, can add notes
-	if (isset ($_GET["insertar_nota"])) {
-		$nota = get_parameter_post ("nota");
-
-		$values = array(
-			'id_usuario' => $config["id_user"],
-			'id_incident' => $id_inc,
-			'nota' => $nota);
-		$id_nota = db_process_sql_insert('tnota', $values);
-
-		if ($id_nota !== false) {
-			incidents_process_touch ($id_inc);
-		}
-		ui_print_result_message ($id_nota,
-			__('Successfully added'),
-			__('Could not be added'));
-	}
-
-	// Delete note
-	if (isset ($_POST["delete_nota"])) {
-		$id_nota = get_parameter_post ("delete_nota", 0);
-		$note_user = incidents_get_notes_author ($id_nota);
-		if (((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($note_user == $config["id_user"])) OR ($id_owner == $config["id_user"])) { 
-		// Only admins (manage incident) or owners can modify
-		// incidents notes. note authors are 
-		// able to delete their own notes
-			$result = incidents_delete_note ($id_nota);
-
-			if (!empty ($result)) {
-				incidents_process_touch ($id_inc);
-			}
-			ui_print_result_message ($id_nota,
-				__('Successfully deleted'),
-				__('Could not be deleted'));
-		}
-	}
-
-	// Delete file
-	if (((check_acl ($config["id_user"], $id_grupo, "IM")==1) OR ($id_owner == $config["id_user"])) AND isset ($_POST["delete_file"])) {
-		$file_id = (int) get_parameter_post ("delete_file", 0);
-		$filename = db_get_value ("filename", "tattachment", "id_attachment", $file_id);
-		
-		$result = db_process_sql_delete('tattachment', array('id_attachment' => $file_id));
-		
-		if (!empty ($result)) {
-			unlink ($config["attachment_store"]."/pand".$file_id."_".$filename);
-			incidents_process_touch ($id_inc);
-		}
-		
-		ui_print_result_message ($result,
-			__('Successfully deleted'),
-			__('Could not be deleted'));
-	}
-
-	// Upload file
-	if ((check_acl ($config["id_user"], $id_grupo, "IW") == 1) AND isset ($_GET["upload_file"]) AND ($_FILES['userfile']['name'] != "")) {
-		$description = get_parameter_post ("file_description", __('No description available'));
-		
-		// Insert into database
-		$filename = io_safe_input ($_FILES['userfile']['name']);
-		$filesize = io_safe_input ($_FILES['userfile']['size']);
-
-		//The following is if you have clamavlib installed
-		//(php5-clamavlib) and enabled in php.ini
-		//http://www.howtoforge.com/scan_viruses_with_php_clamavlib
-		if (extension_loaded ('clamav')) {
-			cl_setlimits (5, 1000, 200, 0, 10485760);
-			$malware = cl_scanfile ($_FILES['file']['tmp_name']); 
-			if ($malware) {
-				$error = 'Malware detected: '.$malware.'<br>ClamAV version: '.clam_get_version();
-				die ($error); //On malware, we die because it's not good to handle it
-			}
-		}
-		
-		$values = array(
-			'id_incidencia' => $id_inc,
-			'id_usuario' => $config["id_user"],
-			'filename' => $filename,
-			'description' => $description,
-			'size' => $filesize);
-		$id_attachment = db_process_sql_insert('tattachment', $values);
-
-		// Copy file to directory and change name
-		if ($id_attachment !== false) {
-			$nombre_archivo = $config["attachment_store"]."/pand".$id_attachment."_".$filename;
-			$result = copy ($_FILES['userfile']['tmp_name'], $nombre_archivo);
-		}
-		else {
-			ui_print_error_message(__('File could not be saved due to database error'));
-			$result = false;
-		}
-
-		if ($result !== false) {
-			unlink ($_FILES['userfile']['tmp_name']);
-			incidents_process_touch ($id_inc);
-		}
-		else {
-			db_process_sql_delete('tattachment', array('id_attachment' => $id_attachment));
-		}
-		
-		ui_print_result_message ($result,
-			__('File uploaded'),
-			__('File could not be uploaded'));
-	}
-} // else Not given id
-// Create incident from event... read event data
-elseif (isset ($_GET["insert_form"])) {
-	$titulo = "";
-	$descripcion = "";
-	$origen = "";
-	$prioridad = 0;
-	$id_grupo = 0;
-	$estado = 0;
-	$texto = "";
-	$usuario = $config["id_user"];
-	$id_creator = $config["id_user"];
-	
-	if (isset ($_GET["from_event"])) {
-		$event = get_parameter_get ("from_event");
-		$titulo = events_get_description ($event);
-		$id_grupo = events_get_group ($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");
-	require ("general/noaccess.php");
-	exit;
-}
-
-
-
-// ********************************************************************************************************
-// ********************************************************************************************************
-// Show the form
-// ********************************************************************************************************
-
-//This is for the pretty slide down attachment form
-echo "<script type=\"text/javascript\">
-	$(document).ready(function() {
-		$('#file_control').hide();
-		$('#add_note').hide();
-		$('a.attachment').click(function() {
-			$('a.attachment').fadeOut('fast');
-			$('#file_control').slideDown('slow');
-			return false;
-		});
-		$('a.note_control').click(function() {
-			$('a.note_control').fadeOut('fast');
-			$('#add_note').slideDown('slow');
-			return false;
-		});
-	});</script>";
-
-if (isset ($id_inc)) { //If $id_inc is set (when $_GET["id"] is set, not $_GET["insert_form"]
-	ui_print_page_header (__('Incident details'). ' #'.$id_inc, "images/book_edit.png", false, "", false, "");
-	echo '<form name="accion_form" method="POST" action="index.php?sec=incidencias&sec2=operation/incidents/incident&action=update">';
-	echo '<input type="hidden" name="id_inc" value="'.$id_inc.'">';
-}
-else {
-	ui_print_page_header (__('Create incident'), "images/book_edit.png", false, "", false, "");
-	echo '<form name="accion_form" method="POST" action="index.php?sec=incidencias&sec2=operation/incidents/incident&action=insert">';
-}
-
-echo '<table cellpadding="4" cellspacing="4" class="databox" width="650px">';
-echo '<tr><td class="datos"><b>'.__('Incident').'</b></td><td colspan="3" class="datos">';
-
-if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $config["id_user"])) {
-	html_print_input_text ("titulo", $titulo,'', 70);
-}
-else {
-	html_print_input_text_extended ("titulo", $titulo, "", "", 70, "", false, "", "readonly"); 
-}
-
-echo '</td></tr>';
-
-echo '<tr><td class="datos2"><b>'.__('Opened at').'</b></td><td class="datos2"><i>'.date ($config['date_format'], $inicio).'</i></td>';
-echo '<td class="datos2"><b>'.__('Updated at').'</b><td class="datos2"><i>'.date ($config['date_format'], $actualizacion).'</i></td></tr>';
-
-echo '<tr><td class="datos"><b>'.__('Owner').'</b></td><td class="datos">';
-
-if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $config["id_user"])) {
-	html_print_select (users_get_info (), "usuario_form", $usuario, '', 'SYSTEM', '', false, false, true, "w135");
-}
-else {
-	html_print_select (users_get_info (), "usuario_form", $usuario, '', 'SYSTEM', '', false, false, true, "w135", true);
-}
-echo '</td><td class="datos"><b>'.__('Status').'</b></td><td class="datos">';
-
-if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $config["id_user"])) {
-	html_print_select (incidents_get_status (), "estado_form", $estado, '', '', '', false, false, false, 'w135');
-}
-else {
-	html_print_select (incidents_get_status (), "estado_form", $estado, '', '', '', false, false, false, 'w135', true);
-}
-echo '</td></tr>';
-
-echo '<tr><td class="datos2"><b>'.__('Source').'</b></td><td class="datos2">';
-
-$fields = array ();
-$return = db_get_all_rows_sql ("SELECT origen FROM torigen ORDER BY origen");
-if ($return === false)
-	$return[0] = $estado; //Something must be displayed
-
-foreach ($return as $row) {
-	$fields[$row["origen"]] = $row["origen"];
-}
-
-// 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');
-}
-else {
-	html_print_select ($fields, "origen_form", $estado, '', '', '', false, false, false, 'w135', true);
-}
-echo '</td><td class="datos2"><b>'.__('Group').'</b></td><td class="datos2">';
-
-// Group combo
-if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $config["id_user"])) {
-	html_print_select_groups($config["id_user"], "IR", true, "grupo_form", $id_grupo, '', '', '', false, false, false, 'w135');
-}
-else {
-	html_print_select_groups($config["id_user"], "IR", true, "grupo_form", $id_grupo, '', '', '', false, false, true, 'w135', true);
-}
-
-echo '</td></tr><tr><td class="datos"><b>'.__('Priority').'</b></td><td class="datos">';
-
-if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $config["id_user"])) {
-	html_print_select (incidents_get_priorities (), "prioridad_form", $prioridad, '', '', '', false, false, false, 'w135');
-}
-else {
-	html_print_select (incidents_get_priorities (), "prioridad_form", $prioridad, '', '', '', false, false, false, 'w135', true);
-}
-
-echo '</td><td class="datos"><b>'.__('Creator').'</b></td><td class="datos">';
-if (empty ($id_creator)) {
-	echo 'SYSTEM';
-}
-else {
-	echo $id_creator.' (<i>'.get_user_fullname($id_creator).'</i>)';
-}
-
-echo '</td></tr><tr><td class="datos2" colspan="4">';
-
-if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $config["id_user"])) {
-	html_print_textarea ("descripcion", 15, 80, $texto, 'style="height:200px;"');
-}
-else {
-	html_print_textarea ("descripcion", 15, 80, $texto, 'style="height:200px;" disabled');
-}
-
-echo '</td></tr></table><div style="width: 650px; text-align:right;">';
-
-// Only if user is the used who opened incident or (s)he is admin
-if (isset ($id_inc) AND ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $config["id_user"]))) {
-	html_print_submit_button (__('Update incident'), "accion", false, 'class="sub upd"');
-}
-elseif (check_acl ($config["id_user"], $id_grupo, "IW")) {
-	html_print_submit_button (__('Create'), "accion", false, 'class="sub wand"');
-}
-else {
-	html_print_submit_button (__('Submit'), "accion", true, 'class="sub upd"');
-}
-echo "</div></form>";
-
-//If we're actually working on an incident
-if (isset ($id_inc)) {
-	// ********************************************************************
-	// Notes 
-	// ********************************************************************
-	
-	echo '<div>';
-
-	echo '<a class="note_control" href="#">';
-	echo html_print_image ('images/add.png', true);
-	echo __('Add note');
-	echo '</a>';
-	echo '</div><div>';
-	echo '<form id="add_note" name="nota" method="POST" action="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&insertar_nota=1&id='.$id_inc.'"><h3>'.__('Add note').'</h3>';
-	echo '<table cellpadding="4" cellspacing="4" class="databox" width="600px">
-		<tr><td class="datos2"><textarea name="nota" rows="5" cols="70" style="height: 100px;"></textarea></td>
-		<td valign="bottom"><input name="addnote" type="submit" class="sub wand" value="'.__('Add').'"></td></tr>
-		</table></form></div><div>';
-
-	$result = incidents_get_notes ($id_inc);
-	
-	$table->cellpadding = 4;
-	$table->cellspacing = 4;
-	$table->class = "databox";
-	$table->width = 600;
-	$table->data = array ();
-	$table->head = array ();
-	
-	foreach ($result as $row) {
-		$data = array ();
-		$data[0] = html_print_image("images/page_white_text.png", true, array("border" => '0')); 
-		$data[1] = __('Author').': ' . ui_print_username ($row["id_usuario"], true).' (' . ui_print_timestamp ($row["timestamp"], true).')';
-		array_push ($table->data, $data);
-		
-		$data = array ();
-		$data[0] = '';
-		if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($row["id_usuario"] == $config["id_user"])) {
-			$data[0] .= html_print_input_image ("delete_nota", "images/cross.png", $row["id_nota"], 'border:0px;" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;', true);
-		}
-		$data[1] = $row["nota"];
-		array_push ($table->data, $data);
-	}
-	
-	if (!empty ($table->data)) {
-		echo "<h3>".__('Notes attached to incident').'</h3>';
-		echo '<form method="POST" action="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&id='.$id_inc.'">';
-		html_print_table ($table);
-		echo '</form>';
-	}
-	unset ($table);
-	
-
-	// ************************************************************
-	// Files attached to this incident
-	// ************************************************************
-
-	$result = incidents_get_attach ($id_inc);
-
-	$table->cellpadding = 4;
-	$table->cellspacing = 4;
-	$table->class = "databox";
-	$table->width = 650;
-	$table->head = array ();
-	$table->data = array ();
-
-	$table->head[0] = __('Filename');
-	$table->head[1] = __('Description');
-	$table->head[2] = __('Size');
-	$table->head[3] = __('Delete');
-
-	$table->align[2] = "center";
-	$table->align[3] = "center";
-
-	foreach ($result as $row) {
-		$data[0] = html_print_image("images/disk.png", true, array("border" => '0', "align" => "top")) . '&nbsp;&nbsp;<a target="_new" href="attachment/pand'.$row["id_attachment"].'_'.$row["filename"].'"><b>'.$row["filename"].'</b></a>';
-		$data[1] = $row["description"];
-		$data[2] = format_for_graph ($row["size"])."B";
-		if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $config["id_user"])) {
-			$data[3] = html_print_input_image ("delete_file", "images/cross.png", $row["id_attachment"], 'border:0px;" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;', true);
-		}
-		else {
-			$data[3] = '';
-		}
-		array_push ($table->data, $data);
-	}
-	
-	if (!empty ($table->data)) {
-		echo "<h3>".__('Attached files')."</h3>";
-		echo '<form method="POST" action="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&id='.$id_inc.'">';
-		html_print_table ($table);
-		echo '</form>';
-	}
-	unset ($table);
-	
-	// ************************************************************
-	// Upload control
-	// ************************************************************
-	
-	
-	// Upload control
-	if ((check_acl($config["id_user"], $id_grupo, "IW")==1)) {
-		
-		echo '<div>';
-		echo '<a class="attachment" href="#">';
-		echo html_print_image ('images/add.png', true);
-		echo __('Add attachment');
-		echo '</a>';
-		echo '</div>';
-		
-		echo '<div><form method="post" id="file_control" action="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&id='.$id_inc.'&upload_file=1" enctype="multipart/form-data"><h3>'.__('Add attachment').'</h3>';
-		echo '<table cellpadding="4" cellspacing="3" class="databox" width="400">
-			<tr><td class="datos">'.__('Filename').'</td><td class="datos"><input type="file" name="userfile" value="userfile" class="sub" size="40" /></td></tr>
-			<tr><td class="datos2">'.__('Description').'</td><td class="datos2" colspan="3"><input type="text" name="file_description" size="47"></td></tr>
-			<tr><td colspan="2" style="text-align: right;">	<input type="submit" name="upload" value="'.__('Upload').'" class="sub wand"></td></tr>
-			</table></form></div>';
-	}
-}
-?>
diff --git a/pandora_console/operation/integria_incidents/incident_statistics.php b/pandora_console/operation/integria_incidents/incident_statistics.php
index 985b345374..c7d9a0cc8c 100755
--- a/pandora_console/operation/integria_incidents/incident_statistics.php
+++ b/pandora_console/operation/integria_incidents/incident_statistics.php
@@ -28,21 +28,35 @@ if (! check_acl ($config['id_user'], 0, "IR") == 1) {
 }
 ui_print_page_header (__('Statistics'), "images/book_edit.png", false, "", false, "");
 
+$integria_api = $config['integria_url']."/include/api.php?user=".$config['id_user']."&pass=".$config['integria_api_password'];
+$op = 'get_stats';
+$url = "$integria_api&op=$op";
+
+$curlObj = curl_init();
+curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
+curl_setopt($curlObj, CURLOPT_URL, $url . "&params=opened");
+$opened_tickets = curl_exec($curlObj);
+curl_setopt($curlObj, CURLOPT_URL, $url . "&params=closed");
+$closed_tickets = curl_exec($curlObj);
+curl_close($curlObj);
+
+$opened_tickets = trim($opened_tickets);
+$closed_tickets = trim($closed_tickets);
+
+if (!is_numeric($opened_tickets))
+	$opened_tickets = 0;
+if (!is_numeric($closed_tickets))
+	$closed_tickets = 0;
+
+$data = array();
+$data[__('Opened tickets')] = $opened_tickets;
+$data[__('Closed tickets')] = $closed_tickets;
+
 echo '<table width="90%">
 	<tr><td valign="top"><h3>'.__('Incidents by status').'</h3>';
-echo graph_incidents_status ();
-
-echo '<td valign="top"><h3>'.__('Incidents by priority').'</h3>';
-echo grafico_incidente_prioridad ();
-
-echo '<tr><td><h3>'.__('Incidents by group').'</h3>';
-echo graphic_incident_group();
-
-echo '<td><h3>'.__('Incidents by user').'</h3>';
-echo graphic_incident_user();
-
-echo '<tr><td><h3>'.__('Incidents by source').'</h3>';
-echo graphic_incident_source();
+echo pie3d_graph($config['flash_charts'], $data, 370, 180,
+	__('Other'), '', $config['homedir'] .  "/images/logo_vertical_water.png",
+	$config['fontpath'], $config['font_size']);
 
 echo '</table>';
-?>
+?>
\ No newline at end of file
diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php
index 17fafe5490..6a6ddacc76 100644
--- a/pandora_console/operation/menu.php
+++ b/pandora_console/operation/menu.php
@@ -291,9 +291,11 @@ if (check_acl ($config['id_user'], 0, "IR") == 1) {
 	$temp_sec2 = $sec2; 
 	if($config['integria_enabled']) {
 		$sec2 = "operation/integria_incidents/incident";
+		$sec2sub = "operation/integria_incidents/incident_statistics";
 	}
 	else {
 		$sec2 = "operation/incidents/incident";
+		$sec2sub = "operation/incidents/incident_statistics";
 	}
 	
 	$sub[$sec2]["text"] = __('Incidents');
@@ -301,9 +303,9 @@ if (check_acl ($config['id_user'], 0, "IR") == 1) {
 	$sub[$sec2]["subsecs"] = array(
 		"operation/incidents/incident_detail",
 		"operation/integria_incidents");
-	
+
 	$sub2 = array ();
-	$sub2["operation/incidents/incident_statistics"]["text"] = __('Statistics');
+	$sub2[$sec2sub]["text"] = __('Statistics');
 	
 	$sub[$sec2]["sub2"] = $sub2;
 	$sec2 = $temp_sec2;
diff --git a/pandora_console/pandoradb.data.oracle.sql b/pandora_console/pandoradb.data.oracle.sql
index 0aa98cd627..35aa53743b 100644
--- a/pandora_console/pandoradb.data.oracle.sql
+++ b/pandora_console/pandoradb.data.oracle.sql
@@ -37,6 +37,7 @@ INSERT INTO talert_commands (id, name, command, description, internal, fields_de
 INSERT INTO talert_commands (id, name, command, description, internal, fields_descriptions, fields_values) VALUES (8,'Jabber&#x20;Alert','echo&#x20;_field3_&#x20;|&#x20;sendxmpp&#x20;-r&#x20;_field1_&#x20;--chatroom&#x20;_field2_','Send&#x20;jabber&#x20;alert&#x20;to&#x20;chat&#x20;room&#x20;in&#x20;a&#x20;predefined&#x20;server&#x20;&#40;configure&#x20;first&#x20;.sendxmpprc&#x20;file&#41;.&#x20;Uses&#x20;field3&#x20;as&#x20;text&#x20;message,&#x20;field1&#x20;as&#x20;useralias&#x20;for&#x20;source&#x20;message,&#x20;and&#x20;field2&#x20;for&#x20;chatroom&#x20;name',0,'[\"User&#x20;alias\",\"Chatroom&#x20;name\",\"Message\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]','[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]');
 INSERT INTO talert_commands (id, name, command, description, internal, fields_descriptions, fields_values) VALUES (9,'SMS','sendsms&#x20;_field1_&#x20;_field2_','Send&#x20;SMS&#x20;using&#x20;the&#x20;Pandora&#x20;FMS&#x20;standard&#x20;SMS&#x20;device,&#x20;using&#x20;smstools.&#x20;&#x20;Uses&#x20;field2&#x20;as&#x20;text&#x20;message,&#x20;field1&#x20;as&#x20;destination&#x20;phone&#x20;&#40;include&#x20;international&#x20;prefix!&#41;',0,'[\"Destination&#x20;number\",\"Message\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]','[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]');
 INSERT INTO talert_commands (id, name, command, description, internal, fields_descriptions, fields_values) VALUES (10,'Validate&#x20;Event','Internal&#x20;type','This&#x20;alert&#x20;validate&#x20;the&#x20;events&#x20;matched&#x20;with&#x20;a&#x20;module&#x20;given&#x20;the&#x20;agent&#x20;name&#x20;&#40;_field1_&#41;&#x20;and&#x20;module&#x20;name&#x20;&#40;_field2_&#41;',1,'[\"Agent&#x20;name\",\"Module&#x20;name\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]','[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]');
+INSERT INTO talert_commands (id, name, command, description, internal, fields_descriptions, fields_values) VALUES (11,'Integria&#x20;IMS&#x20;Ticket','Internal&#x20;type','This&#x20;alert&#x20;create&#x20;a&#x20;ticket&#x20;into&#x20;your&#x20;Integria&#x20;IMS.',1,'[\"Integria&#x20;IMS&#x20;API&#x20;path\",\"Integria&#x20;IMS&#x20;API&#x20;pass\",\"Integria&#x20;IMS&#x20;user\",\"Ticket&#x20;title\",\"Ticket&#x20;group&#x20;ID\",\"Ticket&#x20;priority\",\"Ticket&#x20;description\"]','[\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very&#x20;Serious\",\"\"]');
 
 COMMIT;
 END;;
@@ -1081,6 +1082,7 @@ LOCK TABLE talert_actions IN EXCLUSIVE MODE;
 INSERT INTO talert_actions (id, name, id_alert_command, field1, field2, field3, id_group, action_threshold) VALUES (1,'Mail&#x20;to&#x20;XXX',1,'yourmail@domain.es','[PANDORA] Alert from agent _agent_ on module _module_','',0,0);
 INSERT INTO talert_actions (id, name, id_alert_command, field1, field2, field3, id_group, action_threshold) VALUES (2,'Restart&#x20;agent',11,'REFRESH AGENT *','','',0,0);
 INSERT INTO talert_actions (id, name, id_alert_command, field1, field2, field3, id_group, action_threshold) VALUES (3,'Pandora&#x20;FMS&#x20;Event',3,'Event&#x20;generated&#x20;by&#x20;alert','alert_fired','',0,0);
+INSERT INTO talert_actions (id, name, id_alert_command, field1, field2, field3, field4, field5, field6, field7, field8, field9, field10, id_group, action_threshold, field1_recovery, field2_recovery, field3_recovery, field4_recovery, field5_recovery, field6_recovery, field7_recovery, field8_recovery, field9_recovery, field10_recovery) VALUES (4,'Create&#x20;a&#x20;ticket&#x20;in&#x20;Integria&#x20;IMS',13,'http://localhost/integria/include/api.php','1234','admin','_agent_:&#x20;_alert_name_','1','3','_alert_description_','','','',0,0,'','','','','','','','','','');
 COMMIT;
 END;;
 
diff --git a/pandora_console/pandoradb.data.postgreSQL.sql b/pandora_console/pandoradb.data.postgreSQL.sql
index 45c5bfe67e..c83e356651 100644
--- a/pandora_console/pandoradb.data.postgreSQL.sql
+++ b/pandora_console/pandoradb.data.postgreSQL.sql
@@ -34,6 +34,7 @@ INSERT INTO "talert_commands" ("id", "name", "command", "description", "internal
 INSERT INTO "talert_commands" ("id", "name", "command", "description", "internal", "fields_descriptions", "fields_values") VALUES (8,'Jabber&#x20;Alert','echo&#x20;_field3_&#x20;|&#x20;sendxmpp&#x20;-r&#x20;_field1_&#x20;--chatroom&#x20;_field2_','Send&#x20;jabber&#x20;alert&#x20;to&#x20;chat&#x20;room&#x20;in&#x20;a&#x20;predefined&#x20;server&#x20;&#40;configure&#x20;first&#x20;.sendxmpprc&#x20;file&#41;.&#x20;Uses&#x20;field3&#x20;as&#x20;text&#x20;message,&#x20;field1&#x20;as&#x20;useralias&#x20;for&#x20;source&#x20;message,&#x20;and&#x20;field2&#x20;for&#x20;chatroom&#x20;name',0,'[\"User&#x20;alias\",\"Chatroom&#x20;name\",\"Message\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]','[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]');
 INSERT INTO "talert_commands" ("id", "name", "command", "description", "internal", "fields_descriptions", "fields_values") VALUES (9,'SMS','sendsms&#x20;_field1_&#x20;_field2_','Send&#x20;SMS&#x20;using&#x20;the&#x20;Pandora&#x20;FMS&#x20;standard&#x20;SMS&#x20;device,&#x20;using&#x20;smstools.&#x20;&#x20;Uses&#x20;field2&#x20;as&#x20;text&#x20;message,&#x20;field1&#x20;as&#x20;destination&#x20;phone&#x20;&#40;include&#x20;international&#x20;prefix!&#41;',0,'[\"Destination&#x20;number\",\"Message\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]','[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]');
 INSERT INTO "talert_commands" ("id", "name", "command", "description", "internal", "fields_descriptions", "fields_values") VALUES (10,'Validate&#x20;Event','Internal&#x20;type','This&#x20;alert&#x20;validate&#x20;the&#x20;events&#x20;matched&#x20;with&#x20;a&#x20;module&#x20;given&#x20;the&#x20;agent&#x20;name&#x20;&#40;_field1_&#41;&#x20;and&#x20;module&#x20;name&#x20;&#40;_field2_&#41;',1,'[\"Agent&#x20;name\",\"Module&#x20;name\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]','[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]');
+INSERT INTO "talert_commands" ("id", "name", "command", "description", "internal", "fields_descriptions", "fields_values") VALUES (11,'Integria&#x20;IMS&#x20;Ticket','Internal&#x20;type','This&#x20;alert&#x20;create&#x20;a&#x20;ticket&#x20;into&#x20;your&#x20;Integria&#x20;IMS.',1,'[\"Integria&#x20;IMS&#x20;API&#x20;path\",\"Integria&#x20;IMS&#x20;API&#x20;pass\",\"Integria&#x20;IMS&#x20;user\",\"Ticket&#x20;title\",\"Ticket&#x20;group&#x20;ID\",\"Ticket&#x20;priority\",\"Ticket&#x20;description\"]','[\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very&#x20;Serious\",\"\"]');
 SELECT setval('talert_commands_id_seq', (SELECT (SELECT MAX(id) FROM talert_commands)));
 
 --
@@ -1001,6 +1002,7 @@ SELECT setval('talert_commands_id_seq', (SELECT (SELECT MAX(id) FROM talert_comm
 INSERT INTO "talert_actions" ("id", "name", "id_alert_command", "field1", "field2", "field3", "id_group", "action_threshold") VALUES (1,'Mail&#x20;to&#x20;XXX',1,'yourmail@domain.es','[PANDORA] Alert from agent _agent_ on module _module_','',0,0);
 INSERT INTO "talert_actions" ("id", "name", "id_alert_command", "field1", "field2", "field3", "id_group", "action_threshold") VALUES (2,'Restart&#x20;agent',11,'REFRESH AGENT *','','',0,0);
 INSERT INTO "talert_actions" ("id", "name", "id_alert_command", "field1", "field2", "field3", "id_group", "action_threshold") VALUES (3,'Pandora&#x20;FMS&#x20;Event',3,'Event&#x20;generated&#x20;by&#x20;alert','alert_fired','',0,0);
+INSERT INTO "talert_actions" ("id", "name", "id_alert_command", "field1", "field2", "field3", "field4", "field5", "field6", "field7", "field8", "field9", "field10", "id_group", "action_threshold", "field1_recovery", "field2_recovery", "field3_recovery", "field4_recovery", "field5_recovery", "field6_recovery", "field7_recovery", "field8_recovery", "field9_recovery", "field10_recovery") VALUES (4,'Create&#x20;a&#x20;ticket&#x20;in&#x20;Integria&#x20;IMS',13,'http://localhost/integria/include/api.php','1234','admin','_agent_:&#x20;_alert_name_','1','3','_alert_description_','','','',0,0,'','','','','','','','','','');
 SELECT setval('talert_actions_id_seq', (SELECT (SELECT MAX(id) FROM talert_actions)));
 
 INSERT INTO "talert_templates" ("id", "name", "description", "id_alert_action", "field1", "field2", "field3", "type", "value", "matches_value", "max_value", "min_value", "time_threshold", "max_alerts", "min_alerts", "time_from", "time_to", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday", "recovery_notify", "field2_recovery", "field3_recovery", "priority", "id_group", "special_day", "wizard_level") VALUES (1,'Critical&#x20;condition','This is a generic alert template to fire on condition CRITICAL',1,'','','Hello, this is an automated email coming from Pandora FMS\r\n\r\nThis alert has been fired because a CRITICAL condition in one of your monitored items:\r\n\r\nAgent : _agent_\r\nModule: _module_\r\nModule description: _moduledescription_\r\nTimestamp _timestamp_\r\nCurrent value: _data_\r\n\r\nThanks for your time.\r\n\r\nBest regards\r\nPandora FMS\r\n','critical','',1,0.00,0.00,86400,1,0,'12:00:00','12:00:00',1,1,1,1,1,1,1,1,'[PANDORA] Alert RECOVERED for CRITICAL status on _agent_ / _module_','Hello, this is an automated email coming from Pandora FMS\r\n\r\nThis alert has been RECOVERED from a CRITICAL condition in one of your monitored items:\r\n\r\nAgent : _agent_\r\nModule: _module_\r\nModule description: _moduledescription_\r\nTimestamp _timestamp_\r\nCurrent value: _data_\r\n\r\nThanks for your time.\r\n\r\nBest regards\r\nPandora FMS\r\n',4,0,0,'basic');
diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql
index c539e85673..cdeb3da013 100644
--- a/pandora_console/pandoradb_data.sql
+++ b/pandora_console/pandoradb_data.sql
@@ -22,6 +22,7 @@ INSERT INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal
 INSERT INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (8,'Jabber&#x20;Alert','echo&#x20;_field3_&#x20;|&#x20;sendxmpp&#x20;-r&#x20;_field1_&#x20;--chatroom&#x20;_field2_','Send&#x20;jabber&#x20;alert&#x20;to&#x20;chat&#x20;room&#x20;in&#x20;a&#x20;predefined&#x20;server&#x20;&#40;configure&#x20;first&#x20;.sendxmpprc&#x20;file&#41;.&#x20;Uses&#x20;field3&#x20;as&#x20;text&#x20;message,&#x20;field1&#x20;as&#x20;useralias&#x20;for&#x20;source&#x20;message,&#x20;and&#x20;field2&#x20;for&#x20;chatroom&#x20;name',0,'[\"User&#x20;alias\",\"Chatroom&#x20;name\",\"Message\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]','[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]');
 INSERT INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (9,'SMS','sendsms&#x20;_field1_&#x20;_field2_','Send&#x20;SMS&#x20;using&#x20;the&#x20;Pandora&#x20;FMS&#x20;standard&#x20;SMS&#x20;device,&#x20;using&#x20;smstools.&#x20;&#x20;Uses&#x20;field2&#x20;as&#x20;text&#x20;message,&#x20;field1&#x20;as&#x20;destination&#x20;phone&#x20;&#40;include&#x20;international&#x20;prefix!&#41;',0,'[\"Destination&#x20;number\",\"Message\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]','[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]');
 INSERT INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (10,'Validate&#x20;Event','Internal&#x20;type','This&#x20;alert&#x20;validate&#x20;the&#x20;events&#x20;matched&#x20;with&#x20;a&#x20;module&#x20;given&#x20;the&#x20;agent&#x20;name&#x20;&#40;_field1_&#41;&#x20;and&#x20;module&#x20;name&#x20;&#40;_field2_&#41;',1,'[\"Agent&#x20;name\",\"Module&#x20;name\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]','[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]');
+INSERT INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (11,'Integria&#x20;IMS&#x20;Ticket','Internal&#x20;type','This&#x20;alert&#x20;create&#x20;a&#x20;ticket&#x20;into&#x20;your&#x20;Integria&#x20;IMS.',1,'[\"Integria&#x20;IMS&#x20;API&#x20;path\",\"Integria&#x20;IMS&#x20;API&#x20;pass\",\"Integria&#x20;IMS&#x20;user\",\"Ticket&#x20;title\",\"Ticket&#x20;group&#x20;ID\",\"Ticket&#x20;priority\",\"Ticket&#x20;description\"]','[\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very&#x20;Serious\",\"\"]');
 
 --
 -- Dumping data for table `tconfig`
@@ -983,7 +984,7 @@ INSERT INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal
 INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (1,'Mail&#x20;to&#x20;XXX',1,'yourmail@domain.es','[PANDORA] Alert from agent _agent_ on module _module_','','','','','','','','',0,0,'','','','','','','','','','');
 INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (2,'Restart&#x20;agent',11,'REFRESH AGENT *','','','','','','','','','',0,0,'','','','','','','','','','');
 INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (3,'Pandora&#x20;FMS&#x20;Event',3,'Event&#x20;generated&#x20;by&#x20;alert','alert_fired','','','','','','','','',0,0,'','','','','','','','','','');
-
+INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (4,'Create&#x20;a&#x20;ticket&#x20;in&#x20;Integria&#x20;IMS',13,'http://localhost/integria/include/api.php','1234','admin','_agent_:&#x20;_alert_name_','1','3','_alert_description_','','','',0,0,'','','','','','','','','','');
 
 INSERT INTO `talert_templates` (`id`, `name`, `description`, `id_alert_action`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `type`, `value`, `matches_value`, `max_value`, `min_value`, `time_threshold`, `max_alerts`, `min_alerts`, `time_from`, `time_to`, `monday`, `tuesday`, `wednesday`, `thursday`, `friday`, `saturday`, `sunday`, `recovery_notify`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`, `priority`, `id_group`, `special_day`, `wizard_level`) VALUES (1,'Critical&#x20;condition','This is a generic alert template to fire on condition CRITICAL',1,'','','Hello, this is an automated email coming from Pandora FMS\r\n\r\nThis alert has been fired because a CRITICAL condition in one of your monitored items:\r\n\r\nAgent : _agent_\r\nModule: _module_\r\nModule description: _moduledescription_\r\nTimestamp _timestamp_\r\nCurrent value: _data_\r\n\r\nThanks for your time.\r\n\r\nBest regards\r\nPandora FMS\r\n','','','','','','','','critical','',1,0.00,0.00,86400,1,0,'12:00:00','12:00:00',1,1,1,1,1,1,1,1,'','[PANDORA] Alert RECOVERED for CRITICAL status on _agent_ / _module_','Hello, this is an automated email coming from Pandora FMS\r\n\r\nThis alert has been RECOVERED from a CRITICAL condition in one of your monitored items:\r\n\r\nAgent : _agent_\r\nModule: _module_\r\nModule description: _moduledescription_\r\nTimestamp _timestamp_\r\nCurrent value: _data_\r\n\r\nThanks for your time.\r\n\r\nBest regards\r\nPandora FMS\r\n','','','','','','','',4,0,0,'basic');