Fixed total count in group_view(meta). Ticket#3295

This commit is contained in:
Arturo Gonzalez 2016-01-28 14:41:54 +01:00
parent db28ad3e80
commit 4d15ee38e2
1 changed files with 58 additions and 28 deletions

View File

@ -39,31 +39,61 @@ function groupview_get_all_data ($id_user = false, $user_strict = false, $acltag
} }
if (!empty($user_groups_ids)) { if (!empty($user_groups_ids)) {
switch ($config["dbtype"]) { if (is_metaconsole()) {
case "mysql": switch ($config["dbtype"]) {
$list_groups = db_get_all_rows_sql(" case "mysql":
SELECT * $list_groups = db_get_all_rows_sql("
FROM tgrupo SELECT *
WHERE id_grupo IN (" . $user_groups_ids . ") FROM tgrupo
AND id_grupo IN (SELECT id_grupo FROM tagente WHERE disabled = 0) WHERE id_grupo IN (" . $user_groups_ids . ")
ORDER BY nombre COLLATE utf8_general_ci ASC"); AND id_grupo IN (SELECT id_grupo FROM tmetaconsole_agent WHERE disabled = 0)
break; ORDER BY nombre COLLATE utf8_general_ci ASC");
case "postgresql": break;
$list_groups = db_get_all_rows_sql(" case "postgresql":
SELECT * $list_groups = db_get_all_rows_sql("
FROM tgrupo SELECT *
WHERE id_grupo IN (" . $user_groups_ids . ") FROM tgrupo
AND id_grupo IN (SELECT id_grupo FROM tagente WHERE disabled = 0) WHERE id_grupo IN (" . $user_groups_ids . ")
ORDER BY nombre ASC"); AND id_grupo IN (SELECT id_grupo FROM tmetaconsole_agent WHERE disabled = 0)
break; ORDER BY nombre ASC");
case "oracle": break;
$list_groups = db_get_all_rows_sql(" case "oracle":
SELECT * $list_groups = db_get_all_rows_sql("
FROM tgrupo SELECT *
WHERE id_grupo IN (" . $user_groups_ids . ") FROM tgrupo
AND id_grupo IN (SELECT id_grupo FROM tagente WHERE disabled = 0) WHERE id_grupo IN (" . $user_groups_ids . ")
ORDER BY nombre ASC"); AND id_grupo IN (SELECT id_grupo FROM tmetaconsole_agent WHERE disabled = 0)
break; ORDER BY nombre ASC");
break;
}
}
else {
switch ($config["dbtype"]) {
case "mysql":
$list_groups = db_get_all_rows_sql("
SELECT *
FROM tgrupo
WHERE id_grupo IN (" . $user_groups_ids . ")
AND id_grupo IN (SELECT id_grupo FROM tagente WHERE disabled = 0)
ORDER BY nombre COLLATE utf8_general_ci ASC");
break;
case "postgresql":
$list_groups = db_get_all_rows_sql("
SELECT *
FROM tgrupo
WHERE id_grupo IN (" . $user_groups_ids . ")
AND id_grupo IN (SELECT id_grupo FROM tagente WHERE disabled = 0)
ORDER BY nombre ASC");
break;
case "oracle":
$list_groups = db_get_all_rows_sql("
SELECT *
FROM tgrupo
WHERE id_grupo IN (" . $user_groups_ids . ")
AND id_grupo IN (SELECT id_grupo FROM tagente WHERE disabled = 0)
ORDER BY nombre ASC");
break;
}
} }
} }
@ -490,7 +520,7 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
SELECT * SELECT *
FROM tgrupo FROM tgrupo
WHERE id_grupo IN (" . $user_groups_ids . ") WHERE id_grupo IN (" . $user_groups_ids . ")
AND id_grupo IN (SELECT id_grupo FROM tmetaconsole_agent) AND id_grupo IN (SELECT id_grupo FROM tmetaconsole_agent WHERE disabled = 0)
ORDER BY nombre COLLATE utf8_general_ci ASC"); ORDER BY nombre COLLATE utf8_general_ci ASC");
break; break;
case "postgresql": case "postgresql":
@ -498,7 +528,7 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
SELECT * SELECT *
FROM tgrupo FROM tgrupo
WHERE id_grupo IN (" . $user_groups_ids . ") WHERE id_grupo IN (" . $user_groups_ids . ")
AND id_grupo IN (SELECT id_grupo FROM tmetaconsole_agent) AND id_grupo IN (SELECT id_grupo FROM tmetaconsole_agent WHERE disabled = 0)
ORDER BY nombre ASC"); ORDER BY nombre ASC");
break; break;
case "oracle": case "oracle":
@ -506,7 +536,7 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
SELECT * SELECT *
FROM tgrupo FROM tgrupo
WHERE id_grupo IN (" . $user_groups_ids . ") WHERE id_grupo IN (" . $user_groups_ids . ")
AND id_grupo IN (SELECT id_grupo FROM tmetaconsole_agent) AND id_grupo IN (SELECT id_grupo FROM tmetaconsole_agent WHERE disabled = 0)
ORDER BY nombre ASC"); ORDER BY nombre ASC");
break; break;
} }