mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Improvements on the oracle compatibitily
This commit is contained in:
parent
5751666f45
commit
bcfd0237bb
@ -598,12 +598,23 @@ if (isset( $_GET["fix_module"])) {
|
|||||||
$media = reporting_get_agentmodule_data_average ($id_module, 30758400); //Get average over the year
|
$media = reporting_get_agentmodule_data_average ($id_module, 30758400); //Get average over the year
|
||||||
$media *= 1.3;
|
$media *= 1.3;
|
||||||
$error = "";
|
$error = "";
|
||||||
|
$result = true;
|
||||||
|
|
||||||
//If the value of media is 0 or something went wrong, don't delete
|
//If the value of media is 0 or something went wrong, don't delete
|
||||||
if (!empty ($media)) {
|
if (!empty ($media)) {
|
||||||
$where = array(
|
$where = array(
|
||||||
'datos' => '>' . $media,
|
'datos' => '>' . $media,
|
||||||
'id_agente_modulo' => $id_module);
|
'id_agente_modulo' => $id_module);
|
||||||
db_process_sql_delete('tagente_datos', $where);
|
$res = db_process_sql_delete('tagente_datos', $where);
|
||||||
|
|
||||||
|
if ($res === false) {
|
||||||
|
$result = false;
|
||||||
|
$error = modules_get_agentmodule_name($id_module);
|
||||||
|
}
|
||||||
|
else if ($res <= 0) {
|
||||||
|
$result = false;
|
||||||
|
$error = " - " . __('No data to normalize');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$result = false;
|
$result = false;
|
||||||
@ -611,7 +622,7 @@ if (isset( $_GET["fix_module"])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ui_print_result_message ($result,
|
ui_print_result_message ($result,
|
||||||
__('Deleted data above %d', $media),
|
__('Deleted data above %f', $media),
|
||||||
__('Error normalizing module %s', $error));
|
__('Error normalizing module %s', $error));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ if ($multiple_delete) {
|
|||||||
if ($result === false)
|
if ($result === false)
|
||||||
$error++;
|
$error++;
|
||||||
$result = db_process_delete_temp('tagente_datos_inc',
|
$result = db_process_delete_temp('tagente_datos_inc',
|
||||||
'id_agente_modulo', $id_agent_module_del);
|
'id_agente_modulo', $id_agent_module_del);
|
||||||
if ($result === false)
|
if ($result === false)
|
||||||
$error++;
|
$error++;
|
||||||
break;
|
break;
|
||||||
|
@ -54,7 +54,20 @@ if ((isset ($_GET["operacion"])) && (!isset ($_POST["update_agent"]))) {
|
|||||||
// Copy
|
// Copy
|
||||||
foreach ($origen_modulo as $id_agentemodulo) {
|
foreach ($origen_modulo as $id_agentemodulo) {
|
||||||
echo "<br /><br />".__('Filtering data module')."<b> [".modules_get_agentmodule_name ($id_agentemodulo)."]</b>";
|
echo "<br /><br />".__('Filtering data module')."<b> [".modules_get_agentmodule_name ($id_agentemodulo)."]</b>";
|
||||||
$sql = sprintf ("DELETE FROM tagente_datos WHERE id_agente_modulo = %d AND (datos < '%s' OR datos > '%s')", $id_agentemodulo, $min, $max);
|
|
||||||
|
if ($config["dbtype"] == 'oracle') {
|
||||||
|
$sql = sprintf ("DELETE FROM tagente_datos
|
||||||
|
WHERE id_agente_modulo = %d
|
||||||
|
AND (datos < TO_BINARY_DOUBLE('%s')
|
||||||
|
OR datos > TO_BINARY_DOUBLE('%s'))", $id_agentemodulo, $min, $max);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$sql = sprintf ("DELETE FROM tagente_datos
|
||||||
|
WHERE id_agente_modulo = %d
|
||||||
|
AND (datos < '%s'
|
||||||
|
OR datos > '%s')", $id_agentemodulo, $min, $max);
|
||||||
|
}
|
||||||
|
|
||||||
db_process_sql ($sql);
|
db_process_sql ($sql);
|
||||||
}
|
}
|
||||||
} //if copy modules or alerts
|
} //if copy modules or alerts
|
||||||
|
Loading…
x
Reference in New Issue
Block a user