Kill pink unicorns
This commit is contained in:
parent
ba423c93d8
commit
e5ec0cb35a
|
@ -196,7 +196,6 @@ if ($create_agent) {
|
|||
if($alias_as_name){
|
||||
$sql = 'SELECT nombre FROM tagente WHERE nombre = "' . $alias . '"';
|
||||
$exists_alias = db_get_row_sql($sql);
|
||||
html_debug_print($exists_alias, true);
|
||||
$nombre_agente = $alias;
|
||||
}
|
||||
|
||||
|
|
|
@ -2524,7 +2524,9 @@ function agents_get_agent_custom_field ($agent_id, $custom_field_name) {
|
|||
return db_get_value_sql($sql);
|
||||
}
|
||||
|
||||
function select_modules_for_agent_group($id_group, $id_agents, $selection, $return=true){
|
||||
function select_modules_for_agent_group($id_group, $id_agents,
|
||||
$selection, $return = true) {
|
||||
|
||||
$agents = implode(",", $id_agents);
|
||||
|
||||
$filter_group = "";
|
||||
|
|
|
@ -490,35 +490,33 @@ if (is_ajax ()) {
|
|||
asort($result);
|
||||
}
|
||||
else {
|
||||
|
||||
if(implode(',', $idAgents) < 0){
|
||||
|
||||
|
||||
$sql = 'SELECT DISTINCT(nombre) 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)
|
||||
FROM tagente_modulo t1
|
||||
WHERE ' . $filter . '
|
||||
AND t1.delete_pending = 0
|
||||
AND t1.id_agente IN (' . implode(',', $idAgents) . ')';
|
||||
|
||||
if ($selection_mode == 'common') {
|
||||
$sql .= ' AND (
|
||||
SELECT count(nombre)
|
||||
FROM tagente_modulo t2
|
||||
WHERE t2.delete_pending = 0
|
||||
AND t1.nombre = t2.nombre
|
||||
AND t2.id_agente IN (' . implode(',', $idAgents) . ')) = (' . count($idAgents) . ')';
|
||||
}elseif ($selection_mode == 'unknown'){
|
||||
$sql .= 'AND t1.id_agente_modulo IN (SELECT id_agente_modulo FROM tagente_estado where estado = 3 OR estado = 4)';
|
||||
if(implode(',', $idAgents) < 0) {
|
||||
$sql = 'SELECT DISTINCT(nombre) 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)
|
||||
FROM tagente_modulo t1
|
||||
WHERE ' . $filter . '
|
||||
AND t1.delete_pending = 0
|
||||
AND t1.id_agente IN (' . implode(',', $idAgents) . ')';
|
||||
|
||||
if ($selection_mode == 'common') {
|
||||
$sql .= ' AND (
|
||||
SELECT count(nombre)
|
||||
FROM tagente_modulo t2
|
||||
WHERE t2.delete_pending = 0
|
||||
AND t1.nombre = t2.nombre
|
||||
AND t2.id_agente IN (' . implode(',', $idAgents) . ')) = (' . count($idAgents) . ')';
|
||||
}
|
||||
elseif ($selection_mode == 'unknown') {
|
||||
$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);
|
||||
|
|
Loading…
Reference in New Issue