From 7676852bd0ea3ca27b434dde9d3ed67f14a34c52 Mon Sep 17 00:00:00 2001 From: marcos Date: Tue, 2 Jun 2020 17:26:43 +0200 Subject: [PATCH] set event in progress on api --- pandora_console/include/functions_api.php | 46 +++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 76e10533aa..82538fa1ee 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -16021,3 +16021,49 @@ function api_get_event_mcid($server_id, $console_event_id, $trash2, $returnType) return; } } + + +/** + * Function to set events in progress status. + * + * @param [int] $event_id Id event (Node or Meta). + * @param [int] $server_id Id node event in tmetaconsole_event. + * @param [string] $trash2 don't use. + * @param [string] $returnType + * + * Example + * http://172.17.0.1/pandora_console/include/api.php?op=set&op2=event_in_progress&return_type=json&id=0&id2=0&apipass=1234&user=admin&pass=pandora + * + * @return void + */ +function api_set_event_in_progress($event_id, $server_id, $trash2, $returnType) +{ + global $config; + + if (is_metaconsole()) { + $event = db_process_sql_update( + 'tmetaconsole_event', + ['estado' => 2], + [ + 'id_source_event' => $event_id, + 'server_id' => $server_id, + ] + ); + if ($event !== false) { + returnData($returnType, ['type' => 'string', 'data' => $event]); + } else { + returnError('id_not_found', 'string'); + } + } else { + $event = db_process_sql_update( + 'tevento', + ['estado' => 2], + ['id_evento' => $event_id] + ); + if ($event !== false) { + returnData($returnType, ['type' => 'string', 'data' => $event]); + } else { + returnError('id_not_found', 'string'); + } + } +}