Fixes for the Oracl€.

This commit is contained in:
mdtrooper 2015-06-01 17:04:02 +02:00
parent 1e71fc56bd
commit f2539395c3
3 changed files with 42 additions and 10 deletions

View File

@ -1264,7 +1264,9 @@ function print_SLA_list($width, $action, $idItem = null) {
case 'update':
case 'edit':
echo '<tbody id="list_sla">';
$itemsSLA = db_get_all_rows_filter('treport_content_sla_combined', array('id_report_content' => $idItem));
$itemsSLA = db_get_all_rows_filter(
'treport_content_sla_combined',
array('id_report_content' => $idItem));
if ($itemsSLA === false) {
$itemsSLA = array();
}

View File

@ -26,6 +26,18 @@ if (! check_acl ($config['id_user'], 0, "RW")) {
include_once($config['homedir'] . "/include/functions_agents.php");
enterprise_include_once ('include/functions_metaconsole.php');
switch ($config['dbtype']) {
case "mysql":
case "postgresql":
$type_escaped = "type";
break;
case "oracle":
$type_escaped = db_encapsule_fields_with_same_name_to_instructions(
"type");
break;
}
if ($config ['metaconsole'] == 1 and defined('METACONSOLE')) {
$agents = array();
$agents = metaconsole_get_report_agents($idReport);
@ -105,15 +117,17 @@ else {
$modules[$row['id_agent_module']] = $row['nombre'];
}
// Filter report items created from metaconsole in normal console list and the opposite
if (defined('METACONSOLE') and $config['metaconsole'] == 1) {
$where_types = ' AND ((server_name IS NOT NULL AND length(server_name) != 0) OR type IN (\'general\',\'SLA\',\'exception\',\'top_n\'))';
$where_types = ' AND ((server_name IS NOT NULL AND length(server_name) != 0) OR ' . $type_escaped . ' IN (\'general\',\'SLA\',\'exception\',\'top_n\'))';
}
else
$where_types = ' AND ((server_name IS NULL OR length(server_name) = 0) OR type IN (\'general\',\'SLA\',\'exception\',\'top_n\'))';
$where_types = ' AND ((server_name IS NULL OR length(server_name) = 0) OR ' . $type_escaped . ' IN (\'general\',\'SLA\',\'exception\',\'top_n\'))';
$rows = db_get_all_rows_sql('
SELECT DISTINCT(type)
SELECT DISTINCT(' . $type_escaped . ')
FROM treport_content
WHERE id_report = ' . $idReport . $where_types);
if ($rows === false) {
@ -129,6 +143,8 @@ else {
}
}
$agentFilter = get_parameter('agent_filter', 0);
$moduleFilter = get_parameter('module_filter', 0);
$typeFilter = get_parameter('type_filter', 0);
@ -210,10 +226,10 @@ if ($moduleFilter != 0) {
// Filter report items created from metaconsole in normal console list and the opposite
if (defined('METACONSOLE') and $config['metaconsole'] == 1) {
$where .= ' AND ((server_name IS NOT NULL AND length(server_name) != 0) OR type IN (\'general\',\'SLA\',\'exception\',\'top_n\'))';
$where .= ' AND ((server_name IS NOT NULL AND length(server_name) != 0) OR ' . $type_escaped . ' IN (\'general\',\'SLA\',\'exception\',\'top_n\'))';
}
else
$where .= ' AND ((server_name IS NULL OR length(server_name) = 0) OR type IN (\'general\',\'SLA\',\'exception\',\'top_n\'))';
$where .= ' AND ((server_name IS NULL OR length(server_name) = 0) OR ' . $type_escaped . ' IN (\'general\',\'SLA\',\'exception\',\'top_n\'))';
switch ($config["dbtype"]) {
case "mysql":

View File

@ -512,7 +512,7 @@ switch ($action) {
$next++;
$table->head[$next] = __('Group');
$table->size[$next] = '15%';
$next++;
if(!defined('METACONSOLE'))
$table->head[$next] = '<span title="Operations">' .
@ -1062,7 +1062,10 @@ switch ($action) {
$values['style'] = io_safe_input(json_encode($style));
if ($good_format) {
$resultOperationDB = db_process_sql_update('treport_content', $values, array('id_rc' => $idItem));
$resultOperationDB = db_process_sql_update(
'treport_content',
$values,
array('id_rc' => $idItem));
}
else {
$resultOperationDB = false;
@ -1201,8 +1204,8 @@ switch ($action) {
$values['time_to'] = get_parameter('time_to');
break;
case "oracle":
$values['time_from'] = '#to_date(\'' . get_parameter('time_from') . '\',\'hh24:mi\')';
$values['time_to'] = '#to_date(\'' . get_parameter('time_to') . '\', \'hh24:mi\')';
$values['time_from'] = '#to_date(\'' . get_parameter('time_from') . '\',\'hh24:mi:ss\')';
$values['time_to'] = '#to_date(\'' . get_parameter('time_to') . '\', \'hh24:mi:ss\')';
break;
}
$values['group_by_agent'] = get_parameter ('checkbox_row_group_by_agent',0);
@ -1305,6 +1308,17 @@ switch ($action) {
$values['style'] = io_safe_input(json_encode($style));
if ($good_format) {
switch ($config["dbtype"]) {
case "oracle":
if (isset($values['type'])) {
$values[
db_encapsule_fields_with_same_name_to_instructions(
"type")] = $values['type'];
unset($values['type']);
}
break;
}
$result = db_process_sql_insert(
'treport_content', $values);