2012-06-14 Vanessa Gil <vanessa.gil@artica.es>

* include/functions_agents.php
	  godmode/agentes/modificar_agente.php
	  operation/agentes/estado_agente.php: Fixed bug: sort doesn't work.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6552 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
vgilc 2012-06-14 16:10:10 +00:00
parent aaf245c9d4
commit 85086ef5cd
4 changed files with 45 additions and 35 deletions

View File

@ -1,3 +1,9 @@
2012-06-14 Vanessa Gil <vanessa.gil@artica.es>
* include/functions_agents.php
godmode/agentes/modificar_agente.php
operation/agentes/estado_agente.php: Fixed bug: sort doesn't work.
2012-06-14 Sergio Martin <sergio.martin@artica.es>
* include/functions_api.php

View File

@ -155,11 +155,11 @@ switch ($sortField) {
switch ($sort) {
case 'up':
$selectNameUp = $selected;
$order = array('field' => 'nombre', 'order' => 'ASC');
$order = array('field' => 'nombre COLLATE utf8_general_ci', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC');
break;
case 'down':
$selectNameDown = $selected;
$order = array('field' => 'nombre', 'order' => 'DESC');
$order = array('field' => 'nombre COLLATE utf8_general_ci', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'DESC');
break;
}
break;
@ -167,11 +167,11 @@ switch ($sortField) {
switch ($sort) {
case 'up':
$selectOsUp = $selected;
$order = array('field' => 'id_os', 'order' => 'ASC');
$order = array('field' => 'id_os', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC');
break;
case 'down':
$selectOsDown = $selected;
$order = array('field' => 'id_os', 'order' => 'DESC');
$order = array('field' => 'id_os', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'DESC');
break;
}
break;
@ -179,11 +179,11 @@ switch ($sortField) {
switch ($sort) {
case 'up':
$selectGroupUp = $selected;
$order = array('field' => 'id_grupo', 'order' => 'ASC');
$order = array('field' => 'id_grupo', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC');
break;
case 'down':
$selectGroupDown = $selected;
$order = array('field' => 'id_grupo', 'order' => 'DESC');
$order = array('field' => 'id_grupo', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'DESC');
break;
}
break;
@ -194,7 +194,7 @@ switch ($sortField) {
$selectOsDown = '';
$selectGroupUp = '';
$selectGroupDown = '';
$order = array('field' => 'nombre', 'order' => 'ASC');
$order = array('field' => 'nombre COLLATE utf8_general_ci', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC');
break;
}
@ -224,16 +224,16 @@ if ($ag_group > 0) {
FROM tagente
WHERE id_grupo IN (%s)
%s
ORDER BY %s %s LIMIT %d, %d',
implode (",", $ag_groups), $search_sql, $order['field'], $order['order'], $offset, $config["block_size"]);
ORDER BY %s, %s %s LIMIT %d, %d',
implode (",", $ag_groups), $search_sql, $order['field'], $order['field2'], $order['order'], $offset, $config["block_size"]);
break;
case "postgresql":
$sql = sprintf ('SELECT *
FROM tagente
WHERE id_grupo IN (%s)
%s
ORDER BY %s %s LIMIT %d OFFSET %d',
implode (",", $ag_groups), $search_sql, $order['field'], $order['order'], $config["block_size"], $offset);
ORDER BY %s, %s %s LIMIT %d OFFSET %d',
implode (",", $ag_groups), $search_sql, $order['field'], $order['field2'], $order['order'], $config["block_size"], $offset);
break;
case "oracle":
$set = array ();
@ -243,8 +243,8 @@ if ($ag_group > 0) {
FROM tagente
WHERE id_grupo IN (%s)
%s
ORDER BY %s %s',
implode (",", $ag_groups), $search_sql, $order['field'], $order['order']);
ORDER BY %s, %s %s',
implode (",", $ag_groups), $search_sql, $order['field'], $order['field2'], $order['order']);
$sql = oracle_recode_query ($sql, $set);
break;
}
@ -267,13 +267,13 @@ else {
case "mysql":
$sql = sprintf ('SELECT *
FROM tagente WHERE (1=1 %s) %s
ORDER BY %s %s LIMIT %d, %d', $search_sql, $sql_extra, $order['field'],
ORDER BY %s, %s %s LIMIT %d, %d', $search_sql, $sql_extra, $order['field'], $order['field2'],
$order['order'], $offset, $config["block_size"]);
break;
case "postgresql":
$sql = sprintf ('SELECT *
FROM tagente WHERE (1=1 %s) %s
ORDER BY %s %s LIMIT %d OFFSET %d', $search_sql, $sql_extra, $order['field'],
ORDER BY %s, %s %s LIMIT %d OFFSET %d', $search_sql, $sql_extra, $order['field'], $order['field2'],
$order['order'], $config["block_size"], $offset);
break;
case "oracle":
@ -282,7 +282,7 @@ else {
$set['offset'] = $offset;
$sql = sprintf ('SELECT *
FROM tagente WHERE (1=1 %s) %s
ORDER BY %s %s', $search_sql, $sql_extra, $order['field'], $order['order']);
ORDER BY %s, %s %s', $search_sql, $sql_extra, $order['field'], $order['field2'], $order['order']);
$sql = oracle_recode_query ($sql, $set);
break;
}
@ -303,18 +303,18 @@ else {
FROM tagente
WHERE (id_grupo IN (%s)
%s) %s
ORDER BY %s %s LIMIT %d, %d',
ORDER BY %s, %s %s LIMIT %d, %d',
implode (',', array_keys (users_get_groups ())),
$search_sql, $sql_extra, $order['field'], $order['order'], $offset, $config["block_size"]);
$search_sql, $sql_extra, $order['field'], $order['field2'], $order['order'], $offset, $config["block_size"]);
break;
case "postgresql":
$sql = sprintf ('SELECT *
FROM tagente
WHERE (id_grupo IN (%s)
%s) %s
ORDER BY %s %s LIMIT %d OFFSET %d',
ORDER BY %s, %s %s LIMIT %d OFFSET %d',
implode (',', array_keys (users_get_groups ())),
$search_sql, $sql_extra, $order['field'], $order['order'], $config["block_size"], $offset);
$search_sql, $sql_extra, $order['field'], $order['field2'], $order['order'], $config["block_size"], $offset);
break;
case "oracle":
$set = array ();
@ -324,9 +324,9 @@ else {
FROM tagente
WHERE (id_grupo IN (%s)
%s) %s
ORDER BY %s %s',
ORDER BY %s, %s %s',
implode (',', array_keys (users_get_groups ())),
$search_sql, $order['field'], $order['order']);
$search_sql, $order['field'], $order['field2'], $order['order']);
$sql = oracle_recode_query ($sql, $set);
break;
}

View File

@ -462,7 +462,11 @@ function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $o
if(!isset($order['order'])) {
$order['order'] = 'ASC';
}
$order = 'ORDER BY '.$order['field'] . ' ' . $order['order'];
if (!isset($order['field2'])) {
$order = 'ORDER BY '.$order['field'] . ' ' . $order['order'];
} else {
$order = 'ORDER BY '.$order['field'] . ', '. $order['field2'] . ' '. $order['order'];
}
}
$where = db_format_array_where_clause_sql ($filter, 'AND', '');

View File

@ -253,11 +253,11 @@ switch ($sortField) {
switch ($sort) {
case 'up':
$selectNameUp = $selected;
$order = array('field' => 'nombre', 'order' => 'ASC');
$order = array('field' => 'nombre COLLATE utf8_general_ci', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC');
break;
case 'down':
$selectNameDown = $selected;
$order = array('field' => 'nombre', 'order' => 'DESC');
$order = array('field' => 'nombre COLLATE utf8_general_ci', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'DESC');
break;
}
break;
@ -265,11 +265,11 @@ switch ($sortField) {
switch ($sort) {
case 'up':
$selectOsUp = $selected;
$order = array('field' => 'id_os', 'order' => 'ASC');
$order = array('field' => 'id_os', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC');
break;
case 'down':
$selectOsDown = $selected;
$order = array('field' => 'id_os', 'order' => 'DESC');
$order = array('field' => 'id_os', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'DESC');
break;
}
break;
@ -277,11 +277,11 @@ switch ($sortField) {
switch ($sort) {
case 'up':
$selectIntervalUp = $selected;
$order = array('field' => 'intervalo', 'order' => 'ASC');
$order = array('field' => 'intervalo', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC');
break;
case 'down':
$selectIntervalDown = $selected;
$order = array('field' => 'intervalo', 'order' => 'DESC');
$order = array('field' => 'intervalo', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'DESC');
break;
}
break;
@ -289,11 +289,11 @@ switch ($sortField) {
switch ($sort) {
case 'up':
$selectGroupUp = $selected;
$order = array('field' => 'id_grupo', 'order' => 'ASC');
$order = array('field' => 'id_grupo', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC');
break;
case 'down':
$selectGroupDown = $selected;
$order = array('field' => 'id_grupo', 'order' => 'DESC');
$order = array('field' => 'id_grupo', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'DESC');
break;
}
break;
@ -301,11 +301,11 @@ switch ($sortField) {
switch ($sort) {
case 'up':
$selectLastContactUp = $selected;
$order = array('field' => 'ultimo_contacto', 'order' => 'ASC');
$order = array('field' => 'ultimo_contacto', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC');
break;
case 'down':
$selectLastContactDown = $selected;
$order = array('field' => 'ultimo_contacto', 'order' => 'DESC');
$order = array('field' => 'ultimo_contacto', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'DESC');
break;
}
break;
@ -320,7 +320,7 @@ switch ($sortField) {
$selectGroupDown = '';
$selectLastContactUp = '';
$selectLastContactDown = '';
$order = array('field' => 'nombre', 'order' => 'ASC');
$order = array('field' => 'nombre COLLATE utf8_general_ci', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC');
break;
}
@ -354,7 +354,7 @@ $total_agents = agents_get_agents(array (
$total_agents = isset ($total_agents[0]['total']) ? $total_agents[0]['total'] : 0;
$agents = agents_get_agents(array (
'order' => 'nombre ASC',
'order' => 'nombre COLLATE utf8_general_ci ASC',
'id_grupo' => $groups,
'disabled' => 0,
'status' => $status,