Fixed case sensitive error in oracle machines. Ticket #2783

This commit is contained in:
Arturo Gonzalez Diaz 2015-09-22 10:40:34 +02:00
parent dcacceed67
commit d208e06604
7 changed files with 110 additions and 47 deletions

View File

@ -171,9 +171,9 @@ if ($searchAgents) {
)
)
AND (
t1.nombre LIKE '%%" . $stringSearchSQL . "%%' OR
t2.nombre LIKE '%%" . $stringSearchSQL . "%%' OR
t1.direccion LIKE '%%" . $stringSearchSQL . "%%'
lower(t1.nombre) LIKE '%%" . strtolower($stringSearchSQL) . "%%' OR
lower(t2.nombre) LIKE '%%" . strtolower($stringSearchSQL) . "%%' OR
lower(t1.direccion) LIKE '%%" . strtolower($stringSearchSQL) . "%%'
)
";
break;

View File

@ -138,32 +138,32 @@ if($searchAlerts) {
case "postgresql":
case "oracle":
$whereAlerts = 'AND (
id_alert_template IN (SELECT id FROM talert_templates WHERE name LIKE \'%' . $stringSearchSQL . '%\') OR
id_alert_template IN (SELECT id FROM talert_templates WHERE upper(name) LIKE \'%' . strtolower($stringSearchSQL) . '%\') OR
id_alert_template IN (
SELECT id
FROM talert_templates
WHERE id_alert_action IN (
SELECT id
FROM talert_actions
WHERE name LIKE \'%' . $stringSearchSQL . '%\')) OR
WHERE upper(name) LIKE \'%' . strtolower($stringSearchSQL) . '%\')) OR
talert_template_modules.id IN (
SELECT id_alert_template_module
FROM talert_template_module_actions
WHERE id_alert_action IN (
SELECT id
FROM talert_actions
WHERE name LIKE \'%' . $stringSearchSQL . '%\')) OR
WHERE upper(name) LIKE \'%' . strtolower($stringSearchSQL) . '%\')) OR
id_agent_module IN (
SELECT id_agente_modulo
FROM tagente_modulo
WHERE nombre LIKE \'%' . $stringSearchSQL . '%\') OR
WHERE upper(nombre) LIKE \'%' . strtolower($stringSearchSQL) . '%\') OR
id_agent_module IN (
SELECT id_agente_modulo
FROM tagente_modulo
WHERE id_agente IN (
SELECT id_agente
FROM tagente
WHERE nombre LIKE \'%' . $stringSearchSQL . '%\' ' . $extra_sql . '))
WHERE upper(nombre) LIKE \'%' . strtolower($stringSearchSQL) . '%\' ' . $extra_sql . '))
)';
$agents = false;
break;

View File

@ -32,7 +32,7 @@ if ($searchGraphs) {
return;
$filter = array();
$filter[] = "(name LIKE '%$stringSearchSQL%' OR description LIKE '%$stringSearchSQL%')";
$filter[] = "(upper(name) LIKE '%" . strtolower($stringSearchSQL) . "%' OR upper(description) LIKE '%$" . strtolower($stringSearchSQL) . "%')";
$filter['id_graph'] = $usergraphs_id;
$columns = array('id_graph', 'name', 'description');

View File

@ -28,15 +28,29 @@ if ($searchMaps) {
if (empty($id_user_groups))
return;
$sql = "SELECT tl.id, tl.name, tl.id_group, COUNT(tld.id_layout) AS count
FROM tlayout tl
LEFT JOIN tlayout_data tld
ON tl.id = tld.id_layout
WHERE tl.name LIKE '%$stringSearchSQL%'
AND tl.id_group IN ($id_user_groups_str)
GROUP BY tl.id, tl.name, tl.id_group";
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
$sql = "SELECT tl.id, tl.name, tl.id_group, COUNT(tld.id_layout) AS count
FROM tlayout tl
LEFT JOIN tlayout_data tld
ON tl.id = tld.id_layout
WHERE tl.name LIKE '%$stringSearchSQL%'
AND tl.id_group IN ($id_user_groups_str)
GROUP BY tl.id, tl.name, tl.id_group";
break;
case "oracle":
$sql = "SELECT tl.id, tl.name, tl.id_group, COUNT(tld.id_layout) AS count
FROM tlayout tl
LEFT JOIN tlayout_data tld
ON tl.id = tld.id_layout
WHERE upper(tl.name) LIKE '%" . strtolower($stringSearchSQL) . "%'
AND tl.id_group IN ($id_user_groups_str)
GROUP BY tl.id, tl.name, tl.id_group";
break;
}
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":

View File

@ -175,8 +175,8 @@ if ($searchModules) {
)
)
) AND
(UPPER(t1.nombre) LIKE UPPER(\'%' . $stringSearchSQL . '%\') OR
t3.nombre LIKE \'%' . $stringSearchSQL . '%\')';
(UPPER(t1.nombre) LIKE (\'%' . strtolower($stringSearchSQL) . '%\') OR
upper(t3.nombre) LIKE \'%' . strtolower($stringSearchSQL) . '%\')';
break;
}

View File

@ -45,10 +45,21 @@ else {
$reports = false;
if($searchReports) {
$sql = "SELECT id_report, name, description
FROM treport
WHERE (name LIKE '%" . $stringSearchSQL . "%' OR description LIKE '%" . $stringSearchSQL . "%')".$reports_condition;
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
$sql = "SELECT id_report, name, description
FROM treport
WHERE (name LIKE '%" . $stringSearchSQL . "%' OR description LIKE '%" . $stringSearchSQL . "%')".$reports_condition;
break;
case "oracle":
$sql = "SELECT id_report, name, description
FROM treport
WHERE (upper(name) LIKE '%" . strtolower($stringSearchSQL) . "%' OR description LIKE '%" . strtolower($stringSearchSQL) . "%')".$reports_condition;
break;
}
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
@ -62,11 +73,21 @@ if($searchReports) {
$sql = oracle_recode_query ($sql, $set);
break;
}
$sql_count = "SELECT COUNT(id_report) AS count
FROM treport
WHERE (name LIKE '%" . $stringSearchSQL . "%' OR description LIKE '%" . $stringSearchSQL . "%')".$reports_condition;
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
$sql_count = "SELECT COUNT(id_report) AS count
FROM treport
WHERE (name LIKE '%" . $stringSearchSQL . "%' OR description LIKE '%" . $stringSearchSQL . "%')".$reports_condition;
break;
case "oracle":
$sql_count = "SELECT COUNT(id_report) AS count
FROM treport
WHERE (upper(name) LIKE '%" . strtolower($stringSearchSQL) . "%' OR upper(description) LIKE '%" . strtolower($stringSearchSQL) . "%')".$reports_condition;
break;
}
if($only_count) {
$totalReports = db_get_value_sql($sql_count);
}

View File

@ -123,15 +123,30 @@ switch ($sortField) {
}
if ($searchUsers) {
$sql = "SELECT id_user, fullname, firstname, lastname, middlename, email, last_connect, is_admin, comments FROM tusuario
WHERE fullname LIKE '%" . $stringSearchSQL . "%' OR
id_user LIKE '%" . $stringSearchSQL . "%' OR
firstname LIKE '%" . $stringSearchSQL . "%' OR
lastname LIKE '%" . $stringSearchSQL . "%' OR
middlename LIKE '%" . $stringSearchSQL . "%' OR
email LIKE '%" . $stringSearchSQL . "%'
ORDER BY " . $order['field'] . " " . $order['order'];
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
$sql = "SELECT id_user, fullname, firstname, lastname, middlename, email, last_connect, is_admin, comments FROM tusuario
WHERE fullname LIKE '%" . $stringSearchSQL . "%' OR
id_user LIKE '%" . $stringSearchSQL . "%' OR
firstname LIKE '%" . $stringSearchSQL . "%' OR
lastname LIKE '%" . $stringSearchSQL . "%' OR
middlename LIKE '%" . $stringSearchSQL . "%' OR
email LIKE '%" . $stringSearchSQL . "%'
ORDER BY " . $order['field'] . " " . $order['order'];
break;
case "oracle":
$sql = "SELECT id_user, fullname, firstname, lastname, middlename, email, last_connect, is_admin, comments FROM tusuario
WHERE upper(fullname) LIKE '%" . strtolower($stringSearchSQL) . "%' OR
upper(id_user) LIKE '%" . strtolower($stringSearchSQL) . "%' OR
upper(firstname) LIKE '%" . strtolower($stringSearchSQL) . "%' OR
upper(lastname) LIKE '%" . strtolower($stringSearchSQL) . "%' OR
upper(middlename) LIKE '%" . strtolower($stringSearchSQL) . "%' OR
upper(email) LIKE '%" . strtolower($stringSearchSQL) . "%'
ORDER BY " . $order['field'] . " " . $order['order'];
break;
}
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
@ -163,15 +178,28 @@ if ($searchUsers) {
if ($only_count) {
unset($users);
}
$sql = "SELECT COUNT(id_user) AS count FROM tusuario
WHERE id_user LIKE '%" . $stringSearchSQL . "%' OR
fullname LIKE '%" . $stringSearchSQL . "%' OR
firstname LIKE '%" . $stringSearchSQL . "%' OR
lastname LIKE '%" . $stringSearchSQL . "%' OR
middlename LIKE '%" . $stringSearchSQL . "%' OR
email LIKE '%" . $stringSearchSQL . "%'";
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
$sql = "SELECT COUNT(id_user) AS count FROM tusuario
WHERE id_user LIKE '%" . $stringSearchSQL . "%' OR
fullname LIKE '%" . $stringSearchSQL . "%' OR
firstname LIKE '%" . $stringSearchSQL . "%' OR
lastname LIKE '%" . $stringSearchSQL . "%' OR
middlename LIKE '%" . $stringSearchSQL . "%' OR
email LIKE '%" . $stringSearchSQL . "%'";
break;
case "oracle":
$sql = "SELECT COUNT(id_user) AS count FROM tusuario
WHERE upper(id_user) LIKE '%" . strtolower($stringSearchSQL) . "%' OR
upper(fullname) LIKE '%" . strtolower($stringSearchSQL) . "%' OR
upper(firstname) LIKE '%" . strtolower($stringSearchSQL) . "%' OR
upper(lastname) LIKE '%" . strtolower($stringSearchSQL) . "%' OR
upper(middlename) LIKE '%" . strtolower($stringSearchSQL) . "%' OR
upper(email LIKE) '%" . strtolower($stringSearchSQL) . "%'";
break;
}
$totalUsers = db_get_value_sql($sql);
}
else {