mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 01:05:39 +02:00
ITSM pandora_enterprise#11471
This commit is contained in:
parent
7f82273dc4
commit
dbf98689c2
@ -87,8 +87,6 @@ INSERT INTO `tmodule_inventory` (`id_module_inventory`, `id_os`, `name`, `descri
|
|||||||
|
|
||||||
ALTER TABLE `treport_content` ADD COLUMN `period_range` INT NULL DEFAULT 0 AFTER `period`;
|
ALTER TABLE `treport_content` ADD COLUMN `period_range` INT NULL DEFAULT 0 AFTER `period`;
|
||||||
|
|
||||||
ALTER TABLE `tusuario` MODIFY COLUMN `integria_user_level_pass` TEXT;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `tevent_comment` (
|
CREATE TABLE IF NOT EXISTS `tevent_comment` (
|
||||||
`id` serial PRIMARY KEY,
|
`id` serial PRIMARY KEY,
|
||||||
`id_event` BIGINT UNSIGNED NOT NULL,
|
`id_event` BIGINT UNSIGNED NOT NULL,
|
||||||
|
@ -1,19 +1,34 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Alerts commands.
|
||||||
|
*
|
||||||
|
* @category Alerts
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Opensource
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2023 Pandora FMS
|
||||||
|
* Please see https://pandorafms.com/community/ for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// Pandora FMS - https://pandorafms.com
|
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2023 Pandora FMS
|
|
||||||
// Please see https://pandorafms.com/community/ for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation for version 2.
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
// Load global vars.
|
|
||||||
use PandoraFMS\ITSM\ITSM;
|
use PandoraFMS\ITSM\ITSM;
|
||||||
|
|
||||||
|
// Load global vars.
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
require_once $config['homedir'].'/include/functions_alerts.php';
|
require_once $config['homedir'].'/include/functions_alerts.php';
|
||||||
@ -53,9 +68,9 @@ if (is_ajax()) {
|
|||||||
$get_recovery_fields = (int) get_parameter('get_recovery_fields', 1);
|
$get_recovery_fields = (int) get_parameter('get_recovery_fields', 1);
|
||||||
|
|
||||||
// Snmp alerts are not in the metaconsole so they cannot be centralized.
|
// Snmp alerts are not in the metaconsole so they cannot be centralized.
|
||||||
$is_management_allowed = false;
|
$management_is_not_allowed = false;
|
||||||
if ($get_recovery_fields !== 0) {
|
if ($get_recovery_fields !== 0) {
|
||||||
$is_management_allowed = !is_management_allowed();
|
$management_is_not_allowed = !is_management_allowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If command ID is not provided, check for action id.
|
// If command ID is not provided, check for action id.
|
||||||
@ -137,6 +152,17 @@ if (is_ajax()) {
|
|||||||
|
|
||||||
$style = ((int) $field_hidden === 1) ? '-webkit-text-security: disc; font-family: text-security-disc;' : '';
|
$style = ((int) $field_hidden === 1) ? '-webkit-text-security: disc; font-family: text-security-disc;' : '';
|
||||||
|
|
||||||
|
$recovery_disabled = 0;
|
||||||
|
if (empty($command) === false && $command['name'] === io_safe_input('Integria IMS Ticket')) {
|
||||||
|
if ($management_is_not_allowed == 0) {
|
||||||
|
if (preg_match('/^_html_editor_$/i', $field_value) || $field_description === 'Ticket status') {
|
||||||
|
$recovery_disabled = 0;
|
||||||
|
} else {
|
||||||
|
$recovery_disabled = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($field_value)) {
|
if (!empty($field_value)) {
|
||||||
$field_value = io_safe_output($field_value);
|
$field_value = io_safe_output($field_value);
|
||||||
// HTML type.
|
// HTML type.
|
||||||
@ -152,7 +178,7 @@ if (is_ajax()) {
|
|||||||
0,
|
0,
|
||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
$is_management_allowed,
|
$management_is_not_allowed,
|
||||||
"UndefineTinyMCE('#textarea_field".$i."_value')",
|
"UndefineTinyMCE('#textarea_field".$i."_value')",
|
||||||
'',
|
'',
|
||||||
true
|
true
|
||||||
@ -164,7 +190,7 @@ if (is_ajax()) {
|
|||||||
0,
|
0,
|
||||||
'',
|
'',
|
||||||
true,
|
true,
|
||||||
$is_management_allowed,
|
$management_is_not_allowed,
|
||||||
"defineTinyMCE('#textarea_field".$i."_value')",
|
"defineTinyMCE('#textarea_field".$i."_value')",
|
||||||
'',
|
'',
|
||||||
true
|
true
|
||||||
@ -179,7 +205,7 @@ if (is_ajax()) {
|
|||||||
'class="fields w100p"',
|
'class="fields w100p"',
|
||||||
true,
|
true,
|
||||||
'',
|
'',
|
||||||
$is_management_allowed
|
$management_is_not_allowed
|
||||||
);
|
);
|
||||||
|
|
||||||
$editor_type_chkbx = '<div id="command_div"><b><small>';
|
$editor_type_chkbx = '<div id="command_div"><b><small>';
|
||||||
@ -189,7 +215,7 @@ if (is_ajax()) {
|
|||||||
0,
|
0,
|
||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
$is_management_allowed,
|
$management_is_not_allowed,
|
||||||
"UndefineTinyMCE('#textarea_field".$i."_recovery_value')",
|
"UndefineTinyMCE('#textarea_field".$i."_recovery_value')",
|
||||||
'',
|
'',
|
||||||
true
|
true
|
||||||
@ -201,7 +227,7 @@ if (is_ajax()) {
|
|||||||
0,
|
0,
|
||||||
'',
|
'',
|
||||||
true,
|
true,
|
||||||
$is_management_allowed,
|
$management_is_not_allowed,
|
||||||
"defineTinyMCE('#textarea_field".$i."_recovery_value')",
|
"defineTinyMCE('#textarea_field".$i."_recovery_value')",
|
||||||
'',
|
'',
|
||||||
true
|
true
|
||||||
@ -216,7 +242,7 @@ if (is_ajax()) {
|
|||||||
'class="fields_recovery"',
|
'class="fields_recovery"',
|
||||||
true,
|
true,
|
||||||
'',
|
'',
|
||||||
$is_management_allowed
|
$management_is_not_allowed || $recovery_disabled
|
||||||
);
|
);
|
||||||
} else if (preg_match('/^_content_type_$/i', $field_value)) {
|
} else if (preg_match('/^_content_type_$/i', $field_value)) {
|
||||||
$editor_type_chkbx = '<div id="command_div"><b><small>';
|
$editor_type_chkbx = '<div id="command_div"><b><small>';
|
||||||
@ -230,7 +256,7 @@ if (is_ajax()) {
|
|||||||
'text/plain',
|
'text/plain',
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
$is_management_allowed,
|
$management_is_not_allowed,
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
true
|
true
|
||||||
@ -242,7 +268,7 @@ if (is_ajax()) {
|
|||||||
'text/html',
|
'text/html',
|
||||||
'',
|
'',
|
||||||
'text/html',
|
'text/html',
|
||||||
$is_management_allowed,
|
$management_is_not_allowed,
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
true
|
true
|
||||||
@ -261,7 +287,7 @@ if (is_ajax()) {
|
|||||||
'text/plain',
|
'text/plain',
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
$is_management_allowed,
|
$management_is_not_allowed,
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
true
|
true
|
||||||
@ -273,7 +299,7 @@ if (is_ajax()) {
|
|||||||
'text/html',
|
'text/html',
|
||||||
'',
|
'',
|
||||||
'text/html',
|
'text/html',
|
||||||
$is_management_allowed,
|
$management_is_not_allowed,
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
true
|
true
|
||||||
@ -282,95 +308,196 @@ if (is_ajax()) {
|
|||||||
$rfield = $editor_type_chkbx;
|
$rfield = $editor_type_chkbx;
|
||||||
// Select type.
|
// Select type.
|
||||||
} else if (preg_match('/^_custom_field_ITSM_$/i', $field_value)) {
|
} else if (preg_match('/^_custom_field_ITSM_$/i', $field_value)) {
|
||||||
$ffield = '';
|
$ffield = '';
|
||||||
$rfield = '';
|
$rfield = '';
|
||||||
|
|
||||||
$ffield .= '<div name="field'.$i.'_value_container">'.html_print_switch(
|
$ffield .= '<div name="field'.$i.'_value_container">'.html_print_switch(
|
||||||
[
|
[
|
||||||
'name' => 'field'.$i.'_value[]',
|
'name' => 'field'.$i.'_value[]',
|
||||||
'value' => '',
|
'value' => '',
|
||||||
]
|
]
|
||||||
).'</div>';
|
).'</div>';
|
||||||
$rfield .= '<div name="field'.$i.'_recovery_value_container">'.html_print_switch(
|
$rfield .= '<div name="field'.$i.'_recovery_value_container">'.html_print_switch(
|
||||||
[
|
[
|
||||||
'name' => 'field'.$i.'_recovery_value[]',
|
'name' => 'field'.$i.'_recovery_value[]',
|
||||||
'value' => '',
|
'value' => '',
|
||||||
]
|
'disabled' => $management_is_not_allowed || $recovery_disabled,
|
||||||
).'</div>';
|
]
|
||||||
|
).'</div>';
|
||||||
|
|
||||||
$ffield .= html_print_select(
|
$ffield .= html_print_select(
|
||||||
'',
|
'',
|
||||||
'field'.$i.'_value[]',
|
'field'.$i.'_value[]',
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
__('None'),
|
__('None'),
|
||||||
'',
|
'',
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
'fields',
|
'fields',
|
||||||
$is_management_allowed,
|
$management_is_not_allowed,
|
||||||
'width: 100%;',
|
'width: 100%;',
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
$rfield .= html_print_select(
|
$rfield .= html_print_select(
|
||||||
'',
|
'',
|
||||||
'field'.$i.'_recovery_value[]',
|
'field'.$i.'_recovery_value[]',
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
__('None'),
|
__('None'),
|
||||||
'',
|
'',
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
'fields',
|
'fields',
|
||||||
$is_management_allowed,
|
$management_is_not_allowed || $recovery_disabled,
|
||||||
'width: 100%;',
|
'width: 100%;',
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
$ffield .= html_print_input_text('field'.$i.'_value[]', '', '', 10, 10, true, false, false, '', 'datepicker');
|
$ffield .= html_print_input_text(
|
||||||
$rfield .= html_print_input_text('field'.$i.'_recovery_value[]', '', '', 10, 10, true, false, false, '', 'datepicker');
|
'field'.$i.'_value[]',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
10,
|
||||||
|
10,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'datepicker',
|
||||||
|
'',
|
||||||
|
'off',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
$management_is_not_allowed
|
||||||
|
);
|
||||||
|
$rfield .= html_print_input_text(
|
||||||
|
'field'.$i.'_recovery_value[]',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
10,
|
||||||
|
10,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'datepicker',
|
||||||
|
'',
|
||||||
|
'off',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
$management_is_not_allowed || $recovery_disabled
|
||||||
|
);
|
||||||
|
|
||||||
$ffield .= html_print_textarea(
|
$ffield .= html_print_textarea(
|
||||||
'field'.$i.'_value[]',
|
'field'.$i.'_value[]',
|
||||||
5,
|
5,
|
||||||
1,
|
1,
|
||||||
'',
|
'',
|
||||||
'style="min-height:40px; '.$style.'" class="fields"',
|
'style="min-height:40px; '.$style.'" class="fields"',
|
||||||
true,
|
true,
|
||||||
'',
|
'',
|
||||||
$is_management_allowed
|
$management_is_not_allowed
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$rfield .= html_print_textarea(
|
||||||
|
'field'.$i.'_recovery_value[]',
|
||||||
|
5,
|
||||||
|
1,
|
||||||
|
'',
|
||||||
|
'style="min-height:40px; '.$style.'" class="fields_recovery',
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
$management_is_not_allowed || $recovery_disabled
|
||||||
|
);
|
||||||
|
|
||||||
$rfield .= html_print_textarea(
|
$values_input_number = [
|
||||||
'field'.$i.'_recovery_value[]',
|
'name' => 'field'.$i.'_value[]',
|
||||||
5,
|
'value' => 0,
|
||||||
1,
|
'id' => 'field'.$i.'_value',
|
||||||
'',
|
'return' => true,
|
||||||
'style="min-height:40px; '.$style.'" class="fields_recovery',
|
];
|
||||||
true,
|
|
||||||
'',
|
if ($management_is_not_allowed === true) {
|
||||||
$is_management_allowed
|
$values_input_number['disabled'] = true;
|
||||||
);
|
}
|
||||||
|
|
||||||
|
$ffield .= html_print_input_number($values_input_number);
|
||||||
|
|
||||||
|
$values_input_number_recovery = [
|
||||||
|
'name' => 'field'.$i.'_recovery_value[]',
|
||||||
|
'value' => 0,
|
||||||
|
'id' => 'field'.$i.'_recovery_value',
|
||||||
|
'return' => true,
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($management_is_not_allowed || $recovery_disabled) {
|
||||||
|
$values_input_number_recovery['disabled'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rfield .= html_print_input_number($values_input_number_recovery);
|
||||||
|
|
||||||
|
$ffield .= html_print_input_text(
|
||||||
|
'field'.$i.'_value[]',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
50,
|
||||||
|
255,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'normal w98p',
|
||||||
|
'',
|
||||||
|
'off',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
$management_is_not_allowed
|
||||||
|
);
|
||||||
|
$rfield .= html_print_input_text(
|
||||||
|
'field'.$i.'_recovery_value[]',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
50,
|
||||||
|
255,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'normal w98p',
|
||||||
|
'',
|
||||||
|
'off',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
$management_is_not_allowed || $recovery_disabled
|
||||||
|
);
|
||||||
} else if (str_starts_with($field_value, '_ITSM_')) {
|
} else if (str_starts_with($field_value, '_ITSM_')) {
|
||||||
$nothing = '';
|
$nothing = '';
|
||||||
$nothing_value = 0;
|
$nothing_value = 0;
|
||||||
@ -441,7 +568,7 @@ if (is_ajax()) {
|
|||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
'fields',
|
'fields',
|
||||||
$is_management_allowed
|
$management_is_not_allowed
|
||||||
);
|
);
|
||||||
|
|
||||||
$rfield = html_print_select(
|
$rfield = html_print_select(
|
||||||
@ -455,11 +582,28 @@ if (is_ajax()) {
|
|||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
'fields_recovery',
|
'fields_recovery',
|
||||||
$is_management_allowed
|
$management_is_not_allowed || $recovery_disabled
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$ffield = 'TODO';
|
$ffield = html_print_autocomplete_users_from_pandora_itsm(
|
||||||
$rfield = 'TODO';
|
'field'.$i.'_value',
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
0,
|
||||||
|
$management_is_not_allowed,
|
||||||
|
false,
|
||||||
|
''
|
||||||
|
);
|
||||||
|
|
||||||
|
$rfield = html_print_autocomplete_users_from_pandora_itsm(
|
||||||
|
'field'.$i.'_recovery_value',
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
0,
|
||||||
|
$management_is_not_allowed || $recovery_disabled,
|
||||||
|
false,
|
||||||
|
''
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$fields_value_select = [];
|
$fields_value_select = [];
|
||||||
@ -578,7 +722,7 @@ if (is_ajax()) {
|
|||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
'fields',
|
'fields',
|
||||||
$is_management_allowed
|
$management_is_not_allowed
|
||||||
);
|
);
|
||||||
$rfield = html_print_select(
|
$rfield = html_print_select(
|
||||||
$fields_value_select,
|
$fields_value_select,
|
||||||
@ -591,7 +735,7 @@ if (is_ajax()) {
|
|||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
'fields_recovery',
|
'fields_recovery',
|
||||||
$is_management_allowed
|
$management_is_not_allowed || $recovery_disabled
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$ffield = html_print_textarea(
|
$ffield = html_print_textarea(
|
||||||
@ -602,7 +746,7 @@ if (is_ajax()) {
|
|||||||
'style="'.$style.'" class="fields min-height-40px w100p"',
|
'style="'.$style.'" class="fields min-height-40px w100p"',
|
||||||
true,
|
true,
|
||||||
'',
|
'',
|
||||||
$is_management_allowed
|
$management_is_not_allowed
|
||||||
);
|
);
|
||||||
$rfield = html_print_textarea(
|
$rfield = html_print_textarea(
|
||||||
'field'.$i.'_recovery_value',
|
'field'.$i.'_recovery_value',
|
||||||
@ -612,7 +756,7 @@ if (is_ajax()) {
|
|||||||
'style="'.$style.'" class="fields_recovery min-height-40px w100p',
|
'style="'.$style.'" class="fields_recovery min-height-40px w100p',
|
||||||
true,
|
true,
|
||||||
'',
|
'',
|
||||||
$is_management_allowed
|
$management_is_not_allowed || $recovery_disabled
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -625,7 +769,7 @@ if (is_ajax()) {
|
|||||||
'style="'.$style.'" class="fields min-height-40px w100p"',
|
'style="'.$style.'" class="fields min-height-40px w100p"',
|
||||||
true,
|
true,
|
||||||
'',
|
'',
|
||||||
$is_management_allowed
|
$management_is_not_allowed
|
||||||
);
|
);
|
||||||
$rfield = html_print_textarea(
|
$rfield = html_print_textarea(
|
||||||
'field'.$i.'_recovery_value',
|
'field'.$i.'_recovery_value',
|
||||||
@ -635,7 +779,7 @@ if (is_ajax()) {
|
|||||||
'style="'.$style.'" class="fields_recovery min-height-40px w100p"',
|
'style="'.$style.'" class="fields_recovery min-height-40px w100p"',
|
||||||
true,
|
true,
|
||||||
'',
|
'',
|
||||||
$is_management_allowed
|
$management_is_not_allowed || $recovery_disabled
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,8 +170,8 @@ if ($id) {
|
|||||||
$action['field3_recovery'] = ($action['field3'] ?? $config['default_criticity']);
|
$action['field3_recovery'] = ($action['field3'] ?? $config['default_criticity']);
|
||||||
$action['field4_recovery'] = ($action['field4'] ?? $config['default_owner']);
|
$action['field4_recovery'] = ($action['field4'] ?? $config['default_owner']);
|
||||||
$action['field5_recovery'] = ($action['field5'] ?? $config['incident_type']);
|
$action['field5_recovery'] = ($action['field5'] ?? $config['incident_type']);
|
||||||
$action['field6_recovery'] = ($action['field6'] ?? $config['incident_status']);
|
$action['field6_recovery'] = ($action['field6_recovery'] ?? $config['incident_status']);
|
||||||
$action['field7_recovery'] = ($action['field7'] ?? $config['incident_content']);
|
$action['field7_recovery'] = ($action['field7_recovery'] ?? $config['incident_content']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$group = $action['id_group'];
|
$group = $action['id_group'];
|
||||||
@ -378,24 +378,26 @@ $table_macros->data[1][2] = html_print_label_input_block(
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Selector will work only with Integria activated.
|
if (empty($command) === false && $command['name'] === io_safe_input('Integria IMS Ticket')) {
|
||||||
$integriaIdName = 'integria_wu';
|
// Selector will work only with Integria activated.
|
||||||
$table_macros->colspan[$integriaIdName][0] = 3;
|
$integriaIdName = 'integria_wu';
|
||||||
$table_macros->data[$integriaIdName][0] = html_print_label_input_block(
|
$table_macros->colspan[$integriaIdName][0] = 3;
|
||||||
__('Create workunit on recovery').ui_print_help_tip(
|
$table_macros->data[$integriaIdName][0] = html_print_label_input_block(
|
||||||
__('If closed status is set on recovery, a workunit will be added to the ticket in Integria IMS rather that closing the ticket.'),
|
__('Create workunit on recovery').ui_print_help_tip(
|
||||||
true
|
__('If closed status is set on recovery, a workunit will be added to the ticket in Integria IMS rather that closing the ticket.'),
|
||||||
),
|
true
|
||||||
html_print_checkbox_switch_extended(
|
),
|
||||||
'create_wu_integria',
|
html_print_checkbox_switch_extended(
|
||||||
1,
|
'create_wu_integria',
|
||||||
$create_wu_integria,
|
1,
|
||||||
false,
|
$create_wu_integria,
|
||||||
'',
|
false,
|
||||||
$disabled_attr,
|
'',
|
||||||
true
|
$disabled_attr,
|
||||||
)
|
true
|
||||||
);
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
||||||
$table_macros->data['field'.$i][0] = html_print_image(
|
$table_macros->data['field'.$i][0] = html_print_image(
|
||||||
@ -546,8 +548,8 @@ $(document).ready (function () {
|
|||||||
|
|
||||||
switch (custom_field.type) {
|
switch (custom_field.type) {
|
||||||
case 'CHECKBOX':
|
case 'CHECKBOX':
|
||||||
var checkbox_selector = $('input:not(.datepicker)[name=field'+custom_field_key+'_value\\[\\]]');
|
var checkbox_selector = $('input[type="checkbox"][name=field'+custom_field_key+'_value\\[\\]]');
|
||||||
var checkbox_recovery_selector = $('input:not(.datepicker)[name=field'+custom_field_key+'_recovery_value\\[\\]]');
|
var checkbox_recovery_selector = $('input[type="checkbox"][name=field'+custom_field_key+'_recovery_value\\[\\]]');
|
||||||
|
|
||||||
checkbox_selector.on('change', function() {
|
checkbox_selector.on('change', function() {
|
||||||
if (checkbox_selector.prop('checked')) {
|
if (checkbox_selector.prop('checked')) {
|
||||||
@ -587,8 +589,8 @@ $(document).ready (function () {
|
|||||||
|
|
||||||
$('[name=field'+custom_field_key+'_value_container]').show();
|
$('[name=field'+custom_field_key+'_value_container]').show();
|
||||||
$('[name=field'+custom_field_key+'_recovery_value_container]').show();
|
$('[name=field'+custom_field_key+'_recovery_value_container]').show();
|
||||||
$('input:not(.datepicker)[name=field'+custom_field_key+'_value\\[\\]]').show();
|
$('input[type="checkbox"][name=field'+custom_field_key+'_value\\[\\]]').show();
|
||||||
$('input:not(.datepicker)[name=field'+custom_field_key+'_recovery_value\\[\\]]').show();
|
$('input[type="checkbox"][name=field'+custom_field_key+'_recovery_value\\[\\]]').show();
|
||||||
break;
|
break;
|
||||||
case 'COMBO':
|
case 'COMBO':
|
||||||
var combo_input = $('select[name=field'+custom_field_key+'_value\\[\\]]');
|
var combo_input = $('select[name=field'+custom_field_key+'_value\\[\\]]');
|
||||||
@ -627,11 +629,10 @@ $(document).ready (function () {
|
|||||||
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').removeClass("hasDatepicker");
|
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').removeClass("hasDatepicker");
|
||||||
$('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').datepicker("destroy");
|
$('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').datepicker("destroy");
|
||||||
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').datepicker("destroy");
|
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').datepicker("destroy");
|
||||||
|
|
||||||
$('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').show();
|
$('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').show();
|
||||||
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').show();
|
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').show();
|
||||||
$('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
|
$('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').datepicker({dateFormat: "<?php echo 'yy-mm-dd 00:00:00'; ?>"});
|
||||||
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
|
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').datepicker({dateFormat: "<?php echo 'yy-mm-dd 00:00:00'; ?>"});
|
||||||
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
|
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
|
||||||
|
|
||||||
if (typeof values[key] !== "undefined") {
|
if (typeof values[key] !== "undefined") {
|
||||||
@ -642,9 +643,31 @@ $(document).ready (function () {
|
|||||||
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').val(recovery_values[key]);
|
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').val(recovery_values[key]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'TEXT':
|
|
||||||
case 'TEXTAREA':
|
|
||||||
case 'NUMERIC':
|
case 'NUMERIC':
|
||||||
|
if (typeof values[key] !== "undefined") {
|
||||||
|
$('input[type="number"][name=field'+custom_field_key+'_value\\[\\]]').val(values[key]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof recovery_values[key] !== "undefined") {
|
||||||
|
$('input[type="number"][name=field'+custom_field_key+'_recovery_value\\[\\]]').val(recovery_values[key]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$('input[type="number"][name=field'+custom_field_key+'_value\\[\\]]').show();
|
||||||
|
$('input[type="number"][name=field'+custom_field_key+'_recovery_value\\[\\]]').show();
|
||||||
|
break;
|
||||||
|
case 'TEXT':
|
||||||
|
if (typeof values[key] !== "undefined") {
|
||||||
|
$('input.normal[type="text"][name=field'+custom_field_key+'_value\\[\\]]').val(values[key]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof recovery_values[key] !== "undefined") {
|
||||||
|
$('input.normal[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').val(recovery_values[key]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$('input.normal[type="text"][name=field'+custom_field_key+'_value\\[\\]]').show();
|
||||||
|
$('input.normal[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').show();
|
||||||
|
break;
|
||||||
|
case 'TEXTAREA':
|
||||||
default:
|
default:
|
||||||
if (typeof values[key] !== "undefined") {
|
if (typeof values[key] !== "undefined") {
|
||||||
$('textarea[name=field'+custom_field_key+'_value\\[\\]]').val(values[key]);
|
$('textarea[name=field'+custom_field_key+'_value\\[\\]]').val(values[key]);
|
||||||
@ -695,13 +718,6 @@ $(document).ready (function () {
|
|||||||
} else {
|
} else {
|
||||||
render_command_description('');
|
render_command_description('');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow create workunit if Integria IMS Ticket is selected.
|
|
||||||
if (data['id'] == '14') {
|
|
||||||
$("#table_macros-"+integriaWorkUnitName).css('display', 'table-row');
|
|
||||||
} else {
|
|
||||||
$("#table_macros-"+integriaWorkUnitName).css('display', 'none');
|
|
||||||
}
|
|
||||||
|
|
||||||
var max_fields = parseInt('<?php echo $config['max_macro_fields']; ?>');
|
var max_fields = parseInt('<?php echo $config['max_macro_fields']; ?>');
|
||||||
|
|
||||||
@ -831,7 +847,6 @@ $(document).ready (function () {
|
|||||||
|
|
||||||
|
|
||||||
$("[name=field" + i + "_recovery_value]").val(old_recovery_value);
|
$("[name=field" + i + "_recovery_value]").val(old_recovery_value);
|
||||||
|
|
||||||
if (is_element_select === true) {
|
if (is_element_select === true) {
|
||||||
$("[name=field" + i + "_recovery_value]").trigger('change');
|
$("[name=field" + i + "_recovery_value]").trigger('change');
|
||||||
}
|
}
|
||||||
|
@ -2683,6 +2683,11 @@ function alerts_ui_update_or_create_actions($update=true)
|
|||||||
$values = [];
|
$values = [];
|
||||||
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
||||||
$field_value = get_parameter('field'.$i.'_value');
|
$field_value = get_parameter('field'.$i.'_value');
|
||||||
|
if (empty(get_parameter('field'.$i.'_value_hidden')) === false) {
|
||||||
|
$field_value = get_parameter('field'.$i.'_value_hidden');
|
||||||
|
} else {
|
||||||
|
$field_value = get_parameter('field'.$i.'_value');
|
||||||
|
}
|
||||||
|
|
||||||
if (is_array($field_value)) {
|
if (is_array($field_value)) {
|
||||||
$field_value = reset(array_filter($field_value));
|
$field_value = reset(array_filter($field_value));
|
||||||
@ -2695,7 +2700,11 @@ function alerts_ui_update_or_create_actions($update=true)
|
|||||||
$values['field'.$i] = (string) $field_value;
|
$values['field'.$i] = (string) $field_value;
|
||||||
$info_fields .= ' Field'.$i.': '.$values['field'.$i];
|
$info_fields .= ' Field'.$i.': '.$values['field'.$i];
|
||||||
|
|
||||||
$field_recovery_value = get_parameter('field'.$i.'_recovery_value');
|
if (empty(get_parameter('field'.$i.'_recovery_value_hidden')) === false) {
|
||||||
|
$field_recovery_value = get_parameter('field'.$i.'_recovery_value_hidden');
|
||||||
|
} else {
|
||||||
|
$field_recovery_value = get_parameter('field'.$i.'_recovery_value');
|
||||||
|
}
|
||||||
|
|
||||||
if (is_array($field_recovery_value)) {
|
if (is_array($field_recovery_value)) {
|
||||||
$field_recovery_value = reset(array_filter($field_recovery_value));
|
$field_recovery_value = reset(array_filter($field_recovery_value));
|
||||||
|
@ -4988,9 +4988,6 @@ function events_page_general($event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$data[1] = $user_ack.' ( ';
|
$data[1] = $user_ack.' ( ';
|
||||||
// hd($config['date_format'], true);
|
|
||||||
// hd($event['ack_utimestamp_raw'], true);
|
|
||||||
// TODO: mirar en el manage y en la api que este ack de venir vacio lo herede del anterior que hubiera.
|
|
||||||
if ($event['ack_utimestamp_raw'] !== false
|
if ($event['ack_utimestamp_raw'] !== false
|
||||||
&& $event['ack_utimestamp_raw'] !== 'false'
|
&& $event['ack_utimestamp_raw'] !== 'false'
|
||||||
&& empty($event['ack_utimestamp_raw']) === false
|
&& empty($event['ack_utimestamp_raw']) === false
|
||||||
|
@ -16,7 +16,7 @@ function getInputFieldsIncidenceType(idIncidenceType, fieldsData, ajaxUrl) {
|
|||||||
|
|
||||||
// Visual Console container request.
|
// Visual Console container request.
|
||||||
jQuery
|
jQuery
|
||||||
.get(
|
.post(
|
||||||
ajaxUrl,
|
ajaxUrl,
|
||||||
{
|
{
|
||||||
page: "operation/ITSM/itsm",
|
page: "operation/ITSM/itsm",
|
||||||
|
@ -255,16 +255,16 @@ class ITSM
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($queryParams) === false) {
|
if (empty($queryParams) === false) {
|
||||||
if (isset($queryParams['direction']) === true) {
|
|
||||||
$queryParams['sortDirection'] = $queryParams['direction'];
|
|
||||||
unset($queryParams['direction']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($queryParams['field']) === true) {
|
if (isset($queryParams['field']) === true) {
|
||||||
$queryParams['sortField'] = $queryParams['field'];
|
$queryParams['sortField'] = $queryParams['field'];
|
||||||
unset($queryParams['field']);
|
unset($queryParams['field']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($queryParams['direction']) === true) {
|
||||||
|
$queryParams['sortDirection'] = $queryParams['direction'];
|
||||||
|
unset($queryParams['direction']);
|
||||||
|
}
|
||||||
|
|
||||||
$path .= '?';
|
$path .= '?';
|
||||||
$path .= http_build_query($queryParams);
|
$path .= http_build_query($queryParams);
|
||||||
}
|
}
|
||||||
@ -369,8 +369,10 @@ class ITSM
|
|||||||
$result = $this->callApi(
|
$result = $this->callApi(
|
||||||
'incidenceTypeFields',
|
'incidenceTypeFields',
|
||||||
[
|
[
|
||||||
'page' => 0,
|
'page' => 0,
|
||||||
'sizePage' => 0,
|
'sizePage' => 0,
|
||||||
|
'field' => 'idIncidenceTypeField',
|
||||||
|
'direction' => 'ascending',
|
||||||
],
|
],
|
||||||
[],
|
[],
|
||||||
$idIncidenceType
|
$idIncidenceType
|
||||||
|
@ -527,8 +527,10 @@ class Manager
|
|||||||
$result = $ITSM->callApi(
|
$result = $ITSM->callApi(
|
||||||
'incidenceTypeFields',
|
'incidenceTypeFields',
|
||||||
[
|
[
|
||||||
'page' => 0,
|
'page' => 0,
|
||||||
'sizePage' => 0,
|
'sizePage' => 0,
|
||||||
|
'field' => 'idIncidenceTypeField',
|
||||||
|
'direction' => 'ascending',
|
||||||
],
|
],
|
||||||
[],
|
[],
|
||||||
$idIncidenceType
|
$idIncidenceType
|
||||||
@ -1125,7 +1127,7 @@ class Manager
|
|||||||
public function getInputFieldsIncidenceType()
|
public function getInputFieldsIncidenceType()
|
||||||
{
|
{
|
||||||
$idIncidenceType = (int) get_parameter('idIncidenceType', true);
|
$idIncidenceType = (int) get_parameter('idIncidenceType', true);
|
||||||
$fieldsData = json_decode(io_safe_output(get_parameter('fieldsData', [])), true);
|
$fieldsData = json_decode(base64_decode(get_parameter('fieldsData')), true);
|
||||||
if (empty($fieldsData) === false) {
|
if (empty($fieldsData) === false) {
|
||||||
$fieldsData = array_reduce(
|
$fieldsData = array_reduce(
|
||||||
$fieldsData,
|
$fieldsData,
|
||||||
|
@ -67,10 +67,12 @@ if (empty($customFields) === true) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'CHECKBOX':
|
case 'CHECKBOX':
|
||||||
|
$options['checked'] = ($fieldsData[$field['idIncidenceTypeField']] ?? null);
|
||||||
$options['type'] = 'checkbox';
|
$options['type'] = 'checkbox';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'DATE':
|
case 'DATE':
|
||||||
|
$options['value'] = ($fieldsData[$field['idIncidenceTypeField']] ?? null);
|
||||||
$options['type'] = 'text';
|
$options['type'] = 'text';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ ui_require_javascript_file('tinymce', 'vendor/tinymce/tinymce/');
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
var ajax_url = '<?php echo ui_get_full_url('ajax.php'); ?>';
|
var ajax_url = '<?php echo ui_get_full_url('ajax.php'); ?>';
|
||||||
var fieldsData = '<?php echo json_encode($incidence['typeFieldData']); ?>';
|
var fieldsData = '<?php echo base64_encode(json_encode($incidence['typeFieldData'])); ?>';
|
||||||
|
|
||||||
defineTinyMCE('#textarea_description');
|
defineTinyMCE('#textarea_description');
|
||||||
|
|
||||||
|
@ -263,7 +263,6 @@ our @EXPORT = qw(
|
|||||||
pandora_thread_monitoring
|
pandora_thread_monitoring
|
||||||
pandora_process_policy_queue
|
pandora_process_policy_queue
|
||||||
pandora_sync_agents_integria
|
pandora_sync_agents_integria
|
||||||
pandora_get_integria_ticket_types
|
|
||||||
subst_alert_macros
|
subst_alert_macros
|
||||||
subst_column_macros
|
subst_column_macros
|
||||||
locate_agent
|
locate_agent
|
||||||
@ -1841,16 +1840,14 @@ sub pandora_execute_action ($$$$$$$$$;$$) {
|
|||||||
|
|
||||||
# Integria IMS Ticket
|
# Integria IMS Ticket
|
||||||
} elsif ($clean_name eq "Integria IMS Ticket") {
|
} elsif ($clean_name eq "Integria IMS Ticket") {
|
||||||
my $config_integria_enabled = pandora_get_tconfig_token ($dbh, 'integria_enabled', '');
|
my $config_ITSM_enabled = pandora_get_tconfig_token ($dbh, 'ITSM_enabled', '');
|
||||||
|
if (!$config_ITSM_enabled) {
|
||||||
if (!$config_integria_enabled) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $config_api_path = pandora_get_tconfig_token ($dbh, 'integria_hostname', '');
|
my $ITSM_path = pandora_get_tconfig_token ($dbh, 'ITSM_hostname', '');
|
||||||
my $config_api_pass = pandora_get_tconfig_token ($dbh, 'integria_api_pass', '');
|
my $ITSM_token = pandora_get_tconfig_token ($dbh, 'ITSM_token', '');
|
||||||
my $config_integria_user = pandora_get_tconfig_token ($dbh, 'integria_user', '');
|
|
||||||
my $config_integria_user_pass = pandora_get_tconfig_token ($dbh, 'integria_pass', '');
|
|
||||||
$field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
$field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||||
$field2 = subst_alert_macros ($field2, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
$field2 = subst_alert_macros ($field2, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||||
$field3 = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
$field3 = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||||
@ -1871,18 +1868,6 @@ sub pandora_execute_action ($$$$$$$$$;$$) {
|
|||||||
$field18 = subst_alert_macros ($field18, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
$field18 = subst_alert_macros ($field18, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||||
$field19 = subst_alert_macros ($field19, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
$field19 = subst_alert_macros ($field19, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||||
$field20 = subst_alert_macros ($field20, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
$field20 = subst_alert_macros ($field20, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||||
|
|
||||||
# Field 1 (Integria IMS API path)
|
|
||||||
my $api_path = $config_api_path . "/include/api.php";
|
|
||||||
|
|
||||||
# Field 2 (Integria IMS API pass)
|
|
||||||
my $api_pass = $config_api_pass;
|
|
||||||
|
|
||||||
# Field 3 (Integria IMS user)
|
|
||||||
my $integria_user = $config_integria_user;
|
|
||||||
|
|
||||||
# Field 4 (Integria IMS user password)
|
|
||||||
my $integria_user_pass = $config_integria_user_pass;
|
|
||||||
|
|
||||||
# Field 1 (Ticket name)
|
# Field 1 (Ticket name)
|
||||||
my $ticket_name = safe_output($field1);
|
my $ticket_name = safe_output($field1);
|
||||||
@ -1893,7 +1878,7 @@ sub pandora_execute_action ($$$$$$$$$;$$) {
|
|||||||
# Field 2 (Ticket group ID)
|
# Field 2 (Ticket group ID)
|
||||||
my $ticket_group_id = $field2;
|
my $ticket_group_id = $field2;
|
||||||
if ($ticket_group_id eq '') {
|
if ($ticket_group_id eq '') {
|
||||||
$ticket_group_id = 0;
|
$ticket_group_id = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Field 3 (Ticket priority);
|
# Field 3 (Ticket priority);
|
||||||
@ -1921,31 +1906,192 @@ sub pandora_execute_action ($$$$$$$$$;$$) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Field 7 (Ticket description);
|
# Field 7 (Ticket description);
|
||||||
my $ticket_description = safe_output($field7);
|
my $ticket_description = subst_alert_macros(safe_output($field7), \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||||
|
|
||||||
my $create_wu_on_close_recovery = 0;
|
my $external_id = $agent->{'nombre'} . '-' . $module->{'id_agente'} . '-' . $module->{'id_agente_modulo'};
|
||||||
|
|
||||||
if ($alert_mode == RECOVERED_ALERT && $action->{'create_wu_integria'} == '1') {
|
# if recovered
|
||||||
$create_wu_on_close_recovery = 1;
|
if ($alert_mode == RECOVERED_ALERT) {
|
||||||
|
# Check exit incidence.
|
||||||
|
my %filter_incidence = ('externalId' => $external_id, 'blocked' => '0');
|
||||||
|
my $existIncidence = pandora_API_ITSM_call($pa_config, 'post', $ITSM_path . '/incidence/list', $ITSM_token, \%filter_incidence);
|
||||||
|
if (!defined($existIncidence)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $id_incidence = 0;
|
||||||
|
my $incidence_data = p_decode_json($pa_config, $existIncidence);
|
||||||
|
# If exist update state and add new workunit if necessary.
|
||||||
|
if(!is_empty($incidence_data->{'data'})) {
|
||||||
|
my %data_incidence = (
|
||||||
|
'status' => $ticket_status
|
||||||
|
);
|
||||||
|
|
||||||
|
$id_incidence = $incidence_data->{'data'}[0]->{'idIncidence'};
|
||||||
|
my $updateIncidence = pandora_API_ITSM_call($pa_config, 'put', $ITSM_path . '/incidence/' . $id_incidence, $ITSM_token, \%data_incidence);
|
||||||
|
if (!defined($updateIncidence)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($action->{'create_wu_integria'} == '1') {
|
||||||
|
my %data_workunit = (
|
||||||
|
'description' => $ticket_description
|
||||||
|
);
|
||||||
|
my $createWorkunit = pandora_API_ITSM_call($pa_config, 'post', $ITSM_path . '/incidence/' . $id_incidence . '/workunit', $ITSM_token, \%data_workunit);
|
||||||
|
if (!defined($createWorkunit)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Ticket type custom fields
|
# Ticket type custom fields
|
||||||
my $ticket_custom_field1 = $field8;
|
my %custom_fields = (
|
||||||
my $ticket_custom_field2 = $field9;
|
'field0' => subst_alert_macros(safe_output($field8), \%macros, $pa_config, $dbh, $agent, $module, $alert),
|
||||||
my $ticket_custom_field3 = $field10;
|
'field1' => subst_alert_macros(safe_output($field9), \%macros, $pa_config, $dbh, $agent, $module, $alert),
|
||||||
my $ticket_custom_field4 = $field11;
|
'field2' => subst_alert_macros(safe_output($field10), \%macros, $pa_config, $dbh, $agent, $module, $alert),
|
||||||
my $ticket_custom_field5 = $field12;
|
'field3' => subst_alert_macros(safe_output($field11), \%macros, $pa_config, $dbh, $agent, $module, $alert),
|
||||||
my $ticket_custom_field6 = $field13;
|
'field4' => subst_alert_macros(safe_output($field12), \%macros, $pa_config, $dbh, $agent, $module, $alert),
|
||||||
my $ticket_custom_field7 = $field14;
|
'field5' => subst_alert_macros(safe_output($field13), \%macros, $pa_config, $dbh, $agent, $module, $alert),
|
||||||
my $ticket_custom_field8 = $field15;
|
'field6' => subst_alert_macros(safe_output($field14), \%macros, $pa_config, $dbh, $agent, $module, $alert),
|
||||||
my $ticket_custom_field9 = $field16;
|
'field7' => subst_alert_macros(safe_output($field15), \%macros, $pa_config, $dbh, $agent, $module, $alert),
|
||||||
my $ticket_custom_field10 = $field17;
|
'field8' => subst_alert_macros(safe_output($field16), \%macros, $pa_config, $dbh, $agent, $module, $alert),
|
||||||
my $ticket_custom_field11 = $field18;
|
'field9' => subst_alert_macros(safe_output($field17), \%macros, $pa_config, $dbh, $agent, $module, $alert),
|
||||||
my $ticket_custom_field12 = $field19;
|
'field10' => subst_alert_macros(safe_output($field18), \%macros, $pa_config, $dbh, $agent, $module, $alert),
|
||||||
my $ticket_custom_field13 = $field20;
|
'field11' => subst_alert_macros(safe_output($field19), \%macros, $pa_config, $dbh, $agent, $module, $alert),
|
||||||
|
'field12' => subst_alert_macros(safe_output($field20), \%macros, $pa_config, $dbh, $agent, $module, $alert)
|
||||||
|
);
|
||||||
|
|
||||||
pandora_create_integria_ticket($pa_config, $api_path, $api_pass, $integria_user, $integria_user_pass, $agent->{'nombre'}, $agent->{'alias'}, $agent->{'id_os'}, $agent->{'direccion'}, $agent->{'id_agente'}, $agent->{'id_grupo'}, $ticket_name, $ticket_group_id, $ticket_priority, $ticket_owner, $ticket_type, $ticket_status, $ticket_description, $create_wu_on_close_recovery, $ticket_custom_field1, $ticket_custom_field2, $ticket_custom_field3, $ticket_custom_field4, $ticket_custom_field5, $ticket_custom_field6, $ticket_custom_field7, $ticket_custom_field8, $ticket_custom_field9, $ticket_custom_field10, $ticket_custom_field11, $ticket_custom_field12, $ticket_custom_field13);
|
# Check exit inventory object.
|
||||||
|
my %filter_inventory = ('idPandora' => $agent->{'nombre'});
|
||||||
|
my $existInventory = pandora_API_ITSM_call($pa_config, 'post', $ITSM_path . '/inventory/list', $ITSM_token, \%filter_inventory);
|
||||||
|
if (!defined($existInventory)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $id_inventory = 0;
|
||||||
|
my $inventory_data = p_decode_json($pa_config, $existInventory);
|
||||||
|
my %data_inventory = (
|
||||||
|
"name" => $agent->{'alias'},
|
||||||
|
"isPublic" => \0,
|
||||||
|
"idObjectType" => 2,
|
||||||
|
"isShowInList" => \0,
|
||||||
|
"status" => "new",
|
||||||
|
"idPandora" => $agent->{'nombre'},
|
||||||
|
"typeFieldData" => [
|
||||||
|
{
|
||||||
|
"idInventoryField" => 12,
|
||||||
|
"data" => $agent->{'id_os'}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idInventoryField" => 13,
|
||||||
|
"data" => $agent->{'direccion'}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idInventoryField" => 15,
|
||||||
|
"data" => $agent->{'id_agente'}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idInventoryField" => 46,
|
||||||
|
"data" => $agent->{'id_grupo'}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
# If not exit inventory object create, if exist update.
|
||||||
|
if(is_empty($inventory_data->{'data'})) {
|
||||||
|
my $insertInventory = pandora_API_ITSM_call($pa_config, 'post', $ITSM_path . '/inventory', $ITSM_token, \%data_inventory);
|
||||||
|
if (!defined($insertInventory)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
my $inventory = p_decode_json($pa_config, $insertInventory);
|
||||||
|
$id_inventory = $inventory->{'idInventory'};
|
||||||
|
} else {
|
||||||
|
$id_inventory = $inventory_data->{'data'}[0]->{'idInventory'};
|
||||||
|
my $updateInventory = pandora_API_ITSM_call($pa_config, 'put', $ITSM_path . '/inventory/' . $id_inventory, $ITSM_token, \%data_inventory);
|
||||||
|
if (!defined($updateInventory)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# List field incidence type.
|
||||||
|
my @fields = ();
|
||||||
|
if($ticket_type ne '' && $ticket_type ne '0') {
|
||||||
|
my %filter_incidence_type = ();
|
||||||
|
my $path_list_fields = $ITSM_path . '/incidencetype/' . $ticket_type . '/field/list?sortField=idIncidenceTypeField&sortDirection=ascending';
|
||||||
|
my $listFields = pandora_API_ITSM_call($pa_config, 'post', $path_list_fields, $ITSM_token, \%filter_incidence_type);
|
||||||
|
if (!defined($listFields)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $listFields_data = p_decode_json($pa_config, $listFields);
|
||||||
|
if(!is_empty($listFields_data->{'data'})) {
|
||||||
|
my $i = 0;
|
||||||
|
foreach my $field (@{$listFields_data->{'data'}}) {
|
||||||
|
$fields[$i] = {"idIncidenceTypeField" => $field->{'idIncidenceTypeField'}, "data" => $custom_fields{'field' . $i}};
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check exit incidence.
|
||||||
|
my %filter_incidence = ('externalId' => $external_id, 'blocked' => '0');
|
||||||
|
my $existIncidence = pandora_API_ITSM_call($pa_config, 'post', $ITSM_path . '/incidence/list', $ITSM_token, \%filter_incidence);
|
||||||
|
if (!defined($existIncidence)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $id_incidence = 0;
|
||||||
|
my $incidence_data = p_decode_json($pa_config, $existIncidence);
|
||||||
|
my %data_incidence = (
|
||||||
|
'title' => $ticket_name,
|
||||||
|
'idGroup' => $ticket_group_id,
|
||||||
|
'priority' => $ticket_priority,
|
||||||
|
'owner' => $ticket_owner,
|
||||||
|
'idIncidenceType' => $ticket_type,
|
||||||
|
'status' => $ticket_status,
|
||||||
|
'description' => $ticket_description,
|
||||||
|
'externalId' => $external_id,
|
||||||
|
'typeFieldData' => \@fields
|
||||||
|
);
|
||||||
|
|
||||||
|
# If not exit incidence create, if exist update and add new workunit.
|
||||||
|
if(is_empty($incidence_data->{'data'})) {
|
||||||
|
my $insertIncidence = pandora_API_ITSM_call($pa_config, 'post', $ITSM_path . '/incidence', $ITSM_token, \%data_incidence);
|
||||||
|
if (!defined($insertIncidence)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
my $incidence = p_decode_json($pa_config, $insertIncidence);
|
||||||
|
$id_incidence = $incidence->{'idIncidence'};
|
||||||
|
} else {
|
||||||
|
$id_incidence = $incidence_data->{'data'}[0]->{'idIncidence'};
|
||||||
|
my $updateIncidence = pandora_API_ITSM_call($pa_config, 'put', $ITSM_path . '/incidence/' . $id_incidence, $ITSM_token, \%data_incidence);
|
||||||
|
if (!defined($updateIncidence)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
my %data_workunit = (
|
||||||
|
'description' => 'Incidence updated by ' . $pa_config->{'rb_product_name'}
|
||||||
|
);
|
||||||
|
my $createWorkunit = pandora_API_ITSM_call($pa_config, 'post', $ITSM_path . '/incidence/' . $id_incidence . '/workunit', $ITSM_token, \%data_workunit);
|
||||||
|
if (!defined($createWorkunit)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check exit relation incidence whit inventory, if not exist create.
|
||||||
|
my %filter_incidence_inventory = ('idInventory' => $id_inventory);
|
||||||
|
my $existIncidenceInventory = pandora_API_ITSM_call($pa_config, 'post', $ITSM_path . '/incidence/' . $id_incidence . '/inventory/list', $ITSM_token, \%filter_incidence_inventory);
|
||||||
|
if (!defined($existIncidenceInventory)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
my $incidence_inventory_data = p_decode_json($pa_config, $existIncidenceInventory);
|
||||||
|
if(is_empty($incidence_inventory_data->{'data'})) {
|
||||||
|
my %data_incidence_inventory = ();
|
||||||
|
my $result_incidence_inventory = pandora_API_ITSM_call($pa_config, 'post', $ITSM_path . '/incidence/' . $id_incidence . '/inventory/' . $id_inventory, $ITSM_token, \%data_incidence_inventory);
|
||||||
|
if (!defined($result_incidence_inventory)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
# Generate notification
|
# Generate notification
|
||||||
} elsif ($clean_name eq "Generate Notification") {
|
} elsif ($clean_name eq "Generate Notification") {
|
||||||
|
|
||||||
@ -6955,89 +7101,33 @@ sub pandora_edit_custom_graph ($$$$$$$$$$$) {
|
|||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub pandora_create_integria_ticket ($$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$) {
|
sub pandora_API_ITSM_call ($$$$$) {
|
||||||
my ($pa_config,$api_path,$api_pass,$integria_user,$user_pass,$agent_name,$agent_alias,$agent_os,$agent_addr,$agent_id,$agent_group,$ticket_name,$ticket_group_id,$ticket_priority,$ticket_owner,$ticket_type,$ticket_status,$ticket_description, $create_wu_on_close_recovery, $ticket_custom_field1, $ticket_custom_field2, $ticket_custom_field3, $ticket_custom_field4, $ticket_custom_field5, $ticket_custom_field6, $ticket_custom_field7, $ticket_custom_field8, $ticket_custom_field9, $ticket_custom_field10, $ticket_custom_field11, $ticket_custom_field12, $ticket_custom_field13) = @_;
|
my ($pa_config, $method, $ITSM_path, $ITSM_token, $data) = @_;
|
||||||
|
my @headers = (
|
||||||
use URI::URL;
|
'accept' => 'application/json',
|
||||||
use URI::Escape;
|
'Content-Type' => 'application/json; charset=utf-8',
|
||||||
use HTML::Entities;
|
'Authorization' => 'Bearer ' . $ITSM_token,
|
||||||
|
);
|
||||||
my $data_ticket;
|
if($method =~/put/i) {
|
||||||
my $call_api;
|
return api_call($pa_config, $method, $ITSM_path, encode_utf8(p_encode_json($pa_config, $data)), @headers);
|
||||||
|
} else {
|
||||||
my $uri = URI->new($api_path);
|
return api_call($pa_config, $method, $ITSM_path, Content => encode_utf8(p_encode_json($pa_config, $data)), @headers);
|
||||||
|
|
||||||
if ($uri->scheme eq "") {
|
|
||||||
$api_path = "http://" . $api_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $ticket_create_wu = 0;
|
|
||||||
|
|
||||||
if ($create_wu_on_close_recovery == 1 && $ticket_status eq '7') {
|
|
||||||
$ticket_create_wu = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$data_ticket = $agent_name .
|
|
||||||
"|;|" . uri_escape(decode_entities($agent_alias)) .
|
|
||||||
"|;|" . $agent_os .
|
|
||||||
"|;|" . $agent_addr .
|
|
||||||
"|;|" . $agent_id .
|
|
||||||
"|;|" . $agent_group .
|
|
||||||
"|;|" . $ticket_name .
|
|
||||||
"|;|" . $ticket_group_id .
|
|
||||||
"|;|" . $ticket_priority .
|
|
||||||
"|;|" . $ticket_description .
|
|
||||||
"|;|" . $ticket_type .
|
|
||||||
"|;|" . $ticket_owner .
|
|
||||||
"|;|" . $ticket_status .
|
|
||||||
"|;|" . $ticket_create_wu .
|
|
||||||
"|;|" . $ticket_custom_field1 .
|
|
||||||
"|;|" . $ticket_custom_field2 .
|
|
||||||
"|;|" . $ticket_custom_field3 .
|
|
||||||
"|;|" . $ticket_custom_field4 .
|
|
||||||
"|;|" . $ticket_custom_field5 .
|
|
||||||
"|;|" . $ticket_custom_field6 .
|
|
||||||
"|;|" . $ticket_custom_field7 .
|
|
||||||
"|;|" . $ticket_custom_field8 .
|
|
||||||
"|;|" . $ticket_custom_field9 .
|
|
||||||
"|;|" . $ticket_custom_field10 .
|
|
||||||
"|;|" . $ticket_custom_field11 .
|
|
||||||
"|;|" . $ticket_custom_field12 .
|
|
||||||
"|;|" . $ticket_custom_field13;
|
|
||||||
|
|
||||||
$call_api = $api_path . '?' .
|
|
||||||
'user=' . $integria_user . '&' .
|
|
||||||
'user_pass=' . $user_pass . '&' .
|
|
||||||
'pass=' . $api_pass . '&' .
|
|
||||||
'op=create_pandora_ticket&' .
|
|
||||||
'params=' . $data_ticket .'&' .
|
|
||||||
'token=|;|';
|
|
||||||
|
|
||||||
my $content = get($call_api);
|
|
||||||
|
|
||||||
if (is_numeric($content) && $content ne "-1") {
|
|
||||||
return $content;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub pandora_sync_agents_integria ($) {
|
sub pandora_sync_agents_integria ($) {
|
||||||
my ($dbh) = @_;
|
my ($dbh) = @_;
|
||||||
|
|
||||||
my $config_integria_enabled = pandora_get_tconfig_token ($dbh, 'integria_enabled', '');
|
my $config_ITSM_enabled = pandora_get_tconfig_token ($dbh, 'ITSM_enabled', '');
|
||||||
|
|
||||||
if (!$config_integria_enabled) {
|
if (!$config_ITSM_enabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $config_api_path = pandora_get_tconfig_token ($dbh, 'integria_hostname', '');
|
my $config_api_path = pandora_get_tconfig_token ($dbh, 'ITSM_hostname', '');
|
||||||
my $config_api_pass = pandora_get_tconfig_token ($dbh, 'integria_api_pass', '');
|
my $config_integria_user_pass = pandora_get_tconfig_token ($dbh, 'ITSM_token', '');
|
||||||
my $config_integria_user = pandora_get_tconfig_token ($dbh, 'integria_user', '');
|
|
||||||
my $config_integria_user_pass = pandora_get_tconfig_token ($dbh, 'integria_pass', '');
|
|
||||||
|
|
||||||
my $api_path = $config_api_path . "/include/api.php";
|
my $api_path = $config_api_path;
|
||||||
|
|
||||||
my @agents_string = '';
|
my @agents_string = '';
|
||||||
my @agents = get_db_rows ($dbh, 'SELECT * FROM tagente');
|
my @agents = get_db_rows ($dbh, 'SELECT * FROM tagente');
|
||||||
@ -7059,9 +7149,7 @@ sub pandora_sync_agents_integria ($) {
|
|||||||
|
|
||||||
my $ua = LWP::UserAgent->new();
|
my $ua = LWP::UserAgent->new();
|
||||||
my $response = $ua->post( $api_path, {
|
my $response = $ua->post( $api_path, {
|
||||||
'user' => $config_integria_user,
|
|
||||||
'user_pass' => $config_integria_user_pass,
|
'user_pass' => $config_integria_user_pass,
|
||||||
'pass' => $config_api_pass,
|
|
||||||
'op' => 'sync_pandora_agents_inventory',
|
'op' => 'sync_pandora_agents_inventory',
|
||||||
'params[]' => [@agents_array],
|
'params[]' => [@agents_array],
|
||||||
'token' => '|;|'
|
'token' => '|;|'
|
||||||
@ -7077,32 +7165,6 @@ sub pandora_sync_agents_integria ($) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub pandora_get_integria_ticket_types($) {
|
|
||||||
my ($dbh) = @_;
|
|
||||||
|
|
||||||
my $config_api_path = pandora_get_tconfig_token ($dbh, 'integria_hostname', '');
|
|
||||||
my $config_api_pass = pandora_get_tconfig_token ($dbh, 'integria_api_pass', '');
|
|
||||||
my $config_integria_user = pandora_get_tconfig_token ($dbh, 'integria_user', '');
|
|
||||||
my $config_integria_user_pass = pandora_get_tconfig_token ($dbh, 'integria_pass', '');
|
|
||||||
|
|
||||||
my $api_path = $config_api_path . "/include/api.php";
|
|
||||||
|
|
||||||
my $call_api = $api_path . '?' .
|
|
||||||
'user=' . $config_integria_user . '&' .
|
|
||||||
'user_pass=' . $config_integria_user_pass . '&' .
|
|
||||||
'pass=' . $config_api_pass . '&' .
|
|
||||||
'op=get_types&' .
|
|
||||||
'return_type=json';
|
|
||||||
|
|
||||||
my $content = get($call_api);
|
|
||||||
|
|
||||||
my @decoded_json;
|
|
||||||
@decoded_json = @{decode_json($content)} if (defined $content && $content ne "");
|
|
||||||
|
|
||||||
return @decoded_json;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
=head2 C<< pandora_input_password (I<$pa_config>, I<$password>) >>
|
=head2 C<< pandora_input_password (I<$pa_config>, I<$password>) >>
|
||||||
|
|
||||||
|
@ -108,6 +108,7 @@ our @EXPORT = qw(
|
|||||||
MODULE_UNKNOWN
|
MODULE_UNKNOWN
|
||||||
MODULE_NOTINIT
|
MODULE_NOTINIT
|
||||||
$THRRUN
|
$THRRUN
|
||||||
|
api_call
|
||||||
api_call_url
|
api_call_url
|
||||||
cron_get_closest_in_range
|
cron_get_closest_in_range
|
||||||
cron_next_execution
|
cron_next_execution
|
||||||
@ -2323,6 +2324,51 @@ sub uri_encode_literal_percent {
|
|||||||
return $return_char;
|
return $return_char;
|
||||||
} ## end sub uri_encode_literal_percent
|
} ## end sub uri_encode_literal_percent
|
||||||
|
|
||||||
|
sub api_call {
|
||||||
|
my ($pa_config, $method, $server_url, $api_params, @options) = @_;
|
||||||
|
|
||||||
|
my $ua = LWP::UserAgent->new();
|
||||||
|
$ua->timeout($pa_config->{'tcp_timeout'});
|
||||||
|
# Enable environmental proxy settings
|
||||||
|
$ua->env_proxy;
|
||||||
|
# Enable in-memory cookie management
|
||||||
|
$ua->cookie_jar( {} );
|
||||||
|
|
||||||
|
# Disable verify host certificate (only needed for self-signed cert)
|
||||||
|
$ua->ssl_opts( 'verify_hostname' => 0 );
|
||||||
|
$ua->ssl_opts( 'SSL_verify_mode' => 0x00 );
|
||||||
|
|
||||||
|
my $response;
|
||||||
|
|
||||||
|
eval {
|
||||||
|
if ($method =~/get/i) {
|
||||||
|
$response = $ua->get($server_url, $api_params, @options);
|
||||||
|
} elsif ($method =~/put/i) {
|
||||||
|
my $req = HTTP::Request->new('PUT' => $server_url);
|
||||||
|
$req->header(@options);
|
||||||
|
$req->content($api_params);
|
||||||
|
$response = $ua->request($req);
|
||||||
|
} else {
|
||||||
|
$response = $ua->post($server_url, $api_params, @options);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if ((!$@) && $response->is_success) {
|
||||||
|
return $response->decoded_content;
|
||||||
|
}
|
||||||
|
|
||||||
|
# TODO: change to logger.
|
||||||
|
use Data::Dumper;
|
||||||
|
$Data::Dumper::SortKeys = 1;
|
||||||
|
print Dumper("------------------");
|
||||||
|
if ($@) { print Dumper($@); }
|
||||||
|
#print Dumper($response);
|
||||||
|
print Dumper($response->{'_rc'});
|
||||||
|
print Dumper($response->{'_content'});
|
||||||
|
print Dumper($response->{'_request'});
|
||||||
|
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Launch API call
|
# Launch API call
|
||||||
|
@ -1436,24 +1436,9 @@ if (defined($history_dbh)) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Keep integrity between PandoraFMS agents and IntegriaIMS inventory objects.
|
# Keep integrity between PandoraFMS agents and Pandora ITSM inventory objects.
|
||||||
pandora_sync_agents_integria($dbh);
|
pandora_sync_agents_integria($dbh);
|
||||||
|
|
||||||
# Get Integria IMS ticket types for alert commands.
|
|
||||||
my @types = pandora_get_integria_ticket_types($dbh);
|
|
||||||
|
|
||||||
if (scalar(@types) != 0) {
|
|
||||||
my $query_string = '';
|
|
||||||
foreach my $type (@types) {
|
|
||||||
$query_string .= $type->{'id'} . ',' . $type->{'name'} . ';';
|
|
||||||
}
|
|
||||||
|
|
||||||
$query_string = substr $query_string, 0, -1;
|
|
||||||
|
|
||||||
db_do($dbh, "UPDATE talert_commands SET fields_descriptions='[\"Ticket title\",\"Ticket group ID\",\"Ticket priority\",\"Ticket owner\",\"Ticket type\",\"Ticket status\",\"Ticket description\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\"]' WHERE name=\"Integria IMS Ticket\"");
|
|
||||||
db_do($dbh, "UPDATE talert_commands SET fields_values='[\"\", \"\", \"\",\"\",\"" . $query_string . "\",\"\",\"\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\"]' WHERE name=\"Integria IMS Ticket\"");
|
|
||||||
}
|
|
||||||
|
|
||||||
# Cleanup and exit
|
# Cleanup and exit
|
||||||
db_disconnect ($history_dbh) if defined ($history_dbh);
|
db_disconnect ($history_dbh) if defined ($history_dbh);
|
||||||
db_disconnect ($dbh);
|
db_disconnect ($dbh);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user