Merge branch 'ent-4427-Funcion-API-validate_event_by_id' into 'develop'
Ent 4427 funcion api validate event by See merge request artica/pandorafms!2639
This commit is contained in:
commit
aadb2ea783
|
@ -12549,12 +12549,23 @@ function api_get_netflow_get_summary($discard_1, $discard_2, $params)
|
||||||
function api_set_validate_event_by_id($id, $trash1=null, $trash2=null, $returnType='string')
|
function api_set_validate_event_by_id($id, $trash1=null, $trash2=null, $returnType='string')
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
if (!check_acl($config['id_user'], 0, 'EW')) {
|
||||||
|
returnError('forbidden', 'string');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$table_events = 'tevento';
|
||||||
|
if (is_metaconsole()) {
|
||||||
|
$table_events = 'tmetaconsole_event';
|
||||||
|
}
|
||||||
|
|
||||||
$data['type'] = 'string';
|
$data['type'] = 'string';
|
||||||
$check_id = db_get_value('id_evento', 'tevento', 'id_evento', $id);
|
$check_id = db_get_value('id_evento', $table_events, 'id_evento', $id);
|
||||||
|
|
||||||
if ($check_id) {
|
if ($check_id) {
|
||||||
// event exists
|
// event exists
|
||||||
$status = db_get_value('estado', 'tevento', 'id_evento', $id);
|
$status = db_get_value('estado', $table_events, 'id_evento', $id);
|
||||||
if ($status == 1) {
|
if ($status == 1) {
|
||||||
// event already validated
|
// event already validated
|
||||||
$data['data'] = 'Event already validated';
|
$data['data'] = 'Event already validated';
|
||||||
|
@ -12568,7 +12579,7 @@ function api_set_validate_event_by_id($id, $trash1=null, $trash2=null, $returnTy
|
||||||
'estado' => 1,
|
'estado' => 1,
|
||||||
];
|
];
|
||||||
|
|
||||||
$result = db_process_sql_update('tevento', $values, ['id_evento' => $id]);
|
$result = db_process_sql_update($table_events, $values, ['id_evento' => $id]);
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
$data['data'] = 'Error validating event';
|
$data['data'] = 'Error validating event';
|
||||||
|
|
Loading…
Reference in New Issue