mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
Avoid create agent if no group is selected
This commit is contained in:
parent
d73c215b91
commit
b7c2913071
@ -193,7 +193,7 @@ if ($create_agent) {
|
|||||||
$direccion_agente = io_safe_input($direccion_agente);
|
$direccion_agente = io_safe_input($direccion_agente);
|
||||||
|
|
||||||
$nombre_agente = hash('sha256', $alias.'|'.$direccion_agente.'|'.time().'|'.sprintf('%04d', rand(0, 10000)));
|
$nombre_agente = hash('sha256', $alias.'|'.$direccion_agente.'|'.time().'|'.sprintf('%04d', rand(0, 10000)));
|
||||||
$grupo = get_parameter_post('grupo', null);
|
$grupo = (int) get_parameter_post('grupo');
|
||||||
$intervalo = (string) get_parameter_post('intervalo', SECONDS_5MINUTES);
|
$intervalo = (string) get_parameter_post('intervalo', SECONDS_5MINUTES);
|
||||||
$comentarios = (string) get_parameter_post('comentarios', '');
|
$comentarios = (string) get_parameter_post('comentarios', '');
|
||||||
$modo = (int) get_parameter_post('modo');
|
$modo = (int) get_parameter_post('modo');
|
||||||
@ -215,13 +215,6 @@ if ($create_agent) {
|
|||||||
$secondary_groups = (string) get_parameter('secondary_hidden', '');
|
$secondary_groups = (string) get_parameter('secondary_hidden', '');
|
||||||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||||
|
|
||||||
if ($grupo === null) {
|
|
||||||
$agent_creation_error = __('No group specified');
|
|
||||||
$agent_created_ok = 0;
|
|
||||||
} else {
|
|
||||||
$grupo = (int) $grupo;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($fields === false) {
|
if ($fields === false) {
|
||||||
$fields = [];
|
$fields = [];
|
||||||
}
|
}
|
||||||
@ -236,7 +229,7 @@ if ($create_agent) {
|
|||||||
if ($alias == '') {
|
if ($alias == '') {
|
||||||
$agent_creation_error = __('No agent alias specified');
|
$agent_creation_error = __('No agent alias specified');
|
||||||
$agent_created_ok = 0;
|
$agent_created_ok = 0;
|
||||||
} else if ($agent_created_ok != 0) {
|
} else {
|
||||||
if ($alias_as_name) {
|
if ($alias_as_name) {
|
||||||
$sql = 'SELECT nombre FROM tagente WHERE nombre = "'.$alias.'"';
|
$sql = 'SELECT nombre FROM tagente WHERE nombre = "'.$alias.'"';
|
||||||
$exists_alias = db_get_row_sql($sql);
|
$exists_alias = db_get_row_sql($sql);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user