Merge branch 'ent-7414-rear-eventos-por-cli-metaconsola' into 'develop'

fixed error with meta create vent cli

See merge request artica/pandorafms!4079
This commit is contained in:
Daniel Rodriguez 2021-04-28 14:19:21 +00:00
commit 9b90039fe2
1 changed files with 8 additions and 1 deletions

View File

@ -237,8 +237,15 @@ sub get_command_id ($$) {
########################################################################
sub get_agent_id ($$) {
my ($dbh, $agent_name) = @_;
my $is_meta = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token like 'metaconsole'");
my $rc;
if($is_meta == 1) {
$rc = get_db_value ($dbh, "SELECT id_agente FROM tmetaconsole_agent WHERE nombre = ? OR direccion = ?", safe_input($agent_name), $agent_name);
} else {
$rc = get_db_value ($dbh, "SELECT id_agente FROM tagente WHERE nombre = ? OR direccion = ?", safe_input($agent_name), $agent_name);
}
my $rc = get_db_value ($dbh, "SELECT id_agente FROM tagente WHERE nombre = ? OR direccion = ?", safe_input($agent_name), $agent_name);
return defined ($rc) ? $rc : -1;
}