mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Merge branch '2004-Query_muy_pesada_en_paradas_programadas' into 'develop'
fixed errors select all agent where module common See merge request artica/pandorafms!1340
This commit is contained in:
commit
6932939458
@ -346,7 +346,7 @@ if (is_ajax ()) {
|
||||
// Status selector
|
||||
if ($status_modulo == AGENT_MODULE_STATUS_NORMAL) { //Normal
|
||||
$sql_conditions .= ' estado = 0 AND utimestamp > 0 )
|
||||
OR (t1.id_tipo_modulo IN(21,22,23,100)) ';
|
||||
OR (t1.id_tipo_modulo IN(21,22,23,100)) ';
|
||||
}
|
||||
elseif ($status_modulo == AGENT_MODULE_STATUS_CRITICAL_BAD) { //Critical
|
||||
$sql_conditions .= ' estado = 1 AND utimestamp > 0 )';
|
||||
@ -490,20 +490,33 @@ if (is_ajax ()) {
|
||||
asort($result);
|
||||
}
|
||||
else {
|
||||
if(implode(',', $idAgents) < 0) {
|
||||
$sql = 'SELECT DISTINCT nombre, id_agente_modulo FROM tagente_modulo
|
||||
WHERE nombre IN (
|
||||
SELECT nombre
|
||||
FROM tagente_modulo
|
||||
GROUP BY nombre
|
||||
HAVING count(nombre) = (SELECT count(nombre) FROM tagente_modulo))';
|
||||
}
|
||||
else {
|
||||
$sql = 'SELECT DISTINCT nombre, id_agente_modulo
|
||||
FROM tagente_modulo t1
|
||||
WHERE ' . $filter . '
|
||||
AND t1.delete_pending = 0
|
||||
AND t1.id_agente IN (' . implode(',', $idAgents) . ')';
|
||||
if($idAgents[0] < 0){
|
||||
if($selection_mode == 'common'){
|
||||
$sql_agent_total = 'SELECT count(*) FROM tagente WHERE disabled=0';
|
||||
$agent_total = db_get_value_sql($sql_agent_total);
|
||||
$sql = "SELECT tam.nombre, tam.id_agente_modulo
|
||||
FROM tagente_modulo tam
|
||||
JOIN (
|
||||
SELECT COUNT(*) AS num_names, nombre
|
||||
FROM tagente_modulo
|
||||
WHERE disabled=0
|
||||
AND delete_pending=0
|
||||
GROUP BY nombre
|
||||
) AS tj
|
||||
ON tj.num_names = $agent_total
|
||||
AND tj.nombre = tam.nombre ";
|
||||
}
|
||||
else{
|
||||
$sql = 'SELECT nombre, id_agente_modulo
|
||||
FROM tagente_modulo';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$sql = 'SELECT DISTINCT nombre, id_agente_modulo
|
||||
FROM tagente_modulo t1
|
||||
WHERE ' . $filter . '
|
||||
AND t1.delete_pending = 0
|
||||
AND t1.id_agente IN (' . implode(',', $idAgents) . ')';
|
||||
|
||||
if ($selection_mode == 'common') {
|
||||
$sql .= ' AND (
|
||||
@ -517,10 +530,9 @@ if (is_ajax ()) {
|
||||
$sql .= 'AND t1.id_agente_modulo IN (SELECT id_agente_modulo FROM tagente_estado where estado = 3 OR estado = 4)';
|
||||
}
|
||||
}
|
||||
|
||||
$sql .= ' ORDER BY nombre';
|
||||
|
||||
$nameModules = db_get_all_rows_sql($sql);
|
||||
|
||||
if ($tags != null) {
|
||||
if ((count($tags) >= 1) && ($tags[0] != "") && ($tags[0] != -1)) {
|
||||
$implode_tags = implode(",", $tags);
|
||||
|
Loading…
x
Reference in New Issue
Block a user