2013-01-16 Vanessa Gil <vanessa.gil@artica.es>

* include/functions_api.php: Change 'add comments' and
	'owner user' in create events.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7481 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
vgilc 2013-01-16 12:33:45 +00:00
parent 2b3daa01a6
commit 95b2d22285
2 changed files with 20 additions and 7 deletions

View File

@ -1,3 +1,8 @@
2013-01-16 Vanessa Gil <vanessa.gil@artica.es>
* include/functions_api.php: Change 'add comments' and
'owner user' in create events.
2013-01-15 Juan Manuel Ramon <juanmanuel.ramon@artica.es> 2013-01-15 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/config_process.php: Fixed language translation in * include/config_process.php: Fixed language translation in

View File

@ -5473,6 +5473,7 @@ function api_get_event_info($id_event, $trash1, $trash, $returnType) {
//http://127.0.0.1/pandora_console/include/api.php?op=set&op2=create_event&id=name_event&other=2|system|3|admin|2|1|10|0|comments||Pandora||critical_inst|warning_inst|unknown_inst|other&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora //http://127.0.0.1/pandora_console/include/api.php?op=set&op2=create_event&id=name_event&other=2|system|3|admin|2|1|10|0|comments||Pandora||critical_inst|warning_inst|unknown_inst|other&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora
function api_set_create_event($id, $trash1, $other, $returnType) { function api_set_create_event($id, $trash1, $other, $returnType) {
if ($other['type'] == 'string') { if ($other['type'] == 'string') {
returnError('error_parameter', 'Error in the parameters.'); returnError('error_parameter', 'Error in the parameters.');
return; return;
@ -5493,8 +5494,6 @@ function api_set_create_event($id, $trash1, $other, $returnType) {
returnError('error_parameter', 'Event type required.'); returnError('error_parameter', 'Event type required.');
return; return;
} }
if ($other['data'][2] != '') if ($other['data'][2] != '')
$values['id_agente'] = $other['data'][2]; $values['id_agente'] = $other['data'][2];
if ($other['data'][3] != '') if ($other['data'][3] != '')
@ -5513,8 +5512,7 @@ function api_set_create_event($id, $trash1, $other, $returnType) {
$values['id_alert_am'] = $other['data'][6]; $values['id_alert_am'] = $other['data'][6];
if ($other['data'][7] != '') if ($other['data'][7] != '')
$values['criticity'] = $other['data'][7]; $values['criticity'] = $other['data'][7];
if ($other['data'][8] != '')
$values['user_comment'] = $other['data'][8];
if ($other['data'][9] != '') if ($other['data'][9] != '')
$values['tags'] = $other['data'][9]; $values['tags'] = $other['data'][9];
if ($other['data'][10] != '') if ($other['data'][10] != '')
@ -5532,9 +5530,6 @@ function api_set_create_event($id, $trash1, $other, $returnType) {
if ($other['data'][14] != '') { if ($other['data'][14] != '') {
$values['unknown_instructions'] = $other['data'][14]; $values['unknown_instructions'] = $other['data'][14];
} }
if ($other['data'][15] != '') {
$values['owner_user'] = $other['data'][15];
}
$values ['ack_utimestamp'] = 0; $values ['ack_utimestamp'] = 0;
if (preg_match("/\w*alert\w*/", $values['event_type'])) { if (preg_match("/\w*alert\w*/", $values['event_type'])) {
@ -5552,6 +5547,19 @@ function api_set_create_event($id, $trash1, $other, $returnType) {
$return = db_process_sql_insert('tevento', $values); $return = db_process_sql_insert('tevento', $values);
if ($other['data'][8] != '') { //user comments
if ($return !== false) { //event successfully created
$user_comment = $other['data'][8];
$res = events_comment ($return, $user_comment);
if ($other['data'][15] != '') { //owner user
if ($res !== false) { //comment added
$owner_user = $other['data'][15];
events_change_owner ($return, $owner_user, true);
}
}
}
}
$data['type'] = 'string'; $data['type'] = 'string';
if ($return === false) { if ($return === false) {
$data['data'] = 0; $data['data'] = 0;