Recovered the lost code for the current user macro at the event responses.
(cherry picked from commit d554dcc7db
[formerly 1a5860bc7a62efecba44d467df9eb9cf7e25070b])
Former-commit-id: de201ec04f1dc211c56db3fc0dbf8ae66a549ddf
This commit is contained in:
parent
8fc432b934
commit
42d8e72400
|
@ -2272,35 +2272,29 @@ function events_page_responses($event, $childrens_ids=[])
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace macros in the target of a response and return it.
|
* Replace macros in the target of a response and return it.
|
||||||
* If server_id > 0, is a metaconsole query.
|
* If server_id > 0, it's a metaconsole query.
|
||||||
*
|
*
|
||||||
* @param integer $event_id Event_id.
|
* @param integer $event_id Event identifier.
|
||||||
* @param integer $response_id Response_id.
|
* @param integer $response_id Event response identifier.
|
||||||
* @param integer $server_id Server_id.
|
* @param integer $server_id Node identifier (for metaconsole).
|
||||||
* @param boolean $history History.
|
* @param boolean $history Use the history database or not.
|
||||||
*
|
*
|
||||||
* @return string Target.
|
* @return string The response text with the macros applied.
|
||||||
*/
|
*/
|
||||||
function events_get_response_target(
|
function events_get_response_target(
|
||||||
$event_id,
|
int $event_id,
|
||||||
$response_id,
|
int $response_id,
|
||||||
$server_id,
|
int $server_id=0,
|
||||||
$history=false
|
bool $history=false
|
||||||
) {
|
) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$event_response = db_get_row('tevent_response', 'id', $response_id);
|
// If server_id > 0, it's a metaconsole query.
|
||||||
|
$meta = $server_id > 0;
|
||||||
if ($server_id > 0) {
|
|
||||||
$meta = true;
|
|
||||||
} else {
|
|
||||||
$meta = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$event_table = events_get_events_table($meta, $history);
|
$event_table = events_get_events_table($meta, $history);
|
||||||
|
|
||||||
$event = db_get_row($event_table, 'id_evento', $event_id);
|
$event = db_get_row($event_table, 'id_evento', $event_id);
|
||||||
|
|
||||||
|
$event_response = db_get_row('tevent_response', 'id', $response_id);
|
||||||
$target = io_safe_output($event_response['target']);
|
$target = io_safe_output($event_response['target']);
|
||||||
|
|
||||||
// Substitute each macro.
|
// Substitute each macro.
|
||||||
|
@ -2317,7 +2311,7 @@ function events_get_response_target(
|
||||||
}
|
}
|
||||||
|
|
||||||
$ip = db_get_value_filter('direccion', $agente_table_name, $filter);
|
$ip = db_get_value_filter('direccion', $agente_table_name, $filter);
|
||||||
// If agent has not an ip, display N/A.
|
// If agent has not an IP, display N/A.
|
||||||
if ($ip === false) {
|
if ($ip === false) {
|
||||||
$ip = __('N/A');
|
$ip = __('N/A');
|
||||||
}
|
}
|
||||||
|
@ -2499,6 +2493,11 @@ function events_get_response_target(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This will replace the macro with the current logged user.
|
||||||
|
if (strpos($target, '_current_user_') !== false) {
|
||||||
|
$target = str_replace('_current_user_', $config['id_user'], $target);
|
||||||
|
}
|
||||||
|
|
||||||
return $target;
|
return $target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue