added new section in integria setup to configure different options for event responses and alert created tickets

This commit is contained in:
alejandro-campos 2019-09-26 13:22:10 +02:00
parent 0fdf3874d4
commit 96622933fc
7 changed files with 239 additions and 26 deletions

View File

@ -29,6 +29,14 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('incident_type', '');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('incident_status', '');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('incident_title', '');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('incident_content', '');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_default_group', '');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_default_criticity', '');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_default_creator', '');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_default_owner', '');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_type', '');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_status', '');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_title', '');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_content', '');
ALTER TABLE `treport_content` ADD COLUMN `uncompressed_module` TINYINT DEFAULT '0';
ALTER TABLE `treport_content_template` ADD COLUMN `uncompressed_module` TINYINT DEFAULT '0';

View File

@ -1272,6 +1272,14 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('incident_type', '');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('incident_status', '');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('incident_title', '');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('incident_content', '');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_default_group', '');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_default_criticity', '');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_default_creator', '');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_default_owner', '');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_type', '');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_status', '');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_title', '');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_content', '');
-- ---------------------------------------------------------------------
-- Table `tconfig_os`

View File

@ -244,15 +244,15 @@ $row['control'] = html_print_input_text('integria_req_timeout', $config['integri
$row['control'] .= ui_print_help_tip(__('Time in seconds to set the maximum time of the requests to the Integria API').'. '.__('0 to disable'), true);
$table_remote->data['integria_req_timeout'] = $row;
// Custom response settings.
$table_cr_settings = new StdClass();
$table_cr_settings->data = [];
$table_cr_settings->width = '100%';
$table_cr_settings->styleTable = 'margin-bottom: 10px;';
$table_cr_settings->id = 'integria-cr-settings-setup';
$table_cr_settings->class = 'databox filters';
$table_cr_settings->size['name'] = '30%';
$table_cr_settings->style['name'] = 'font-weight: bold';
// Alert settings.
$table_alert_settings = new StdClass();
$table_alert_settings->data = [];
$table_alert_settings->width = '100%';
$table_alert_settings->styleTable = 'margin-bottom: 10px;';
$table_alert_settings->id = 'integria-cr-settings-setup';
$table_alert_settings->class = 'databox filters';
$table_alert_settings->size['name'] = '30%';
$table_alert_settings->style['name'] = 'font-weight: bold';
// Custom response incident title.
$row = [];
@ -267,7 +267,7 @@ $row['control'] = html_print_input_text(
false,
false
).ui_print_help_icon('response_macros', true);
$table_cr_settings->data['custom_response_incident_title'] = $row;
$table_alert_settings->data['custom_response_incident_title'] = $row;
// Custom response incident description.
$row = [];
@ -282,7 +282,7 @@ $row['control'] = html_print_input_text(
false,
false
).ui_print_help_icon('response_macros', true);
$table_cr_settings->data['custom_response_incident_content'] = $row;
$table_alert_settings->data['custom_response_incident_content'] = $row;
// Custom response default group.
$row = [];
@ -300,7 +300,7 @@ $row['control'] = html_print_select(
'',
false
);
$table_cr_settings->data['custom_response_def_group'] = $row;
$table_alert_settings->data['custom_response_def_group'] = $row;
// Custom response default criticity.
$row = [];
@ -318,7 +318,7 @@ $row['control'] = html_print_select(
'',
false
);
$table_cr_settings->data['custom_response_def_criticity'] = $row;
$table_alert_settings->data['custom_response_def_criticity'] = $row;
// Custom response default owner.
$row = [];
@ -329,7 +329,7 @@ $row['control'] = html_print_autocomplete_users_from_integria(
true
);
$table_cr_settings->data['custom_response_def_owner'] = $row;
$table_alert_settings->data['custom_response_def_owner'] = $row;
// Custom response default incident type.
$row = [];
@ -347,7 +347,7 @@ $row['control'] = html_print_select(
'',
false
);
$table_cr_settings->data['custom_response_incident_type'] = $row;
$table_alert_settings->data['custom_response_incident_type'] = $row;
// Custom response default incident status.
$row = [];
@ -365,6 +365,129 @@ $row['control'] = html_print_select(
'',
false
);
$table_alert_settings->data['custom_response_incident_status'] = $row;
// Custom response settings.
$table_cr_settings = new StdClass();
$table_cr_settings->data = [];
$table_cr_settings->width = '100%';
$table_cr_settings->styleTable = 'margin-bottom: 10px;';
$table_cr_settings->id = 'integria-cr-settings-setup';
$table_cr_settings->class = 'databox filters';
$table_cr_settings->size['name'] = '30%';
$table_cr_settings->style['name'] = 'font-weight: bold';
// Custom response incident title.
$row = [];
$row['name'] = __('Title');
$row['control'] = html_print_input_text(
'cr_incident_title',
$config['cr_incident_title'],
__('Name'),
50,
100,
true,
false,
false
).ui_print_help_icon('response_macros', true);
$table_cr_settings->data['custom_response_incident_title'] = $row;
// Custom response incident description.
$row = [];
$row['name'] = __('Description');
$row['control'] = html_print_input_text(
'cr_incident_content',
$config['cr_incident_content'],
'',
50,
100,
true,
false,
false
).ui_print_help_icon('response_macros', true);
$table_cr_settings->data['custom_response_incident_content'] = $row;
// Custom response default group.
$row = [];
$row['name'] = __('Group');
$row['control'] = html_print_select(
$integria_group_values,
'cr_default_group',
$config['cr_default_group'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
);
$table_cr_settings->data['custom_response_def_group'] = $row;
// Custom response default criticity.
$row = [];
$row['name'] = __('Priority');
$row['control'] = html_print_select(
$integria_criticity_values,
'cr_default_criticity',
$config['cr_default_criticity'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
);
$table_cr_settings->data['custom_response_def_criticity'] = $row;
// Custom response default owner.
$row = [];
$row['name'] = __('Owner');
$row['control'] = html_print_autocomplete_users_from_integria(
'cr_default_owner',
$config['cr_default_owner'],
true
);
$table_cr_settings->data['custom_response_def_owner'] = $row;
// Custom response default incident type.
$row = [];
$row['name'] = __('Type');
$row['control'] = html_print_select(
$integria_types_values,
'cr_incident_type',
$config['cr_incident_type'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
);
$table_cr_settings->data['custom_response_incident_type'] = $row;
// Custom response default incident status.
$row = [];
$row['name'] = __('Status');
$row['control'] = html_print_select(
$integria_status_values,
'cr_incident_status',
$config['cr_incident_status'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
);
$table_cr_settings->data['custom_response_incident_status'] = $row;
// Test.
@ -410,10 +533,20 @@ echo '</fieldset>';
echo '</div>';
if ($has_connection != false) {
// Form custom response settings.
// Form alert default settings.
echo '<div id="form_alert_settings">';
echo '<fieldset>';
echo '<legend>'.__('Alert default values').'</legend>';
html_print_table($table_alert_settings);
echo '</fieldset>';
echo '</div>';
// Form custom response default settings.
echo '<div id="form_custom_response_settings">';
echo '<fieldset>';
echo '<legend>'.__('Ticket default values').'</legend>';
echo '<legend>'.__('Event custom response default values').'</legend>';
html_print_table($table_cr_settings);

View File

@ -1463,10 +1463,18 @@ function config_update_config()
$error_update[] = __('Integria default group');
}
if (!config_update_value('cr_default_group', (int) get_parameter('cr_default_group', $config['cr_default_group']))) {
$error_update[] = __('Integria custom response default group');
}
if (!config_update_value('default_criticity', (int) get_parameter('default_criticity', $config['default_criticity']))) {
$error_update[] = __('Integria default priority');
}
if (!config_update_value('cr_default_criticity', (int) get_parameter('cr_default_criticity', $config['cr_default_criticity']))) {
$error_update[] = __('Integria custom response default priority');
}
if (!config_update_value('default_creator', (string) get_parameter('default_creator', $config['default_creator']))) {
$error_update[] = __('Integria default creator');
}
@ -1475,21 +1483,41 @@ function config_update_config()
$error_update[] = __('Integria default owner');
}
if (!config_update_value('cr_default_owner', (string) get_parameter('cr_default_owner', $config['cr_default_owner']))) {
$error_update[] = __('Integria custom response default owner');
}
if (!config_update_value('incident_type', (int) get_parameter('incident_type', $config['incident_type']))) {
$error_update[] = __('Integria default ticket type');
}
if (!config_update_value('cr_incident_type', (int) get_parameter('cr_incident_type', $config['cr_incident_type']))) {
$error_update[] = __('Integria custom response default ticket type');
}
if (!config_update_value('incident_status', (int) get_parameter('incident_status', $config['incident_status']))) {
$error_update[] = __('Integria default ticket status');
}
if (!config_update_value('cr_incident_status', (int) get_parameter('cr_incident_status', $config['cr_incident_status']))) {
$error_update[] = __('Integria custom response default ticket status');
}
if (!config_update_value('incident_title', (string) get_parameter('incident_title', $config['incident_title']))) {
$error_update[] = __('Integria default ticket title');
}
if (!config_update_value('cr_incident_title', (string) get_parameter('cr_incident_title', $config['cr_incident_title']))) {
$error_update[] = __('Integria custom response default ticket title');
}
if (!config_update_value('incident_content', (string) get_parameter('incident_content', $config['incident_content']))) {
$error_update[] = __('Integria default ticket content');
}
if (!config_update_value('cr_incident_content', (string) get_parameter('cr_incident_content', $config['cr_incident_content']))) {
$error_update[] = __('Integria custom response default ticket content');
}
break;
default:

View File

@ -163,10 +163,38 @@ $table->colspan[3][0] = 3;
$help_macros = isset($_GET['from_event']) ? ui_print_help_icon('response_macros', true) : '';
if (isset($_GET['from_event'])) {
if ($update) {
$input_value_title = $incident_details[3];
$input_value_type = $incident_details[17];
$input_value_status = $incident_details[6];
$input_value_group = $incident_details[8];
$input_value_criticity = $incident_details[7];
$input_value_owner = $incident_details[5];
$input_value_content = $incident_details[4];
} else if (isset($_GET['from_event'])) {
$input_value_title = $config['cr_incident_title'];
$input_value_type = $config['cr_incident_type'];
$input_value_status = $config['cr_incident_status'];
$input_value_group = $config['cr_default_group'];
$input_value_criticity = $config['cr_default_criticity'];
$input_value_owner = $config['cr_default_owner'];
$input_value_content = $config['cr_incident_content'];
} else {
$input_value_title = '';
$input_value_type = '';
$input_value_status = '';
$input_value_group = '';
$input_value_criticity = '';
$input_value_owner = '';
$input_value_content = '';
}
}
$table->data[0][0] = '<div class="label_select"><p class="input_label">'.__('Title').':&nbsp'.$help_macros.'</p>';
$table->data[0][0] .= '<div class="label_select_parent">'.html_print_input_text(
'incident_title',
$update ? $incident_details[3] : $config['incident_title'],
$input_value_title,
__('Name'),
50,
100,
@ -183,7 +211,7 @@ $table->data[1][0] = '<div class="label_select"><p class="input_label">'.__('Typ
$table->data[1][0] .= '<div class="label_select_parent">'.html_print_select(
$integria_types_values,
'type',
$update ? $incident_details[17] : $config['incident_type'],
$input_value_type,
'',
__('Select'),
0,
@ -199,7 +227,7 @@ $table->data[2][0] = '<div class="label_select"><p class="input_label">'.__('Sta
$table->data[2][0] .= '<div class="label_select_parent">'.html_print_select(
$integria_status_values,
'status',
$update ? $incident_details[6] : $config['incident_status'],
$input_value_status,
'',
__('Select'),
1,
@ -215,7 +243,7 @@ $table->data[1][1] = '<div class="label_select"><p class="input_label">'.__('Gro
$table->data[1][1] .= '<div class="label_select_parent">'.html_print_select(
$integria_group_values,
'group',
$update ? $incident_details[8] : $config['default_group'],
$input_value_group,
'',
'',
0,
@ -245,7 +273,7 @@ $table->data[1][2] = '<div class="label_select"><p class="input_label">'.__('Pri
$table->data[1][2] .= '<div class="label_select_parent">'.html_print_select(
$integria_criticity_values,
'criticity',
$update ? $incident_details[7] : $config['default_criticity'],
$input_value_criticity,
'',
__('Select'),
0,
@ -261,7 +289,7 @@ $table->data[2][2] = '<div class="label_select"><p class="input_label">'.__('Own
$table->data[2][2] .= '<div class="label_select_parent">'.html_print_autocomplete_users_from_integria(
'owner',
$update ? $incident_details[5] : $config['default_owner'],
$input_value_owner,
true
).'</div>';
@ -270,7 +298,7 @@ $table->data[3][0] .= '<div class="label_select_parent">'.html_print_textarea(
'incident_content',
3,
20,
$update ? $incident_details[4] : $config['incident_content'],
$input_value_content,
'',
true
).'</div>';

View File

@ -130,7 +130,15 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('incident_type', ''),
('incident_status', ''),
('incident_title', ''),
('incident_content', '');
('incident_content', ''),
('cr_default_group', ''),
('cr_default_criticity', ''),
('cr_default_creator', ''),
('cr_default_owner', ''),
('cr_incident_type', ''),
('cr_incident_status', ''),
('cr_incident_title', ''),
('cr_incident_content', '');
UNLOCK TABLES;
--

View File

@ -1505,7 +1505,7 @@ sub pandora_execute_action ($$$$$$$$$;$) {
}
# Field 7 (Ticket description);
my $ticket_description = $field7;
my $ticket_description = safe_output($field7);
pandora_create_integria_ticket($pa_config, $api_path, $api_pass, $integria_user, $integria_user_pass, $ticket_name, $ticket_group_id, $ticket_priority, $ticket_owner, $ticket_type, $ticket_status, $ticket_description);