Ent 4819 no funciona llamada api get events

This commit is contained in:
Tatiana Llorente 2019-10-23 15:53:30 +02:00 committed by Daniel Rodriguez
parent 8fd6f28070
commit 31c36dc015

View File

@ -8293,12 +8293,16 @@ function otherParameter2Filter($other, $return_as_array=false)
$filter['criticity'] = $other['data'][1]; $filter['criticity'] = $other['data'][1];
} }
$idAgent = null;
if (isset($other['data'][2]) && $other['data'][2] != '') { if (isset($other['data'][2]) && $other['data'][2] != '') {
$idAgents = agents_get_agent_id_by_alias($other['data'][2]); $idAgents = agents_get_agent_id_by_alias($other['data'][2]);
if (!empty($idAgent)) { if (!empty($idAgents)) {
$filter[] = 'id_agente IN ('.explode(',', $idAgents).')'; $idAgent = [];
foreach ($idAgents as $key => $value) {
$idAgent[] .= $value['id_agente'];
}
$filter[] = 'id_agente IN ('.implode(',', $idAgent).')';
} else { } else {
$filter['sql'] = '1=0'; $filter['sql'] = '1=0';
} }
@ -8311,10 +8315,22 @@ function otherParameter2Filter($other, $return_as_array=false)
$filterModule['id_agente'] = $idAgent; $filterModule['id_agente'] = $idAgent;
} }
$idAgentModulo = db_get_value_filter('id_agente_modulo', 'tagente_modulo', $filterModule); $idAgentModulo = db_get_all_rows_filter('tagente_modulo', $filterModule, 'id_agente_modulo');
if (!empty($idAgentModulo)) {
$id_agentmodule = [];
foreach ($idAgentModulo as $key => $value) {
$id_agentmodule[] .= $value['id_agente_modulo'];
}
$idAgentModulo = $id_agentmodule;
if ($idAgentModulo !== false) { if ($idAgentModulo !== false) {
$filter['id_agentmodule'] = $idAgentModulo; $filter['id_agentmodule'] = $idAgentModulo;
} }
} else {
// If the module doesn't exist or doesn't exist in that agent.
$filter['sql'] = '1=0';
}
} }
if (isset($other['data'][4]) && $other['data'][4] != '') { if (isset($other['data'][4]) && $other['data'][4] != '') {
@ -8402,13 +8418,11 @@ function otherParameter2Filter($other, $return_as_array=false)
if ($other['data'][12] == 'more_criticity') { if ($other['data'][12] == 'more_criticity') {
$filter['more_criticity'] = true; $filter['more_criticity'] = true;
} }
} else {
} }
} else { } else {
if ($return_as_array) { if ($return_as_array) {
$filter['total'] = false; $filter['total'] = false;
$filter['more_criticity'] = false; $filter['more_criticity'] = false;
} else {
} }
} }
@ -10045,8 +10059,7 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
$data['type'] = 'array'; $data['type'] = 'array';
$data['data'] = $result; $data['data'] = $result;
returnData($returnType, $data, $separator); // returnData($returnType, $data, $separator);
if (empty($result)) { if (empty($result)) {
return false; return false;
} }
@ -10086,8 +10099,6 @@ function api_get_events($trash1, $trash2, $other, $returnType, $user_in_db=null)
returnError('ERROR_API_PANDORAFMS', $returnType); returnError('ERROR_API_PANDORAFMS', $returnType);
} }
} }
return;
} }
if ($other['type'] == 'string') { if ($other['type'] == 'string') {
@ -10104,7 +10115,7 @@ function api_get_events($trash1, $trash2, $other, $returnType, $user_in_db=null)
$filterString = otherParameter2Filter($other); $filterString = otherParameter2Filter($other);
} }
if (defined('METACONSOLE')) { if (is_metaconsole()) {
$dataRows = db_get_all_rows_filter('tmetaconsole_event', $filterString); $dataRows = db_get_all_rows_filter('tmetaconsole_event', $filterString);
} else { } else {
$dataRows = db_get_all_rows_filter('tevento', $filterString); $dataRows = db_get_all_rows_filter('tevento', $filterString);