fixed recursion option in custom report's item editor

This commit is contained in:
alejandro-campos 2018-08-28 16:38:32 +02:00
parent 75d3d38bec
commit 5f4d76f3a7
5 changed files with 28 additions and 2 deletions

View File

@ -0,0 +1 @@
ALTER TABLE treport_content ADD COLUMN `recursion` TINYINT(1) default NULL;

View File

@ -1337,6 +1337,7 @@ ALTER TABLE treport_content ADD COLUMN `lapse_calc` tinyint(1) default '0';
ALTER TABLE treport_content ADD COLUMN `lapse` int(11) default '300'; ALTER TABLE treport_content ADD COLUMN `lapse` int(11) default '300';
ALTER TABLE treport_content ADD COLUMN `visual_format` tinyint(1) default '0'; ALTER TABLE treport_content ADD COLUMN `visual_format` tinyint(1) default '0';
ALTER TABLE treport_content ADD COLUMN `hide_no_data` tinyint(1) default '0'; ALTER TABLE treport_content ADD COLUMN `hide_no_data` tinyint(1) default '0';
ALTER TABLE treport_content ADD COLUMN `recursion` tinyint(1) default NULL;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tmodule_relationship` -- Table `tmodule_relationship`

View File

@ -426,9 +426,12 @@ switch ($action) {
$description = $item['description']; $description = $item['description'];
$period = $item['period']; $period = $item['period'];
$group = $item['id_group']; $group = $item['id_group'];
$recursion = $item['recursion'];
break; break;
case 'event_report_agent': case 'event_report_agent':
case 'event_report_group': case 'event_report_group':
$recursion = $item['recursion'];
break;
case 'event_report_module': case 'event_report_module':
$description = $item['description']; $description = $item['description'];
$period = $item['period']; $period = $item['period'];
@ -477,12 +480,14 @@ switch ($action) {
case 'group_report': case 'group_report':
$description = $item['description']; $description = $item['description'];
$group = $item['id_group']; $group = $item['id_group'];
$recursion = $item['recursion'];
break; break;
case 'network_interfaces_report': case 'network_interfaces_report':
$description = $item['description']; $description = $item['description'];
$group = $item['id_group']; $group = $item['id_group'];
$period = $item['period']; $period = $item['period'];
$fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0; $fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0;
$recursion = $item['recursion'];
break; break;
case 'top_n': case 'top_n':
$description = $item['description']; $description = $item['description'];
@ -521,6 +526,7 @@ switch ($action) {
$es = json_decode($item['external_source'], true); $es = json_decode($item['external_source'], true);
$id_agents = $es['id_agents']; $id_agents = $es['id_agents'];
$selection_a_m = get_parameter('selection'); $selection_a_m = get_parameter('selection');
$recursion = $item['recursion'];
if ((count($es['module']) == 1) && ($es['module'][0] == 0)) { if ((count($es['module']) == 1) && ($es['module'][0] == 0)) {
$module = ""; $module = "";
@ -538,6 +544,7 @@ switch ($action) {
$date = $es['date']; $date = $es['date'];
$inventory_modules = $es['inventory_modules']; $inventory_modules = $es['inventory_modules'];
$id_agents = $es['id_agents']; $id_agents = $es['id_agents'];
$recursion = $item['recursion'];
$idAgent = $es['id_agents']; $idAgent = $es['id_agents'];
$idAgentModule = $inventory_modules; $idAgentModule = $inventory_modules;
@ -549,6 +556,7 @@ switch ($action) {
$es = json_decode($item['external_source'], true); $es = json_decode($item['external_source'], true);
$inventory_modules = $es['inventory_modules']; $inventory_modules = $es['inventory_modules'];
$id_agents = $es['id_agents']; $id_agents = $es['id_agents'];
$recursion = $item['recursion'];
break; break;
case 'agent_configuration': case 'agent_configuration':
@ -557,6 +565,7 @@ switch ($action) {
case 'group_configuration': case 'group_configuration':
$group = $item['id_group']; $group = $item['id_group'];
$recursion = $item['recursion'];
break; break;
case 'netflow_area': case 'netflow_area':
@ -609,6 +618,7 @@ switch ($action) {
break; break;
} }
$urlForm = $config['homeurl'] . $urlForm = $config['homeurl'] .
'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action=' . $actionParameter . '&id_report=' . $idReport; 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action=' . $actionParameter . '&id_report=' . $idReport;
@ -914,7 +924,7 @@ You can of course remove the warnings, that's why we include the source and do n
html_print_select_groups($config['id_user'], html_print_select_groups($config['id_user'],
"RM", true, 'combo_group', $group, ''); "RM", true, 'combo_group', $group, '');
echo "   ".__('Recursion').html_print_checkbox('recursion', 1, 0, true); echo "   ".__('Recursion').html_print_checkbox('recursion', 1, $recursion, true);
?> ?>
</td> </td>
@ -1760,6 +1770,9 @@ function print_SLA_list($width, $action, $idItem = null) {
$itemsSLA = db_get_all_rows_filter( $itemsSLA = db_get_all_rows_filter(
'treport_content_sla_combined', 'treport_content_sla_combined',
array('id_report_content' => $idItem)); array('id_report_content' => $idItem));
if ($itemsSLA === false) { if ($itemsSLA === false) {
$itemsSLA = array(); $itemsSLA = array();
} }
@ -1971,6 +1984,9 @@ function print_General_list($width, $action, $idItem = null, $type = 'general')
$itemsGeneral = db_get_all_rows_filter( $itemsGeneral = db_get_all_rows_filter(
'treport_content_item', 'treport_content_item',
array('id_report_content' => $idItem)); array('id_report_content' => $idItem));
if ($itemsGeneral === false) { if ($itemsGeneral === false) {
$itemsGeneral = array(); $itemsGeneral = array();
} }

View File

@ -940,17 +940,22 @@ switch ($action) {
$report = db_get_row_filter('treport', $report = db_get_row_filter('treport',
array('id_report' => $idReport)); array('id_report' => $idReport));
$reportName = $report['name']; $reportName = $report['name'];
$idGroupReport = $report['id_group']; $idGroupReport = $report['id_group'];
$description = $report['description']; $description = $report['description'];
$good_format = false; $good_format = false;
switch ($action) { switch ($action) {
case 'update': case 'update':
$values = array(); $values = array();
$values['id_report'] = $idReport; $values['id_report'] = $idReport; //---------------------------------------------------
//$values['name'] = (string) get_parameter('name'); //$values['name'] = (string) get_parameter('name');
$values['description'] = get_parameter('description'); $values['description'] = get_parameter('description');
$values['type'] = get_parameter('type', null); $values['type'] = get_parameter('type', null);
$values['recursion'] = get_parameter('recursion', null);
$label = get_parameter('label', ''); $label = get_parameter('label', '');
//Add macros name //Add macros name
@ -1290,6 +1295,7 @@ switch ($action) {
} }
break; break;
case 'save': case 'save':
$values = array(); $values = array();
$values['id_report'] = $idReport; $values['id_report'] = $idReport;
$values['type'] = get_parameter('type', null); $values['type'] = get_parameter('type', null);
@ -1303,6 +1309,7 @@ switch ($action) {
$items_label['id_agent'] = get_parameter('id_agent'); $items_label['id_agent'] = get_parameter('id_agent');
$items_label['id_agent_module'] = get_parameter('id_agent_module'); $items_label['id_agent_module'] = get_parameter('id_agent_module');
$name_it = (string) get_parameter('name'); $name_it = (string) get_parameter('name');
$values['recursion'] = get_parameter('recursion', null);
$values['name'] = reporting_label_macro($items_label, $name_it); $values['name'] = reporting_label_macro($items_label, $name_it);
// Support for projection graph, prediction date and SLA reports // Support for projection graph, prediction date and SLA reports

View File

@ -1289,6 +1289,7 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
`lapse` int(11) UNSIGNED NOT NULL default '300', `lapse` int(11) UNSIGNED NOT NULL default '300',
`visual_format` tinyint(1) UNSIGNED NOT NULL default '0', `visual_format` tinyint(1) UNSIGNED NOT NULL default '0',
`hide_no_data` tinyint(1) default 0, `hide_no_data` tinyint(1) default 0,
`recursion` tinyint(1) default NULL,
PRIMARY KEY(`id_rc`), PRIMARY KEY(`id_rc`),
FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`) FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`)
ON UPDATE CASCADE ON DELETE CASCADE ON UPDATE CASCADE ON DELETE CASCADE