Merge branch 'ent-2540-Macro-de-IP-del-agente-no-funciona-event-responses-EUComm' into 'develop'

Fixed macro _agent_adress_ on events responses

See merge request artica/pandorafms!1872
This commit is contained in:
vgilc 2018-10-25 13:03:44 +02:00
commit d71257ea1c
1 changed files with 13 additions and 8 deletions

View File

@ -1850,15 +1850,20 @@ function events_get_response_target($event_id, $response_id, $server_id, $histor
// Substitute each macro
if (strpos($target, '_agent_address_') !== false) {
if ($meta) {
$server = metaconsole_get_connection_by_id ($server_id);
metaconsole_connect($server);
$agente_table_name = 'tmetaconsole_agent';
$filter = array(
'id_tagente' => $event['id_agente'],
'id_tmetaconsole_setup' => $server_id
);
} else {
$agente_table_name = 'tagente';
$filter = array('id_agente' => $event['id_agente']);
}
$target = str_replace('_agent_address_', $event['id_agente'], $target);
if($meta) {
metaconsole_restore_db_force();
}
$ip = db_get_value_filter('direccion', $agente_table_name, $filter);
// If agent has not an ip, display N/A
if ($ip === false) $ip = __('N/A');
$target = str_replace('_agent_address_', $ip, $target);
}
if (strpos($target, '_agent_id_') !== false) {
$target = str_replace('_agent_id_', $event['id_agente'], $target);