Fixed detection disabled on serialized ajax get groups and clean call in metaconsole

This commit is contained in:
fermin831 2018-07-19 13:49:51 +02:00
parent 2d45c0b39f
commit e762b7322c
1 changed files with 29 additions and 1 deletions

View File

@ -66,6 +66,7 @@ if (is_ajax ()) {
}
if ($get_group_agents) {
ob_clean();
$id_group = (int) get_parameter ('id_group');
$disabled = (int) get_parameter ('disabled', 0);
$search = (string) get_parameter ('search', '');
@ -151,7 +152,34 @@ if (is_ajax ()) {
$agents[$keys_prefix . $k] = $v;
unset($agents[$k]);
if ($all_agents) {
$agent_disabled = db_get_value_filter('disabled', 'tagente', array('id_agente' => $k));
// Unserialize to get the status
if ($serialized && is_metaconsole()) {
$agent_info = explode($serialized_separator, $k);
$agent_disabled = db_get_value_filter(
'disabled',
'tmetaconsole_agent',
array(
'id_tagente' => $agent_info[1],
'id_tmetaconsole_setup' => $agent_info[0]
)
);
} elseif ($serialized && !is_metaconsole() && $force_serialized) {
$agent_info = explode($serialized_separator, $k);
$agent_disabled = db_get_value_filter(
'disabled',
'tagente',
array('id_agente' => $agent_info[1])
);
} elseif (!$serialized && is_metaconsole()) {
// Cannot retrieve the disabled status. Mark all as not disabled
$agent_disabled = 0;
} else {
$agent_disabled = db_get_value_filter(
'disabled',
'tagente',
array('id_agente' => $k)
);
}
$agents_disabled[$keys_prefix . $k] = $agent_disabled;
}
}