2011-10-27 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* godmode/reporting/reporting_builder.item_editor.php: Added 1 week 
	interval for SLA reports.
	
	Fixes: #3426516
	
	* include/functions_forecast.php
	include/functions_reporting.php
	godmode/reporting/reporting_builder.php
	godmode/reporting/reporting_builder.item_editor.php: Changed 
	precission to float of max and min intervals on prediction date 
	report.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5086 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2011-10-27 11:27:49 +00:00
parent 576b6b8b43
commit a23663a781
5 changed files with 111 additions and 56 deletions

View File

@ -1,3 +1,17 @@
2011-10-27 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* godmode/reporting/reporting_builder.item_editor.php: Added 1 week
interval for SLA reports.
Fixes: #3426516
* include/functions_forecast.php
include/functions_reporting.php
godmode/reporting/reporting_builder.php
godmode/reporting/reporting_builder.item_editor.php: Changed
precission to float of max and min intervals on prediction date
report.
2011-10-27 Juan Manuel Ramon <juanmanuel.ramon@artica.es> 2011-10-27 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* godmode/agentes/agent_manager.php: Added confirmation at delete * godmode/agentes/agent_manager.php: Added confirmation at delete

View File

@ -56,8 +56,8 @@ $period_pg = 432000;
$projection_period = 432000; $projection_period = 432000;
$only_display_wrong = 0; $only_display_wrong = 0;
// Added support for prediction date report // Added support for prediction date report
$min_interval = 0; $min_interval = '0.00';
$max_interval = 0; $max_interval = '0.00';
$monday = true; $monday = true;
$tuesday = true; $tuesday = true;
$wednesday = true; $wednesday = true;
@ -123,8 +123,12 @@ switch ($action) {
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
// 'top_n' field will be reused for prediction_date report // 'top_n' field will be reused for prediction_date report
$max_interval = $item['top_n']; $max_interval = $item['top_n'];
// 'top_n_value' field will be reused for prediction_date report
$min_interval = $item['top_n_value']; $min_interval = $item['top_n_value'];
$intervals_text = $item['text'];
// Parse intervals text field
$max_interval = substr($intervals_text, 0, strpos($intervals_text, ';'));
$min_interval = substr($intervals_text, strpos($intervals_text, ';') + 1);
// 'top_n_value' field will be reused for prediction_date report
$period_pg = $item['period']; $period_pg = $item['period'];
break; break;
case 'custom_graph': case 'custom_graph':
@ -317,15 +321,14 @@ $intervals[300] = human_time_description_raw (300);
$intervals[600] = human_time_description_raw (600); $intervals[600] = human_time_description_raw (600);
$intervals[86400] = human_time_description_raw (86400); $intervals[86400] = human_time_description_raw (86400);
$intervals[432000] = human_time_description_raw (432000); $intervals[432000] = human_time_description_raw (432000);
$intervals[604800] = human_time_description_raw (604800);
$intervals[1296000] = human_time_description_raw (1296000); $intervals[1296000] = human_time_description_raw (1296000);
$intervals[2592000] = human_time_description_raw (2592000); $intervals[2592000] = human_time_description_raw (2592000);
// Intervals for projection graph // Intervals for projection graph
$intervals_1 = array (); $intervals_1 = array ();
/*$intervals_1[300] = human_time_description_raw (300);
$intervals_1[600] = human_time_description_raw (600);
$intervals_1[86400] = human_time_description_raw (86400);*/
$intervals_1[432000] = human_time_description_raw (432000); $intervals_1[432000] = human_time_description_raw (432000);
$intervals_1[604800] = human_time_description_raw (604800);
$intervals_1[1296000] = human_time_description_raw (1296000); $intervals_1[1296000] = human_time_description_raw (1296000);
$intervals_1[2592000] = human_time_description_raw (2592000); $intervals_1[2592000] = human_time_description_raw (2592000);
$intervals_1[5184000] = human_time_description_raw (5184000); $intervals_1[5184000] = human_time_description_raw (5184000);
@ -374,9 +377,9 @@ html_print_input_hidden('id_item', $idItem);
<td style="vertical-align: top;"><?php echo __('Data range') . ui_print_help_tip(__('Between this interval will be search the prediction date'), true); ?></td> <td style="vertical-align: top;"><?php echo __('Data range') . ui_print_help_tip(__('Between this interval will be search the prediction date'), true); ?></td>
<td><?php <td><?php
echo __('Max') . "&nbsp;"; echo __('Max') . "&nbsp;";
html_print_input_text('max_interval', $max_interval, '', 5, 5); html_print_input_text('max_interval', $max_interval, '', 5, 10);
echo "&nbsp;" . __('Min') . "&nbsp;"; echo "&nbsp;" . __('Min') . "&nbsp;";
html_print_input_text('min_interval', $min_interval, '', 5, 5); html_print_input_text('min_interval', $min_interval, '', 5, 10);
?></td> ?></td>
</tr> </tr>
<tr id="row_only_display_wrong" style="" class="datos"> <tr id="row_only_display_wrong" style="" class="datos">

View File

@ -184,6 +184,7 @@ switch ($action) {
$reportName = $report['name']; $reportName = $report['name'];
$idGroupReport = $report['id_group']; $idGroupReport = $report['id_group'];
$description = $report['description']; $description = $report['description'];
$good_format = false;
switch ($action) { switch ($action) {
case 'update': case 'update':
$values = array(); $values = array();
@ -191,22 +192,33 @@ switch ($action) {
$values['description'] = get_parameter('description'); $values['description'] = get_parameter('description');
$values['type'] = get_parameter('type', null); $values['type'] = get_parameter('type', null);
// Added support for projection graphs and prediction_date reports // Added support for projection graphs and prediction_date reports
// 'top_n_value' and 'top_n' fields will be reused for these types of report // 'top_n_value','top_n' and 'text' fields will be reused for these types of report
if ($values['type'] == 'projection_graph'){ if ($values['type'] == 'projection_graph'){
$values['period'] = get_parameter('period1'); $values['period'] = get_parameter('period1');
$values['top_n_value'] = get_parameter('period2'); $values['top_n_value'] = get_parameter('period2');
$values['text'] = get_parameter('text');
$good_format = true;
}else if($values['type'] == 'prediction_date'){ }else if($values['type'] == 'prediction_date'){
$values['period'] = get_parameter('period1'); $values['period'] = get_parameter('period1');
$values['top_n'] = get_parameter('max_interval'); $values['top_n'] = get_parameter('radiobutton_max_min_avg');
$values['top_n_value'] = get_parameter('min_interval'); $values['top_n_value'] = get_parameter('quantity');
$interval_max = get_parameter('max_interval');
$interval_min = get_parameter('min_interval');
// Checks intervals fields
if (preg_match('/^(\-)*[0-9]*\.?[0-9]+$/', $interval_max) and preg_match('/^(\-)*[0-9]*\.?[0-9]+$/', $interval_min)){
$good_format = true;
}
$intervals = get_parameter('max_interval') . ';' . get_parameter('min_interval');
$values['text'] = $intervals;
}else{ }else{
$values['period'] = get_parameter('period'); $values['period'] = get_parameter('period');
$values['top_n'] = get_parameter('radiobutton_max_min_avg'); $values['top_n'] = get_parameter('radiobutton_max_min_avg');
$values['top_n_value'] = get_parameter('quantity'); $values['top_n_value'] = get_parameter('quantity');
$values['text'] = get_parameter('text');
$good_format = true;
} }
$values['id_agent'] = get_parameter('id_agent'); $values['id_agent'] = get_parameter('id_agent');
$values['id_gs'] = get_parameter('id_custom_graph'); $values['id_gs'] = get_parameter('id_custom_graph');
$values['text'] = get_parameter('text');
$values['id_agent_module'] = get_parameter('id_agent_module'); $values['id_agent_module'] = get_parameter('id_agent_module');
$values['only_display_wrong'] = get_parameter('checkbox_only_display_wrong'); $values['only_display_wrong'] = get_parameter('checkbox_only_display_wrong');
$values['monday'] = get_parameter('monday', 0); $values['monday'] = get_parameter('monday', 0);
@ -264,7 +276,12 @@ switch ($action) {
$style['show_in_landscape'] = get_parameter('show_in_landscape', 0); $style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
$values['style'] = io_safe_input(json_encode($style)); $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;
}
break; break;
case 'save': case 'save':
$values = array(); $values = array();
@ -272,22 +289,33 @@ switch ($action) {
$values['type'] = get_parameter('type', null); $values['type'] = get_parameter('type', null);
$values['description'] = get_parameter('description'); $values['description'] = get_parameter('description');
// Support for projection graph and prediction_date reports // Support for projection graph and prediction_date reports
// 'top_n_value' and 'top_n' fields will be reused for these types of report // 'top_n_value', 'top_n' and 'text' fields will be reused for these types of report
if ($values['type'] == 'projection_graph'){ if ($values['type'] == 'projection_graph'){
$values['period'] = get_parameter('period1'); $values['period'] = get_parameter('period1');
$values['top_n_value'] = get_parameter('period2'); $values['top_n_value'] = get_parameter('period2');
$values['text'] = get_parameter('text');
$good_format = true;
}else if ($values['type'] == 'prediction_date'){ }else if ($values['type'] == 'prediction_date'){
$values['period'] = get_parameter('period1'); $values['period'] = get_parameter('period1');
$values['top_n'] = get_parameter('max_interval'); $values['top_n'] = get_parameter('radiobutton_max_min_avg');
$values['top_n_value'] = get_parameter('min_interval'); $values['top_n_value'] = get_parameter('quantity');
$interval_max = get_parameter('max_interval');
$interval_min = get_parameter('min_interval');
// Checks intervals fields
if (preg_match('/^(\-)*[0-9]*\.?[0-9]+$/', $interval_max) and preg_match('/^(\-)*[0-9]*\.?[0-9]+$/', $interval_min)){
$good_format = true;
}
$intervals = get_parameter('max_interval') . ';' . get_parameter('min_interval');
$values['text'] = $intervals;
}else{ }else{
$values['period'] = get_parameter('period'); $values['period'] = get_parameter('period');
$values['top_n'] = get_parameter('radiobutton_max_min_avg',0); $values['top_n'] = get_parameter('radiobutton_max_min_avg',0);
$values['top_n_value'] = get_parameter('quantity'); $values['top_n_value'] = get_parameter('quantity');
$values['text'] = get_parameter('text');
$good_format = true;
} }
$values['id_agent'] = get_parameter('id_agent'); $values['id_agent'] = get_parameter('id_agent');
$values['id_gs'] = get_parameter('id_custom_graph'); $values['id_gs'] = get_parameter('id_custom_graph');
$values['text'] = get_parameter('text');
$values['id_agent_module'] = get_parameter('id_agent_module'); $values['id_agent_module'] = get_parameter('id_agent_module');
switch ($config['dbtype']){ switch ($config['dbtype']){
case "mysql": case "mysql":
@ -368,6 +396,7 @@ switch ($action) {
$style['show_in_landscape'] = get_parameter('show_in_landscape', 0); $style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
$values['style'] = io_safe_input(json_encode($style)); $values['style'] = io_safe_input(json_encode($style));
if ($good_format){
$result = db_process_sql_insert('treport_content', $values); $result = db_process_sql_insert('treport_content', $values);
if ($result === false) { if ($result === false) {
@ -402,11 +431,15 @@ switch ($action) {
db_process_sql_update('treport_content', array('"order"' => $max + 1), array('id_rc' => $idItem)); db_process_sql_update('treport_content', array('"order"' => $max + 1), array('id_rc' => $idItem));
break; break;
} }
$resultOperationDB = true; $resultOperationDB = true;
} }
break; break;
} }
// If fields dont have good format
else {
$resultOperationDB = false;
}
}
break; break;
default: default:
if ($enterpriseEnable) { if ($enterpriseEnable) {

View File

@ -174,6 +174,7 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
if ($current_ts - $last_timestamp >= 126144000){ if ($current_ts - $last_timestamp >= 126144000){
return false; return false;
} }
//html_debug_print(" Date " . $timestamp_f . " data: " . $output_data[$timestamp_f]);
// Found it // Found it
if ($max_value >= $output_data[$timestamp_f] and $min_value <= $output_data[$timestamp_f]){ if ($max_value >= $output_data[$timestamp_f] and $min_value <= $output_data[$timestamp_f]){
return $current_ts; return $current_ts;
@ -191,16 +192,17 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
* Return a date when the date interval is reached * Return a date when the date interval is reached
* *
* @param int Module id. * @param int Module id.
* @param int Given data period to make the prediction
* @param int Max value in the interval. * @param int Max value in the interval.
* @param int Min value in the interval. * @param int Min value in the interval.
* *
* @return mixed timestamp with the prediction date or false * @return mixed timestamp with the prediction date or false
*/ */
function forecast_prediction_date ($module_id, $max_value = 0, $min_value = 0){ function forecast_prediction_date ($module_id, $period = 5184000, $max_value = 0, $min_value = 0){
// Checks interval // Checks interval
if ($min_value > $max_value){ if ($min_value > $max_value){
return false; return false;
} }
return forecast_projection_graph($module_id, 5184000, false, $max_value, $min_value); return forecast_projection_graph($module_id, $period, false, $max_value, $min_value);
} }

View File

@ -2120,7 +2120,10 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$data = array (); $data = array ();
$table->colspan[2][0] = 3; $table->colspan[2][0] = 3;
$value = forecast_prediction_date ($content['id_agent_module'], $content['top_n'], $content['top_n_value']); $intervals_text = $content['text'];
$max_interval = substr($intervals_text, 0, strpos($intervals_text, ';'));
$min_interval = substr($intervals_text, strpos($intervals_text, ';') + 1);
$value = forecast_prediction_date ($content['id_agent_module'], $content['period'], $max_interval, $min_interval);
if ($value === false) { if ($value === false) {
$value = __('Unknown'); $value = __('Unknown');