2012-09-19 Vanessa Gil <vanessa.gil@artica.es>
* gomode/netflow/nf_item_list.php godmode/netflow/nf_report_form.php godmode/netflow/nf_report_item.php: Fixed bug adding items to reports. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6987 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
9508511faf
commit
48030a8794
|
@ -1,3 +1,10 @@
|
|||
2012-09-19 Vanessa Gil <vanessa.gil@artica.es>
|
||||
|
||||
* gomode/netflow/nf_item_list.php
|
||||
godmode/netflow/nf_report_form.php
|
||||
godmode/netflow/nf_report_item.php: Fixed bug adding items
|
||||
to reports.
|
||||
|
||||
2012-09-19 Vanessa Gil <vanessa.gil@artica.es>
|
||||
|
||||
* include/functions_api.php: Added functions: event_info
|
||||
|
|
|
@ -31,6 +31,9 @@ if (! check_acl ($config["id_user"], 0, "IW")) {
|
|||
return;
|
||||
}
|
||||
|
||||
//id report
|
||||
$id = (int)get_parameter('id');
|
||||
|
||||
$buttons['report_list']['active'] = false;
|
||||
$buttons['report_list'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_report">'
|
||||
. html_print_image ("images/edit.png", true, array ("title" => __('Report list')))
|
||||
|
@ -52,8 +55,7 @@ ui_print_page_header (__('Report items'), "images/networkmap/so_cisco_new.png",
|
|||
$delete = (bool) get_parameter ('delete');
|
||||
$multiple_delete = (bool)get_parameter('multiple_delete', 0);
|
||||
$order = get_parameter('order');
|
||||
//id report
|
||||
$id = (int) get_parameter ('id');
|
||||
|
||||
//id item
|
||||
$id_rc = (int) get_parameter ('id_rc');
|
||||
|
||||
|
|
|
@ -30,10 +30,29 @@ if (! check_acl ($config["id_user"], 0, "IW")) {
|
|||
return;
|
||||
}
|
||||
|
||||
$id = (int)get_parameter('id');
|
||||
$result_ins = -1;
|
||||
$update = (string)get_parameter('update', 0);
|
||||
$create = (string)get_parameter('create', 0);
|
||||
|
||||
if ($create){
|
||||
$name = (string) get_parameter ('name');
|
||||
$group = (int) get_parameter ('id_group');
|
||||
$description = get_parameter('description','');
|
||||
|
||||
$values = array (
|
||||
'id_name' => $name,
|
||||
'id_group' => $group,
|
||||
'description' => $description,
|
||||
);
|
||||
|
||||
$result_ins = db_process_sql_insert('tnetflow_report', $values);
|
||||
|
||||
$id = $result_ins;
|
||||
|
||||
} else {
|
||||
$id = (int)get_parameter('id');
|
||||
}
|
||||
|
||||
$buttons['report_list']['active'] = false;
|
||||
$buttons['report_list'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_report">'
|
||||
. html_print_image ("images/edit.png", true, array ("title" => __('Report list')))
|
||||
|
@ -52,6 +71,14 @@ $buttons['edit_report']['text'] = '<a href="index.php?sec=netf&sec2=godmode/netf
|
|||
//Header
|
||||
ui_print_page_header (__('Netflow Report'), "images/networkmap/so_cisco_new.png", false, "", true, $buttons);
|
||||
|
||||
//Control error creating report
|
||||
if (($result_ins === false) && ($result_ins != -1)) {
|
||||
ui_print_error_message ('Error creating report');
|
||||
}
|
||||
else if (($result_ins != false) && ($result_ins != -1)){
|
||||
ui_print_success_message ('Report created successfully');
|
||||
}
|
||||
|
||||
if ($id) {
|
||||
$permission = netflow_check_report_group ($id, false);
|
||||
if (!$permission) { //no tiene permisos para acceder a un informe
|
||||
|
@ -94,26 +121,6 @@ if ($update) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($create){
|
||||
$name = (string) get_parameter ('name');
|
||||
$group = (int) get_parameter ('id_group');
|
||||
$description = get_parameter('description','');
|
||||
|
||||
$values = array (
|
||||
'id_name' => $name,
|
||||
'id_group' => $group,
|
||||
'description' => $description,
|
||||
);
|
||||
|
||||
$id = db_process_sql_insert('tnetflow_report', $values);
|
||||
if ($id === false) {
|
||||
ui_print_error_message ('Error creating report');
|
||||
}
|
||||
else {
|
||||
ui_print_success_message ('Report created successfully');
|
||||
}
|
||||
}
|
||||
|
||||
$table->width = '80%';
|
||||
$table->border = 0;
|
||||
$table->cellspacing = 3;
|
||||
|
|
|
@ -89,10 +89,10 @@ if ($update) {
|
|||
}
|
||||
|
||||
if ($create){
|
||||
$id_filter = get_parameter('id_filter');
|
||||
$id_filter = (int)get_parameter('id_filter', 0);
|
||||
$name_filter = db_get_value('id_name', 'tnetflow_filter', 'id_sg', $id_filter);
|
||||
$max_val = get_parameter('max','2');
|
||||
$show_graph = get_parameter('show_graph','');
|
||||
$max_val = (int)get_parameter('max',2);
|
||||
$show_graph = (string)get_parameter('show_graph','');
|
||||
|
||||
//insertion order
|
||||
$sql = "SELECT max(`order`) as max_order FROM tnetflow_report_content where id_report=$id";
|
||||
|
@ -114,7 +114,10 @@ if ($create){
|
|||
);
|
||||
$id_rc = db_process_sql_insert('tnetflow_report_content', $values);
|
||||
if ($id_rc === false) {
|
||||
echo '<h3 class="error">'.__ ('Error creating item').'</h3>';
|
||||
if ($id_filter == 0)
|
||||
echo '<h3 class="error">'.__ ('Error creating item. No filter.').'</h3>';
|
||||
else
|
||||
echo '<h3 class="error">'.__ ('Error creating item').'</h3>';
|
||||
}
|
||||
else {
|
||||
echo '<h3 class="suc">'.__ ('Item created successfully').'</h3>';
|
||||
|
|
Loading…
Reference in New Issue