Merge branch 'ent-4425-api-cli-eventos-en-progreso' into 'develop'
Ent 4425 api cli eventos en progreso See merge request artica/pandorafms!3265
This commit is contained in:
commit
1fb257108c
|
@ -16151,3 +16151,38 @@ 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 [string] $trash2 don't use.
|
||||
* @param [string] $returnType
|
||||
*
|
||||
* Example
|
||||
* http://127.0.0.1/pandora_console/include/api.php?op=set&op2=event_in_progress&return_type=json&id=0&apipass=1234&user=admin&pass=pandora
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function api_set_event_in_progress($event_id, $trash2, $returnType)
|
||||
{
|
||||
global $config;
|
||||
if (is_metaconsole()) {
|
||||
$table = 'tmetaconsole_event';
|
||||
} else {
|
||||
$table = 'tevento';
|
||||
}
|
||||
|
||||
$event = db_process_sql_update(
|
||||
$table,
|
||||
['estado' => 2],
|
||||
['id_evento' => $event_id]
|
||||
);
|
||||
|
||||
if ($event !== false) {
|
||||
returnData('string', ['data' => $event]);
|
||||
} else {
|
||||
returnError('id_not_found', 'string');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -244,6 +244,8 @@ sub help_screen{
|
|||
help_screen_line('--duplicate_visual_console', '<id> <times> [<prefix>]', 'Duplicate a visual console');
|
||||
help_screen_line('--export_json_visual_console', '<id> [<path>] [<with_element_id>]', 'Creates a json with the visual console elements information');
|
||||
|
||||
print "\nEVENTS\n\n" unless $param ne '';
|
||||
help_screen_line('--event_in_progress', '<id_event> ', 'Set event in progress');
|
||||
|
||||
print "\n";
|
||||
exit;
|
||||
|
@ -255,7 +257,7 @@ sub help_screen{
|
|||
sub api_call($$$;$$$$) {
|
||||
my ($pa_config, $op, $op2, $id, $id2, $other, $return_type) = @_;
|
||||
my $content = undef;
|
||||
|
||||
|
||||
eval {
|
||||
# Set the parameters for the POST request.
|
||||
my $params = {};
|
||||
|
@ -7711,6 +7713,9 @@ sub pandora_manage_main ($$$) {
|
|||
elsif ($param eq '--reset_agent_counts') {
|
||||
param_check($ltotal, 1, 0);
|
||||
cli_reset_agent_counts();
|
||||
}elsif ($param eq '--event_in_progress') {
|
||||
param_check($ltotal, 1, 0);
|
||||
cli_event_in_progress();
|
||||
}
|
||||
else {
|
||||
print_log "[ERROR] Invalid option '$param'.\n\n";
|
||||
|
@ -8360,3 +8365,20 @@ sub cli_reset_agent_counts() {
|
|||
print "$result \n\n ";
|
||||
|
||||
}
|
||||
|
||||
|
||||
##############################################################################
|
||||
# Set an event in progress.
|
||||
# Related option: --event_in_progress
|
||||
##############################################################################
|
||||
|
||||
sub cli_event_in_progress() {
|
||||
my $event_id = @ARGV[2];
|
||||
|
||||
# Call the API.
|
||||
my $result = api_call(
|
||||
$conf, 'set', 'event_in_progress', $event_id
|
||||
);
|
||||
|
||||
print "\n$result\n";
|
||||
}
|
Loading…
Reference in New Issue