Merge branch '1976-Informe-de-log-dev' into 'develop'
Fixed sources in log report See merge request artica/pandorafms!1508
This commit is contained in:
commit
4abf3f3b2e
|
@ -930,10 +930,10 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
$agents = agents_get_group_agents($group);
|
||||
if ((empty($agents)) || $agents == -1) $agents = array();
|
||||
|
||||
$sql_log = 'SELECT source
|
||||
$sql_log = 'SELECT source AS k, source AS v
|
||||
FROM tagente,tagent_module_log
|
||||
WHERE tagente.id_agente = tagent_module_log.id_agent ';
|
||||
|
||||
WHERE tagente.id_agente = tagent_module_log.id_agent AND tagente.disabled = 0';
|
||||
|
||||
if (!empty($agents)) {
|
||||
$index = 0;
|
||||
foreach ($agents as $key => $a) {
|
||||
|
@ -947,7 +947,7 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
}
|
||||
$sql_log .= ")";
|
||||
}
|
||||
html_print_select_from_sql ($sql_log, 'source', $source, '', __('All'), '', false, false, false);
|
||||
html_print_select_from_sql ($sql_log, 'source', $source, 'onselect=source_change_agents();', __('All'), '', false, false, false);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -1066,9 +1066,15 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
<td style="font-weight:bold;"><?php echo __('Agents'); ?></td>
|
||||
<td>
|
||||
<?php
|
||||
$sql_log_report = 'SELECT id_agente, alias
|
||||
FROM tagente, tagent_module_log
|
||||
WHERE tagente.id_agente = tagent_module_log.id_agent';
|
||||
if ($source) {
|
||||
$sql_log_report = 'SELECT id_agente, alias
|
||||
FROM tagente, tagent_module_log
|
||||
WHERE tagente.id_agente = tagent_module_log.id_agent AND tagente.disabled = 0 AND tagent_module_log.source like "'. $source.'"';
|
||||
} else {
|
||||
$sql_log_report = 'SELECT id_agente, alias
|
||||
FROM tagente, tagent_module_log
|
||||
WHERE tagente.id_agente = tagent_module_log.id_agent AND tagente.disabled = 0';
|
||||
}
|
||||
$all_agent_log = db_get_all_rows_sql($sql_log_report);
|
||||
|
||||
foreach ($all_agent_log as $key => $value) {
|
||||
|
@ -1089,6 +1095,7 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
}
|
||||
}
|
||||
html_print_select($agents2, 'id_agents2[]', $agents_select, $script = '', "", 0, false, true, true, '', false, "min-width: 180px");
|
||||
echo "<span id='spinner_hack' style='display:none;'>" . html_print_image('images/spinner.gif', true) . "</span>";
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -3522,4 +3529,22 @@ function set_last_value_period() {
|
|||
$("#row_period").show();
|
||||
}
|
||||
}
|
||||
|
||||
function source_change_agents() {
|
||||
$("#id_agents2").empty();
|
||||
$("#spinner_hack").show();
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "operation/agentes/ver_agente",
|
||||
"get_agents_source_json" : 1,
|
||||
"source" : $("#source").val()
|
||||
},
|
||||
function (data, status) {
|
||||
for (var clave in data) {
|
||||
$("#id_agents2").append('<option value="'+clave+'">'+data[clave]+'</option>');
|
||||
}
|
||||
$("#spinner_hack").hide();
|
||||
},
|
||||
"json"
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -44,6 +44,7 @@ if (is_ajax ()) {
|
|||
$get_agentmodule_status_tooltip = (bool) get_parameter ("get_agentmodule_status_tooltip");
|
||||
$get_group_status_tooltip = (bool) get_parameter ("get_group_status_tooltip");
|
||||
$get_agent_id = (bool) get_parameter ("get_agent_id");
|
||||
$get_agents_source_json = (bool) get_parameter ("get_agents_source_json");
|
||||
$cluster_mode = (bool) get_parameter ("cluster_mode",0);
|
||||
$agent_alias = get_parameter('alias', '');
|
||||
$agents_inserted = get_parameter('agents_inserted', array());
|
||||
|
@ -1001,6 +1002,29 @@ if (is_ajax ()) {
|
|||
return;
|
||||
}
|
||||
|
||||
if ($get_agents_source_json) {
|
||||
$source = get_parameter('source', '');
|
||||
|
||||
if (empty($source)) {
|
||||
$sql_report_log = 'SELECT id_agente, alias
|
||||
FROM tagente, tagent_module_log
|
||||
WHERE tagente.id_agente = tagent_module_log.id_agent AND tagente.disabled = 0';
|
||||
} else {
|
||||
$sql_report_log = 'SELECT id_agente, alias
|
||||
FROM tagente, tagent_module_log
|
||||
WHERE tagente.id_agente = tagent_module_log.id_agent AND tagente.disabled = 0 AND tagent_module_log.source like "'. $source.'"';
|
||||
}
|
||||
|
||||
$all_agent_log = db_get_all_rows_sql($sql_report_log);
|
||||
|
||||
foreach ($all_agent_log as $key => $value) {
|
||||
$agents2[$value['id_agente']] = $value['alias'];
|
||||
}
|
||||
|
||||
echo json_encode($agents2);
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue