Merge branch 'ent-7329-Fallo-de-conteos-en-tactical-view' into 'develop'

fixed count in several views

See merge request artica/pandorafms!4052
This commit is contained in:
Daniel Rodriguez 2021-04-27 11:47:43 +00:00
commit dedd578fe1
4 changed files with 5 additions and 2 deletions

View File

@ -196,6 +196,7 @@ function mainModuleGroups()
ON ta.id_agente = tam.id_agente
WHERE ta.disabled = 0
AND tam.disabled = 0
AND tam.id_modulo <> 0
AND tam.delete_pending = 0
AND ta.id_grupo IN (%s)
GROUP BY tam.id_agente_modulo

View File

@ -706,7 +706,7 @@ function modules_create_agent_module(
}
// Update module status count if the module is not created disabled.
if (!isset($values['disabled']) || $values['disabled'] == 0) {
if ((!isset($values['disabled']) || $values['disabled'] == 0) && $values['id_modulo'] > 0) {
if ($status == 0) {
db_process_sql(
'UPDATE tagente

View File

@ -343,6 +343,7 @@ function tactical_get_data($id_user=false, $user_strict=false, $acltags, $return
INNER JOIN tagente_modulo tam
ON tae.id_agente_modulo = tam.id_agente_modulo
AND tam.disabled = 0
AND tam.id_modulo <> 0
GROUP BY estado',
$user_groups_ids
)
@ -358,6 +359,7 @@ function tactical_get_data($id_user=false, $user_strict=false, $acltags, $return
INNER JOIN tagente_modulo tam
ON tae.id_agente_modulo = tam.id_agente_modulo
AND tam.disabled = 0
AND tam.id_modulo <> 0
LEFT JOIN tagent_secondary_group tasg
ON ta.id_agente = tasg.id_agent
WHERE (ta.id_grupo IN ( %s ) OR tasg.id_group IN ( %s ))

View File

@ -5936,7 +5936,7 @@ sub pandora_update_agent_module_count ($$$) {
}; # Module counts by status.
# Retrieve and hash module status counts.
my @rows = get_db_rows ($dbh, 'SELECT estado, COUNT(*) AS total FROM tagente_modulo, tagente_estado WHERE tagente_modulo.disabled=0 AND tagente_modulo.id_agente_modulo=tagente_estado.id_agente_modulo AND tagente_modulo.id_agente=?GROUP BY estado', $agent_id);
my @rows = get_db_rows ($dbh, 'SELECT estado, COUNT(*) AS total FROM tagente_modulo, tagente_estado WHERE tagente_modulo.disabled=0 AND tagente_modulo.id_modulo<>0 AND tagente_modulo.id_agente_modulo=tagente_estado.id_agente_modulo AND tagente_modulo.id_agente=?GROUP BY estado', $agent_id);
foreach my $row (@rows) {
$counts->{$row->{'estado'}} = $row->{'total'};
$total += $row->{'total'};