ITSM pandora_enterprise#11471

This commit is contained in:
daniel 2023-07-21 14:23:42 +02:00
parent 3e2c2990df
commit 1bf7f1e36e
33 changed files with 408 additions and 777 deletions

View File

@ -38,4 +38,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 `tusuario` MODIFY COLUMN `integria_user_level_pass` TEXT;
COMMIT;

View File

@ -18,7 +18,7 @@ require_once 'include/functions_incidents.php';
check_login();
if (!$config['integria_enabled']) {
if (!$config['ITSM_enabled']) {
ui_print_error_message(__('In order to access ticket management system, integration with ITSM must be enabled and properly configured'));
return;
}
@ -55,8 +55,7 @@ $params = [
agents_get_name($id_agent),
];
$result = integria_api_call(null, null, null, null, 'get_incidents', $params, false, 'json', ',');
// $result = integria_api_call(null, null, null, null, 'get_incidents', $params, false, 'json', ',');
$result = json_decode($result, true);
if (empty($result) === true) {

View File

@ -606,7 +606,7 @@ if ($id_agente) {
}
// Incident tab.
if ((bool) $config['integria_enabled'] === true) {
if ((bool) $config['ITSM_enabled'] === true) {
$incidenttab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=incident&id_agente='.$id_agente,

View File

@ -12,6 +12,8 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars.
use PandoraFMS\ITSM\ITSM;
global $config;
require_once $config['homedir'].'/include/functions_alerts.php';
@ -279,7 +281,7 @@ if (is_ajax()) {
$editor_type_chkbx .= '</small></b></div>';
$rfield = $editor_type_chkbx;
// Select type.
} else if (preg_match('/^_integria_type_custom_field_$/i', $field_value)) {
} else if (preg_match('/^_custom_field_ITSM_$/i', $field_value)) {
$ffield = '';
$rfield = '';
@ -369,6 +371,96 @@ if (is_ajax()) {
'',
$is_management_allowed
);
} else if (str_starts_with($field_value, '_ITSM_')) {
$nothing = '';
$nothing_value = 0;
$mode = 'select';
switch ($field_value) {
case '_ITSM_groups_':
$fields_array = [];
try {
$ITSM = new ITSM();
$fields_array = $ITSM->getGroups();
} catch (\Throwable $th) {
$error = $th->getMessage();
$fields_array = [];
}
break;
case '_ITSM_priorities_':
$fields_array = [];
try {
$ITSM = new ITSM();
$fields_array = $ITSM->getPriorities();
} catch (\Throwable $th) {
$error = $th->getMessage();
$fields_array = [];
}
break;
case '_ITSM_types_':
$fields_array = [];
try {
$ITSM = new ITSM();
$fields_array = $ITSM->getObjectypes();
} catch (\Throwable $th) {
$error = $th->getMessage();
$fields_array = [];
}
$nothing = __('None');
$nothing_value = 0;
break;
case '_ITSM_status_':
$fields_array = [];
try {
$ITSM = new ITSM();
$fields_array = $ITSM->getStatus();
} catch (\Throwable $th) {
$error = $th->getMessage();
$fields_array = [];
}
break;
default:
// Nothing.
$mode = '';
break;
}
if ($mode === 'select') {
$ffield = html_print_select(
$fields_array,
'field'.$i.'_value',
'',
'',
$nothing,
$nothing_value,
true,
false,
false,
'fields',
$is_management_allowed
);
$rfield = html_print_select(
$fields_array,
'field'.$i.'_recovery_value',
'',
'',
$nothing,
$nothing_value,
true,
false,
false,
'fields_recovery',
$is_management_allowed
);
} else {
$ffield = 'TODO';
$rfield = 'TODO';
}
} else {
$fields_value_select = [];
$force_print_select = false;

View File

@ -105,7 +105,7 @@ $groups_user = users_get_groups($config['id_user']);
if (!empty($groups_user)) {
$groups = implode(',', array_keys($groups_user));
if ($config['integria_enabled'] == 0) {
if ($config['ITSM_enabled'] == 0) {
$integria_command = 'Integria&#x20;IMS&#x20;Ticket';
$sql = sprintf('SELECT taa.id, taa.name FROM talert_actions taa INNER JOIN talert_commands tac ON taa.id_alert_command = tac.id WHERE tac.name <> "%s" AND taa.id_group IN (%s)', $integria_command, $groups);
} else {

View File

@ -17,7 +17,6 @@ global $config;
require_once $config['homedir'].'/include/functions_alerts.php';
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions_integriaims.php';
enterprise_include_once('meta/include/functions_alerts_meta.php');
check_login();
@ -159,6 +158,21 @@ if ($id) {
$action = alerts_get_alert_action($id);
$name = $action['name'];
$id_command = $action['id_alert_command'];
$command = alerts_get_alert_command($id_command);
if (empty($command) === false && $command['name'] === io_safe_input('Integria IMS Ticket')) {
$action['field2'] = ($action['field2'] ?? $config['default_group']);
$action['field3'] = ($action['field3'] ?? $config['default_criticity']);
$action['field4'] = ($action['field4'] ?? $config['default_owner']);
$action['field5'] = ($action['field5'] ?? $config['incident_type']);
$action['field6'] = ($action['field6'] ?? $config['incident_status']);
$action['field7'] = ($action['field7'] ?? $config['incident_content']);
$action['field2_recovery'] = ($action['field2'] ?? $config['default_group']);
$action['field3_recovery'] = ($action['field3'] ?? $config['default_criticity']);
$action['field4_recovery'] = ($action['field4'] ?? $config['default_owner']);
$action['field5_recovery'] = ($action['field5'] ?? $config['incident_type']);
$action['field6_recovery'] = ($action['field6'] ?? $config['incident_status']);
$action['field7_recovery'] = ($action['field7'] ?? $config['incident_content']);
}
$group = $action['id_group'];
$action_threshold = $action['action_threshold'];
@ -248,7 +262,7 @@ $create_ticket_command_id = db_get_value('id', 'talert_commands', 'name', io_saf
$sql_exclude_command_id = '';
if (!is_metaconsole() && $config['integria_enabled'] == 0 && $create_ticket_command_id !== false) {
if (!is_metaconsole() && $config['ITSM_enabled'] == 0 && $create_ticket_command_id !== false) {
$sql_exclude_command_id = ' AND id <> '.$create_ticket_command_id;
}
@ -655,13 +669,20 @@ $(document).ready (function () {
// No se envia el valor del commando.
values.push({
name: "page",
value: "godmode/alerts/alert_commands"});
value: "godmode/alerts/alert_commands"
});
values.push({
name: "get_alert_command",
value: "1"});
value: "1"
});
values.push({
name: "id",
value: this.value});
value: this.value
});
values.push({
name: "id_action",
value: "<?php echo (int) $id; ?>"
});
jQuery.post (<?php echo "'".ui_get_full_url('ajax.php', false, false, false)."'"; ?>,
values,
@ -673,7 +694,6 @@ $(document).ready (function () {
render_command_description(command_description);
} else {
render_command_description('');
}
// Allow create workunit if Integria IMS Ticket is selected.
@ -708,13 +728,65 @@ $(document).ready (function () {
old_value = '';
old_recovery_value = '';
// Only keep the value if is provided from hidden (first time)
if (($("[name=field" + i + "_value]").attr('id'))
== ("hidden-field" + i + "_value")) {
if (($("[name=field" + i + "_value]").attr('id')) == ("hidden-field" + i + "_value")) {
old_value = $("[name=field" + i + "_value]").val();
disabled = $("[name=field" + i + "_value]").attr('disabled');
}
if ($("#id_command option:selected").text() === "Integria IMS Ticket" && (!old_value || !old_recovery_value) ) {
if (i === 2) {
if(!old_value) {
old_value = '<?php echo $config['default_group']; ?>';
}
if(!old_recovery_value) {
old_recovery_value = '<?php echo $config['default_group']; ?>';
}
} else if (i === 3) {
if(!old_value) {
old_value = '<?php echo $config['default_criticity']; ?>';
}
if(!old_recovery_value) {
old_recovery_value = '<?php echo $config['default_criticity']; ?>';
}
} else if (i === 4) {
if(!old_value) {
old_value = '<?php echo $config['default_owner']; ?>';
}
if(!old_recovery_value) {
old_recovery_value = '<?php echo $config['default_owner']; ?>';
}
} else if (i === 5) {
if(!old_value) {
old_value = '<?php echo $config['incident_type']; ?>';
}
if(!old_recovery_value) {
old_recovery_value = '<?php echo $config['incident_type']; ?>';
}
} else if (i === 6) {
if(!old_value) {
old_value = '<?php echo $config['incident_status']; ?>';
}
if(!old_recovery_value) {
old_recovery_value = '<?php echo $config['incident_status']; ?>';
}
} else if (i === 7) {
if(!old_value) {
old_value = '<?php echo $config['incident_content']; ?>';
}
if(!old_recovery_value) {
old_recovery_value = '<?php echo $config['incident_content']; ?>';
}
}
}
if (($("[name=field" + i + "_recovery_value]").attr('id'))
== ("hidden-field" + i + "_recovery_value")) {

View File

@ -392,8 +392,8 @@ if ($access_console_node === true) {
$sub2['godmode/setup/setup&section=ehorus']['text'] = __('eHorus');
$sub2['godmode/setup/setup&section=ehorus']['refr'] = 0;
$sub2['godmode/setup/setup&section=integria']['text'] = __('ITSM');
$sub2['godmode/setup/setup&section=integria']['refr'] = 0;
$sub2['godmode/setup/setup&section=ITSM']['text'] = __('ITSM');
$sub2['godmode/setup/setup&section=ITSM']['refr'] = 0;
enterprise_hook('module_library_submenu');

View File

@ -170,9 +170,9 @@ if (check_acl($config['id_user'], 0, 'AW')) {
}
}
$buttons['integria'] = [
$buttons['ITSM'] = [
'active' => false,
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=integria').'">'.html_print_image(
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=ITSM').'">'.html_print_image(
'images/integria.png',
true,
[
@ -303,10 +303,10 @@ switch ($section) {
$help_header = 'setup_ehorus_tab';
break;
case 'integria':
$buttons['integria']['active'] = true;
$subpage = __('Integria IMS');
$help_header = 'setup_integria_tab';
case 'ITSM':
$buttons['ITSM']['active'] = true;
$subpage = __('Pandora ITSM');
$help_header = 'setup_ITSM_tab';
break;
case 'module_library':
@ -442,8 +442,8 @@ switch ($section) {
include_once $config['homedir'].'/godmode/setup/setup_ehorus.php';
break;
case 'integria':
include_once $config['homedir'].'/godmode/setup/setup_integria.php';
case 'ITSM':
include_once $config['homedir'].'/godmode/setup/setup_ITSM.php';
break;
case 'gis':

View File

@ -1,6 +1,6 @@
<?php
/**
* Integria setup.
* ITSM setup.
*
* @category Setup
* @package Pandora FMS
@ -42,8 +42,6 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user
return;
}
require_once $config['homedir'].'/include/functions_integriaims.php';
$error = '';
$group_values = [];
$priority_values = [];
@ -61,7 +59,7 @@ try {
$has_connection = false;
}
if ($has_connection === false && $config['integria_enabled']) {
if ($has_connection === false && $config['ITSM_enabled']) {
ui_print_error_message(__('ITSM API is not reachable, %s', $error));
}
@ -78,7 +76,7 @@ if (get_parameter('update_config', 0) == 1) {
['name' => io_safe_input('Integria IMS Ticket')]
);
if ($config['integria_enabled'] == 1) {
if ($config['ITSM_enabled'] == 1) {
if ($event_response_exists === false) {
// Create 'Create incident in IntegriaIMS from event' event response only when user enables IntegriaIMS integration and it does not exist in database.
db_process_sql_insert(
@ -98,13 +96,6 @@ if (get_parameter('update_config', 0) == 1) {
);
}
$types_string = '';
if (empty($object_types_values) === false) {
foreach ($object_types_values as $id => $name) {
$types_string .= $id.','.$name.';';
}
}
if ($command_exists === false) {
// Create 'Integria IMS Ticket' command only when user enables IntegriaIMS integration and it does not exist in database.
$id_command_inserted = db_process_sql_insert(
@ -114,8 +105,8 @@ if (get_parameter('update_config', 0) == 1) {
'command' => io_safe_input('Internal type'),
'internal' => 1,
'description' => io_safe_input('Create a ticket in Integria IMS'),
'fields_descriptions' => '["'.io_safe_input('Ticket title').'","'.io_safe_input('Ticket group ID').'","'.io_safe_input('Ticket priority').'","'.io_safe_input('Ticket owner').'","'.io_safe_input('Ticket type').'","'.io_safe_input('Ticket status').'","'.io_safe_input('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_"]',
'fields_values' => '["", "", "","","'.$types_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_"]',
'fields_descriptions' => '["'.io_safe_input('Ticket title').'","'.io_safe_input('Ticket group ID').'","'.io_safe_input('Ticket priority').'","'.io_safe_input('Ticket owner').'","'.io_safe_input('Ticket type').'","'.io_safe_input('Ticket status').'","'.io_safe_input('Ticket description').'","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_"]',
'fields_values' => '["", "_ITSM_groups_", "_ITSM_priorities_","_ITSM_users_","_ITSM_types_","_ITSM_status_","_html_editor_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_"]',
]
);
@ -140,80 +131,6 @@ if (get_parameter('update_config', 0) == 1) {
];
alerts_create_alert_action(io_safe_input('Create Integria IMS ticket'), $id_command_inserted, $action_values);
} else {
// Update 'Integria IMS Ticket' command with ticket types retrieved from Integria IMS.
$sql_update_command_values = sprintf(
'
UPDATE talert_commands
SET fields_values = \'["","","","","%s","","","_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="%s"',
$types_string,
io_safe_input('Integria IMS Ticket')
);
db_process_sql($sql_update_command_values);
// Update those actions that make use of 'Integria IMS Ticket' command when setup default fields are updated. Empty fields in actions will be filled in with default values.
$update_action_values = [
$config['incident_title'],
$config['default_group'],
$config['default_criticity'],
$config['default_owner'],
$config['incident_type'],
$config['incident_status'],
$config['incident_content'],
];
foreach ($update_action_values as $key => $value) {
$field_key = ($key + 1);
$sql_update_action_field = sprintf(
'
UPDATE talert_actions taa
INNER JOIN talert_commands tac
ON taa.id_alert_command=tac.id
SET field%s= "%s"
WHERE tac.name="Integria&#x20;IMS&#x20;Ticket"
AND (
taa.field%s IS NULL OR taa.field%s=""
)',
$field_key,
$value,
$field_key,
$field_key,
$field_key
);
db_process_sql($sql_update_action_field);
}
foreach ($update_action_values as $key => $value) {
$field_key = ($key + 1);
$sql_update_action_recovery_field = sprintf(
'
UPDATE talert_actions taa
INNER JOIN talert_commands tac
ON taa.id_alert_command=tac.id
SET field%s_recovery = "%s"
WHERE tac.name="Integria&#x20;IMS&#x20;Ticket"
AND (
taa.field%s_recovery IS NULL OR taa.field%s_recovery=""
)',
$field_key,
$value,
$field_key,
$field_key,
$field_key
);
db_process_sql($sql_update_action_recovery_field);
}
}
} else {
if ($event_response_exists !== false) {
// Delete 'Create incident in IntegriaIMS from event' event response if it does exist and IntegriaIMS integration is disabled.
db_process_sql_delete('tevent_response', ['name' => io_safe_input('Create ticket in IntegriaIMS from event')]);
}
}
}
@ -221,119 +138,70 @@ if (get_parameter('update_config', 0) == 1) {
$table_enable = new StdClass();
$table_enable->data = [];
$table_enable->width = '100%';
$table_enable->id = 'integria-enable-setup';
$table_enable->id = 'itsm-enable-setup';
$table_enable->class = 'databox filters';
$table_enable->size['name'] = '30%';
$table_enable->style['name'] = 'font-weight: bold';
// Enable Integria.
// Enable Pandora ITSM.
$row = [];
$row['name'] = __('Enable Integria IMS');
$row['control'] = html_print_checkbox_switch('integria_enabled', 1, $config['integria_enabled'], true);
$table_enable->data['integria_enabled'] = $row;
$row['name'] = __('Enable Pandora ITSM');
$row['control'] = html_print_checkbox_switch('ITSM_enabled', 1, $config['ITSM_enabled'], true);
$table_enable->data['ITSM_enabled'] = $row;
// Remote config table.
$table_remote = new StdClass();
$table_remote->data = [];
$table_remote->width = '100%';
$table_remote->styleTable = 'margin-bottom: 10px;';
$table_remote->id = 'integria-remote-setup';
$table_remote->id = 'ITSM-remote-setup';
$table_remote->class = 'databox filters filter-table-adv';
$table_remote->size['hostname'] = '50%';
$table_remote->size['api_pass'] = '50%';
// Enable Integria user configuration.
// Enable ITSM user configuration.
$row = [];
$row['user_level'] = html_print_label_input_block(
__('Integria configuration at user level'),
__('Pandora ITSM configuration at user level'),
html_print_checkbox_switch(
'integria_user_level_conf',
'ITSM_user_level_conf',
1,
$config['integria_user_level_conf'],
$config['ITSM_user_level_conf'],
true
)
);
$table_remote->data['integria_user_level_conf'] = $row;
$table_remote->data['ITSM_user_level_conf'] = $row;
// Integria user.
/*
$row = [];
$row['user'] = html_print_label_input_block(
__('User'),
html_print_input_text(
'integria_user',
$config['integria_user'],
'',
30,
100,
true
),
['div_class' => 'integria-remote-setup-integria_user']
);
*/
// Integria hostname.
// ITSM hostname.
$row = [];
$row['hostname'] = html_print_label_input_block(
__('URL to Integria IMS setup').ui_print_help_tip(__('Full URL to your Integria IMS setup (e.g., http://192.168.1.20/integria, https://support.mycompany.com).'), true),
__('URL to Pandora ITSM setup').ui_print_help_tip(__('Full URL to your Pandora ITSM setup (e.g., http://192.168.1.20/integria/api/v1).'), true),
html_print_input_text(
'integria_hostname',
$config['integria_hostname'],
'ITSM_hostname',
$config['ITSM_hostname'],
'',
30,
100,
true
),
['div_class' => 'integria-remote-setup-integria_hostname']
['div_class' => 'ITSM-remote-setup-ITSM_hostname']
);
// Integria token.
// ITSM token.
$row['password'] = html_print_label_input_block(
__('Password'),
__('Token'),
html_print_input_password(
'integria_pass',
io_output_password($config['integria_pass']),
'ITSM_token',
io_output_password($config['ITSM_token']),
'',
30,
100,
true
),
['div_class' => 'integria-remote-setup-integria_pass']
['div_class' => 'ITSM-remote-setup-ITSM_token']
);
$table_remote->data['integria_pass'] = $row;
$table_remote->data['ITSM_token'] = $row;
/*
// API password.
$row['api_pass'] = html_print_label_input_block(
__('API Password'),
html_print_input_password(
'integria_api_pass',
io_output_password($config['integria_api_pass']),
'',
30,
100,
true
),
['div_class' => 'integria-remote-setup-integria_api_pass']
);
$table_remote->data['integria_api_pass'] = $row;
// Request timeout.
$row = [];
$row['req_timeout'] = html_print_label_input_block(
__('Request timeout'),
html_print_input_text(
'integria_req_timeout',
$config['integria_req_timeout'],
'',
3,
10,
true
),
['div_class' => 'integria-remote-setup-integria_req_timeout']
);
$table_remote->data['integria_req_timeout'] = $row;
*/
$row = [];
$row['control'] = __('Inventory');
$row['control'] .= html_print_button(
@ -350,14 +218,14 @@ $row['control'] .= html_print_button(
$row['control'] .= '<span id="ITSM-spinner-sync" style="display:none;">&nbsp;'.html_print_image('images/spinner.gif', true).'</span>';
$row['control'] .= '<span id="ITSM-success-sync" style="display:none;">&nbsp;'.html_print_image('images/status_sets/default/severity_normal.png', true).'</span>';
$row['control'] .= '<span id="ITSM-failure-sync" style="display:none;">&nbsp;'.html_print_image('images/status_sets/default/severity_critical.png', true).'</span>';
$table_remote->data['integria_sync_inventory'] = $row;
$table_remote->data['ITSM_sync_inventory'] = $row;
// 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->id = 'ITSM-settings-setup';
$table_alert_settings->class = 'databox filters filter-table-adv';
$table_alert_settings->size[0] = '50%';
$table_alert_settings->size[1] = '50%';
@ -434,7 +302,7 @@ $table_alert_settings->data[1] = $row;
$row = [];
$row[0] = html_print_label_input_block(
__('Owner'),
html_print_autocomplete_users_from_integria(
html_print_autocomplete_users_from_pandora_itsm(
'default_owner',
$config['default_owner'],
true,
@ -490,7 +358,7 @@ $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->id = 'ITSM-cr-settings-setup';
$table_cr_settings->class = 'databox filters filter-table-adv';
$table_cr_settings->size[0] = '50%';
$table_cr_settings->size[1] = '50%';
@ -568,7 +436,7 @@ $table_cr_settings->data[1] = $row;
$row = [];
$row[0] = html_print_label_input_block(
__('Owner'),
html_print_autocomplete_users_from_integria(
html_print_autocomplete_users_from_pandora_itsm(
'cr_default_owner',
$config['cr_default_owner'],
true,
@ -637,11 +505,11 @@ $row['control'] .= '<span id="ITSM-spinner" class="invisible">&nbsp;'.html_print
$row['control'] .= '<span id="ITSM-success" class="invisible">&nbsp;'.html_print_image('images/status_sets/default/severity_normal.png', true).'&nbsp;'.__('Connection its OK').'</span>';
$row['control'] .= '<span id="ITSM-failure" class="invisible">&nbsp;'.html_print_image('images/status_sets/default/severity_critical.png', true).'&nbsp;'.__('Connection failed').'</span>';
$row['control'] .= '&nbsp;<span id="ITSM-message" class="invisible"></span>';
$table_remote->data['integria_test'] = $row;
$table_remote->data['ITSM_test'] = $row;
// Print.
echo '<div class="center pdd_b_10px mrgn_btn_20px white_box max_floating_element_size">';
echo '<a target="_blank" rel="noopener noreferrer" href="http://integriaims.com">';
echo '<a target="_blank" rel="noopener noreferrer" href="https://pandorafms.com/es/itsm/">';
html_print_image(
'images/integria_logo.svg',
false,
@ -649,11 +517,11 @@ html_print_image(
);
echo '</a>';
echo '<br />';
echo '<div clsas="integria_title">';
echo __('Integria IMS');
echo '<div class="ITSM_title">';
echo __('Pandora ITSM');
echo '</div>';
echo '<a target="_blank" rel="noopener noreferrer" href="https://integriaims.com">';
echo 'https://integriaims.com';
echo '<a target="_blank" rel="noopener noreferrer" href="https://pandorafms.com/es/itsm/">';
echo 'https://pandorafms.com/es/itsm/';
echo '</a>';
echo '</div>';
@ -668,7 +536,7 @@ echo '</div>';
// Form remote.
echo '<div id="form_remote">';
echo '<fieldset>';
echo '<legend>'.__('Integria API settings').'</legend>';
echo '<legend>'.__('Pandora ITSM API settings').'</legend>';
html_print_table($table_remote);
@ -723,30 +591,29 @@ ui_require_javascript_file('ITSM');
<script type="text/javascript">
if($('input:checkbox[name="integria_user_level_conf"]').is(':checked'))
if($('input:checkbox[name="ITSM_user_level_conf"]').is(':checked'))
{
$('.integria-remote-setup-integria_user').hide();
$('.integria-remote-setup-integria_pass').hide()
$('.ITSM-remote-setup-ITSM_token').hide()
}
var handleUserLevel = function(event) {
var is_checked = $('input:checkbox[name="integria_enabled"]').is(':checked');
var is_checked_userlevel = $('input:checkbox[name="integria_user_level_conf"]').is(':checked');
var is_checked = $('input:checkbox[name="ITSM_enabled"]').is(':checked');
var is_checked_userlevel = $('input:checkbox[name="ITSM_user_level_conf"]').is(':checked');
if (event.target.value == '1' && is_checked && !is_checked_userlevel) {
showUserPass();
$('input:checkbox[name="integria_user_level_conf"]').attr('checked', true);
$('input:checkbox[name="ITSM_user_level_conf"]').attr('checked', true);
}
else {
hideUserPass();
$('input:checkbox[name="integria_user_level_conf"]').attr('checked', false);
$('input:checkbox[name="ITSM_user_level_conf"]').attr('checked', false);
};
}
$('input:checkbox[name="integria_enabled"]').change(handleEnable);
$('input:checkbox[name="integria_user_level_conf"]').change(handleUserLevel);
$('input:checkbox[name="ITSM_enabled"]').change(handleEnable);
$('input:checkbox[name="ITSM_user_level_conf"]').change(handleUserLevel);
if(!$('input:checkbox[name="integria_enabled"]').is(':checked')) {
if(!$('input:checkbox[name="ITSM_enabled"]').is(':checked')) {
$('#form_remote').hide();
$('#form_custom_response_settings').hide();
} else {
@ -765,29 +632,27 @@ ui_require_javascript_file('ITSM');
}
var hideUserPass = function () {
$('.integria-remote-setup-integria_user').hide();
$('.integria-remote-setup-integria_pass').hide();
$('.ITSM-remote-setup-ITSM_token').hide();
}
var showUserPass = function () {
$('.integria-remote-setup-integria_user').show();
$('.integria-remote-setup-integria_pass').show();
$('.ITSM-remote-setup-ITSM_token').show();
}
var handleEnable = function (event) {
var is_checked = $('input:checkbox[name="integria_enabled"]').is(':checked');
var is_checked = $('input:checkbox[name="ITSM_enabled"]').is(':checked');
if (event.target.value == '1' && is_checked) {
showFields();
$('input:checkbox[name="integria_enabled"]').attr('checked', true);
$('input:checkbox[name="ITSM_enabled"]').attr('checked', true);
}
else {
hideFields();
$('input:checkbox[name="integria_enabled"]').attr('checked', false);
$('input:checkbox[name="ITSM_enabled"]').attr('checked', false);
};
}
$('input:checkbox[name="integria_enabled"]').change(handleEnable);
$('input:checkbox[name="ITSM_enabled"]').change(handleEnable);
var handleInventorySync = function (event) {
@ -818,17 +683,15 @@ ui_require_javascript_file('ITSM');
hideFailureImage();
showLoadingImage();
var integria_user = $('input[name=integria_user]').val();
var integria_pass = $('input[name=integria_pass]').val();
var api_hostname = $('input[name=integria_hostname]').val();
var api_pass = $('input[name=integria_api_pass]').val();
var ITSM_token = $('input[name=ITSM_token]').val();
var api_hostname = $('input[name=ITSM_hostname]').val();
if (!api_hostname.match(/^[a-zA-Z]+:\/\//))
{
api_hostname = 'http://' + api_hostname;
}
var url = api_hostname + '/integria/include/api.php';
var url = api_hostname + '//include/api.php';
<?php
// Retrieve all agents and codify string in the format that will be sent over in Ajax call.
@ -854,9 +717,7 @@ ui_require_javascript_file('ITSM');
var data = {
op: 'sync_pandora_agents_inventory',
user: integria_user,
user_pass: integria_pass,
pass: api_pass,
user_pass: ITSM_token,
params: agents_query_string_array,
token: '|;|'
}
@ -880,8 +741,8 @@ ui_require_javascript_file('ITSM');
}
$('#button-ITSM').click(function() {
var pass = $('input#password-integria_pass').val();
var host = $('input#text-integria_hostname').val();
var pass = $('input#password-ITSM_token').val();
var host = $('input#text-ITSM_hostname').val();
testConectionApi(pass, host);
});
//$('#button-sync-inventory').click(handleInventorySync);

View File

@ -371,7 +371,7 @@ if (is_ajax() === true) {
case 'pandora':
case 'ad':
case 'saml':
case 'integria':
case 'ITSM':
// Add enterprise authentication options.
if (enterprise_installed() === true) {
add_enterprise_auth_options($table, $type_auth);

View File

@ -333,6 +333,7 @@ if ($create_user === true) {
$values['default_custom_view'] = (int) get_parameter('default_custom_view');
$values['time_autorefresh'] = (int) get_parameter('time_autorefresh', 0);
$values['show_tips_startup'] = (int) get_parameter_switch('show_tips_startup');
$values['integria_user_level_pass'] = (string) get_parameter('integria_user_level_pass');
$dashboard = get_parameter('dashboard', '');
$visual_console = get_parameter('visual_console', '');
@ -624,6 +625,7 @@ if ($update_user) {
$values['ehorus_user_level_enabled'] = (bool) get_parameter('ehorus_user_level_enabled', false);
$values['ehorus_user_level_user'] = (string) get_parameter('ehorus_user_level_user');
$values['ehorus_user_level_pass'] = (string) get_parameter('ehorus_user_level_pass');
$values['integria_user_level_pass'] = (string) get_parameter('integria_user_level_pass');
$values['middlename'] = get_parameter('middlename', 0);

View File

@ -783,58 +783,59 @@ $userManagementTable->data['fields_addSettings'][1] .= html_print_div(
);
if ($config['integria_enabled'] && $config['integria_user_level_conf']) {
// Integria IMS user remote login.
$table_remote = new StdClass();
$table_remote->data = [];
$table_remote->width = '100%';
$table_remote->id = 'integria-remote-setup';
$table_remote->class = 'white_box';
$table_remote->size['name'] = '30%';
$table_remote->style['name'] = 'font-weight: bold';
if ($config['ITSM_enabled'] && $config['ITSM_user_level_conf']) {
// Pandora ITSM user remote login.
$table_ITSM = new StdClass();
$table_ITSM->data = [];
$table_ITSM->width = '100%';
$table_ITSM->id = 'ITSM-remote-setup';
$table_ITSM->class = 'white_box';
$table_ITSM->size['name'] = '30%';
$table_ITSM->style['name'] = 'font-weight: bold';
// Integria IMS user level authentication.
// Pandora ITSM user level authentication.
// Title.
$row = [];
$row['control'] = '<p class="edit_user_labels">'.__('Integria user configuration').': </p>';
$table_remote->data['integria_user_level_conf'] = $row;
$row['control'] = '<p class="edit_user_labels">'.__('Pandora ITSM user configuration').': </p>';
$table_ITSM->data['ITSM_user_level_conf'] = $row;
// Integria IMS user.
// Pandora ITSM pass.
$row = [];
$row['name'] = __('User');
$row['control'] = html_print_input_text('integria_user_level_user', $user_info['integria_user_level_user'], '', 30, 100, true);
$table_remote->data['integria_user_level_user'] = $row;
// Integria IMS pass.
$row = [];
$row['name'] = __('Password');
$row['control'] = html_print_input_password('integria_user_level_pass', io_output_password($user_info['integria_user_level_pass']), '', 30, 100, true);
$table_remote->data['integria_user_level_pass'] = $row;
$row['name'] = __('Token');
$row['control'] = html_print_input_password(
'integria_user_level_pass',
io_output_password($user_info['integria_user_level_pass']),
'',
100,
100,
true
);
$table_ITSM->data['integria_user_level_pass'] = $row;
// Test.
$integria_host = db_get_value('value', 'tconfig', 'token', 'integria_hostname');
$integria_api_pass = db_get_value('value', 'tconfig', 'token', 'integria_api_pass');
$ITSM_host = db_get_value('value', 'tconfig', 'token', 'ITSM_hostname');
$row = [];
$row['name'] = __('Test');
$row['control'] = html_print_button(
__('Start'),
'test-integria',
'ITSM',
false,
'integria_connection_test(&quot;'.$integria_host.'&quot;,'.$integria_api_pass.')',
[ 'icon' => 'next' ],
'',
[
'icon' => 'cog',
'mode' => 'secondary mini',
],
true
);
$row['control'] .= '&nbsp;<span id="test-integria-spinner" class="invisible">&nbsp;'.html_print_image('images/spinner.gif', true).'</span>';
$row['control'] .= '&nbsp;<span id="test-integria-success" class="invisible">&nbsp;'.html_print_image('images/status_sets/default/severity_normal.png', true).'</span>';
$row['control'] .= '&nbsp;<span id="test-integria-failure" class="invisible">&nbsp;'.html_print_image('images/status_sets/default/severity_critical.png', true).'</span>';
$row['control'] .= '<span id="test-integria-message" class="invisible"></span>';
$table_remote->data['integria_test'] = $row;
$row['control'] .= '&nbsp;<span id="ITSM-spinner" class="invisible">&nbsp;'.html_print_image('images/spinner.gif', true).'</span>';
$row['control'] .= '&nbsp;<span id="ITSM-success" class="invisible">&nbsp;'.html_print_image('images/status_sets/default/severity_normal.png', true).'</span>';
$row['control'] .= '&nbsp;<span id="ITSM-failure" class="invisible">&nbsp;'.html_print_image('images/status_sets/default/severity_critical.png', true).'</span>';
$row['control'] .= '<span id="ITSM-message" class="invisible"></span>';
$table_ITSM->data['ITSM_test'] = $row;
// echo '<div class="integria_user_conf">';
$userManagementTable->colspan['pandoraitsm'] = 2;
$userManagementTable->data['pandoraitsm'] = html_print_table($table_remote, true);
// echo '</div>';
$userManagementTable->data['pandoraitsm'] = html_print_table($table_ITSM, true);
}
if (isset($CodeQRTable) === true || isset($apiTokenContent) === true) {
@ -860,15 +861,23 @@ $vcard_data['organization'] = io_safe_output(get_product_name());
$vcard_data['url'] = ui_get_full_url('index.php');
$vcard_json = json_encode($vcard_data);
ui_require_javascript_file('ITSM');
?>
<script type="text/javascript">
$(document).ready(function () {
paint_vcard(
<?php echo $vcard_json; ?>,
"#qr_code_agent_view",
128,
128
);
<?php echo $vcard_json; ?>,
"#qr_code_agent_view",
128,
128
);
$('#button-ITSM').click(function() {
var pass = $('input#password-integria_user_level_pass').val();
var host = '<?php echo $ITSM_host; ?>';
testConectionApi(pass, host);
});
});
</script>

View File

@ -256,14 +256,6 @@ function process_user_login_remote($login, $pass, $api=false)
}
break;
// Remote Integria.
case 'integria':
if (enterprise_hook('remote_integria_process_user_login', [$login, $pass]) === false) {
$config['auth_error'] = 'User not found in database or incorrect password';
return false;
}
break;
// Unknown authentication method.
default:
$config['auth_error'] = 'User not found in database or incorrect password';

View File

@ -5803,7 +5803,7 @@ function get_help_info($section_name)
}
break;
case 'setup_integria_tab':
case 'setup_ITSM_tab':
if ($es) {
$result .= '04_using/14_incidence_management';
} else {
@ -5811,7 +5811,7 @@ function get_help_info($section_name)
}
break;
case 'integria_tab':
case 'ITSM_tab':
if ($es) {
$result .= '04_using/14_incidence_management#visualizacion_de_tickets';
} else {

View File

@ -244,18 +244,6 @@ function config_update_config()
$error_update[] = __('Enable GIS features');
}
if (config_update_value('integria_inventory', get_parameter('integria_inventory'), true) === false) {
$error_update[] = __('Integria inventory');
}
if (config_update_value('integria_api_password', io_input_password(get_parameter('integria_api_password')), true) === false) {
$error_update[] = __('Integria API password');
}
if (config_update_value('integria_url', get_parameter('integria_url'), true) === false) {
$error_update[] = __('Integria URL');
}
if (config_update_value('activate_netflow', (bool) get_parameter('activate_netflow'), true) === false) {
$error_update[] = __('Enable Netflow');
}
@ -775,26 +763,6 @@ function config_update_config()
$error_update[] = __('Password');
}
if (config_update_value('rintegria_server', get_parameter('rintegria_server'), true) === false) {
$error_update[] = __('Integria host');
}
if (config_update_value('rintegria_port', get_parameter('rintegria_port'), true) === false) {
$error_update[] = __('MySQL port');
}
if (config_update_value('rintegria_dbname', get_parameter('rintegria_dbname'), true) === false) {
$error_update[] = __('Database name');
}
if (config_update_value('rintegria_user', get_parameter('rintegria_user'), true) === false) {
$error_update[] = __('User');
}
if (config_update_value('rintegria_pass', io_input_password(get_parameter('rintegria_pass')), true) === false) {
$error_update[] = __('Password');
}
if (config_update_value('saml_path', get_parameter('saml_path'), true) === false) {
$error_update[] = __('Saml path');
}
@ -1891,103 +1859,91 @@ function config_update_config()
}
break;
case 'integria':
if (config_update_value('integria_user_level_conf', (int) get_parameter('integria_user_level_conf', 0), true) === false) {
$error_update[] = __('Integria user login');
case 'ITSM':
if (config_update_value('ITSM_user_level_conf', (int) get_parameter('ITSM_user_level_conf', 0), true) === false) {
$error_update[] = __('Pandora ITSM user login');
}
if (config_update_value('integria_enabled', (int) get_parameter('integria_enabled', 0), true) === false) {
$error_update[] = __('Enable Integria IMS');
if (config_update_value('ITSM_enabled', (int) get_parameter('ITSM_enabled', 0), true) === false) {
$error_update[] = __('Enable Pandora ITSM');
}
if (config_update_value('integria_user', (string) get_parameter('integria_user', $config['integria_user']), true) === false) {
$error_update[] = __('Integria user');
if (config_update_value('ITSM_token', io_input_password((string) get_parameter('ITSM_token', $config['ITSM_token'])), true) === false) {
$error_update[] = __('Pandora ITSM token');
}
if (config_update_value('integria_pass', io_input_password((string) get_parameter('integria_pass', $config['integria_pass'])), true) === false) {
$error_update[] = __('Integria password');
}
$ITSM_hostname = (string) get_parameter('ITSM_hostname', $config['ITSM_hostname']);
$integria_hostname = (string) get_parameter('integria_hostname', $config['integria_hostname']);
if (parse_url($integria_hostname, PHP_URL_SCHEME) === null) {
if (parse_url($ITSM_hostname, PHP_URL_SCHEME) === null) {
if (empty($_SERVER['HTTPS']) === false) {
$integria_hostname = 'https://'.$integria_hostname;
$ITSM_hostname = 'https://'.$ITSM_hostname;
} else {
$integria_hostname = 'http://'.$integria_hostname;
$ITSM_hostname = 'http://'.$ITSM_hostname;
}
}
if (config_update_value('integria_hostname', $integria_hostname, true) === false) {
$error_update[] = __('integria API hostname');
}
if (config_update_value('integria_api_pass', io_input_password((string) get_parameter('integria_api_pass', $config['integria_api_pass'])), true) === false) {
$error_update[] = __('Integria API password');
}
if (config_update_value('integria_req_timeout', (int) get_parameter('integria_req_timeout', $config['integria_req_timeout']), true) === false) {
$error_update[] = __('Integria request timeout');
if (config_update_value('ITSM_hostname', $ITSM_hostname, true) === false) {
$error_update[] = __('Pandora iTSM API hostname');
}
if (config_update_value('default_group', (int) get_parameter('default_group', $config['default_group']), true) === false) {
$error_update[] = __('Integria default group');
$error_update[] = __('Pandora ITSM default group');
}
if (config_update_value('cr_default_group', (int) get_parameter('cr_default_group', $config['cr_default_group']), true) === false) {
$error_update[] = __('Integria custom response default group');
$error_update[] = __('Pandora ITSM custom response default group');
}
if (config_update_value('default_criticity', (int) get_parameter('default_criticity', $config['default_criticity']), true) === false) {
$error_update[] = __('Integria default priority');
if (config_update_value('default_criticity', (string) get_parameter('default_criticity', $config['default_criticity']), true) === false) {
$error_update[] = __('Pandora ITSM default priority');
}
if (config_update_value('cr_default_criticity', (int) get_parameter('cr_default_criticity', $config['cr_default_criticity']), true) === false) {
$error_update[] = __('Integria custom response default priority');
if (config_update_value('cr_default_criticity', (string) get_parameter('cr_default_criticity', $config['cr_default_criticity']), true) === false) {
$error_update[] = __('Pandora ITSM custom response default priority');
}
if (config_update_value('default_creator', (string) get_parameter('default_creator', $config['default_creator']), true) === false) {
$error_update[] = __('Integria default creator');
$error_update[] = __('Pandora ITSM default creator');
}
if (config_update_value('default_owner', (string) get_parameter('default_owner', $config['default_owner']), true) === false) {
$error_update[] = __('Integria default owner');
$error_update[] = __('Pandora ITSM default owner');
}
if (config_update_value('cr_default_owner', (string) get_parameter('cr_default_owner', $config['cr_default_owner']), true) === false) {
$error_update[] = __('Integria custom response default owner');
$error_update[] = __('Pandora ITSM custom response default owner');
}
if (config_update_value('incident_type', (int) get_parameter('incident_type', $config['incident_type']), true) === false) {
$error_update[] = __('Integria default ticket type');
$error_update[] = __('Pandora ITSM default ticket type');
}
if (config_update_value('cr_incident_type', (int) get_parameter('cr_incident_type', $config['cr_incident_type']), true) === false) {
$error_update[] = __('Integria custom response default ticket type');
$error_update[] = __('Pandora ITSM custom response default ticket type');
}
if (config_update_value('incident_status', (int) get_parameter('incident_status', $config['incident_status']), true) === false) {
$error_update[] = __('Integria default ticket status');
if (config_update_value('incident_status', (string) get_parameter('incident_status', $config['incident_status']), true) === false) {
$error_update[] = __('Pandora ITSM default ticket status');
}
if (config_update_value('cr_incident_status', (int) get_parameter('cr_incident_status', $config['cr_incident_status']), true) === false) {
$error_update[] = __('Integria custom response default ticket status');
if (config_update_value('cr_incident_status', (string) get_parameter('cr_incident_status', $config['cr_incident_status']), true) === false) {
$error_update[] = __('Pandora ITSM custom response default ticket status');
}
if (config_update_value('incident_title', (string) get_parameter('incident_title', $config['incident_title']), true) === false) {
$error_update[] = __('Integria default ticket title');
$error_update[] = __('Pandora ITSM default ticket title');
}
if (config_update_value('cr_incident_title', (string) get_parameter('cr_incident_title', $config['cr_incident_title']), true) === false) {
$error_update[] = __('Integria custom response default ticket title');
$error_update[] = __('Pandora ITSM custom response default ticket title');
}
if (config_update_value('incident_content', (string) get_parameter('incident_content', $config['incident_content']), true) === false) {
$error_update[] = __('Integria default ticket content');
$error_update[] = __('Pandora ITSM default ticket content');
}
if (config_update_value('cr_incident_content', (string) get_parameter('cr_incident_content', $config['cr_incident_content']), true) === false) {
$error_update[] = __('Integria custom response default ticket content');
$error_update[] = __('Pandora ITSM custom response default ticket content');
}
break;
@ -3336,26 +3292,6 @@ function config_process_config()
config_update_value('rpandora_pass', '');
}
if (!isset($config['rintegria_server'])) {
config_update_value('rintegria_server', 'localhost');
}
if (!isset($config['rintegria_port'])) {
config_update_value('rintegria_port', 3306);
}
if (!isset($config['rintegria_dbname'])) {
config_update_value('rintegria_dbname', 'integria');
}
if (!isset($config['rintegria_user'])) {
config_update_value('rintegria_user', 'integria');
}
if (!isset($config['rintegria_pass'])) {
config_update_value('rintegria_pass', '');
}
if (!isset($config['saml_path'])) {
config_update_value('saml_path', '/opt/');
}
@ -3801,21 +3737,17 @@ function config_process_config()
config_update_value('ehorus_req_timeout', 5);
}
// Integria.
if (!isset($config['integria_user_level_conf'])) {
config_update_value('integria_user_level_conf', 0);
// ITSM.
if (!isset($config['ITSM_user_level_conf'])) {
config_update_value('ITSM_user_level_conf', 0);
}
if (!isset($config['integria_enabled'])) {
config_update_value('integria_enabled', 0);
if (!isset($config['ITSM_enabled'])) {
config_update_value('ITSM_enabled', 0);
}
if (!isset($config['integria_req_timeout'])) {
config_update_value('integria_req_timeout', 5);
}
if (!isset($config['integria_hostname'])) {
config_update_value('integria_hostname', '');
if (!isset($config['ITSM_hostname'])) {
config_update_value('ITSM_hostname', '');
}
// Module Library.

View File

@ -32,7 +32,6 @@ require_once $config['homedir'].'/include/functions_reporting.php';
require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions_integriaims.php';
/**

View File

@ -6247,7 +6247,7 @@ function html_print_input_multicheck(array $data):string
/**
* Print an autocomplete input filled out with Integria IMS users.
* Print an autocomplete input filled out with Pandora ITSM users.
*
* @param string $name The name of ajax control, by default is "users".
* @param string $default The default value to show in the ajax control.
@ -6259,7 +6259,7 @@ function html_print_input_multicheck(array $data):string
*
* @return mixed If the $return is true, return the output as string.
*/
function html_print_autocomplete_users_from_integria(
function html_print_autocomplete_users_from_pandora_itsm(
$name='users',
$default='',
$return=false,

View File

@ -86,175 +86,3 @@ function integriaims_tabs($active_tab, $view=false)
return $onheader;
}
/**
* Perform an API call to Integria IMS.
*
* @param string|null $api_hostname API host URL.
* @param string|null $user User name.
* @param string|null $user_pass User password.
* @param string|null $api_pass API password.
* @param string|null $operation API Operation.
* @param mixed $params String or array with parameters required by the API function.
* @param mixed $show_credentials_error_msg Show_credentials_error_msg.
* @param mixed $return_type Return_type.
* @param mixed $token Token.
* @param mixed $user_level_conf User_level_conf.
*
* @return boolean True if API request succeeded, false if API request failed.
*/
function integria_api_call(
$api_hostname=null,
$user=null,
$user_pass=null,
$api_pass=null,
$operation=null,
$params='',
$show_credentials_error_msg=false,
$return_type='',
$token='',
$user_level_conf=null
) {
global $config;
if (is_metaconsole()) {
$servers = metaconsole_get_connection_names();
foreach ($servers as $key => $server) {
$connection = metaconsole_get_connection($server);
if (metaconsole_connect($connection) != NOERR) {
continue;
}
$integria_enabled = db_get_sql(
'SELECT `value` FROM tconfig WHERE `token` = "integria_enabled"'
);
if (!$integria_enabled) {
metaconsole_restore_db();
continue;
}
// integria_user_level_conf, integria_hostname, integria_api_pass, integria_user, integria_user_level_user, integria_pass, integria_user_level_pass
$config_aux = db_get_all_rows_sql('SELECT `token`, `value` FROM `tconfig` WHERE `token` IN ("integria_user_level_conf", "integria_hostname", "integria_api_pass", "integria_user", "integria_user_level_user", "integria_pass", "integria_user_level_pass")');
$user_info = users_get_user_by_id($config['id_user']);
foreach ($config_aux as $key => $conf) {
if ($conf['token'] === 'integria_user_level_conf') {
$user_level_conf = $conf['value'];
}
if ($conf['token'] === 'integria_hostname') {
$api_hostname = $conf['value'];
}
if ($conf['token'] === 'integria_api_pass') {
$api_pass = $conf['value'];
}
if ($conf['token'] === 'integria_user') {
$user = $conf['value'];
}
if ($conf['token'] === 'integria_pass') {
$user_pass = $conf['value'];
}
}
if ($user_level_conf == true) {
$user = $user_info['integria_user_level_user'];
$user_pass = $user_info['integria_user_level_pass'];
}
metaconsole_restore_db();
}
} else {
if ($user_level_conf === null) {
$user_level_conf = (bool) $config['integria_user_level_conf'];
}
$user_info = users_get_user_by_id($config['id_user']);
// API access data.
if ($api_hostname === null) {
$api_hostname = $config['integria_hostname'];
}
if ($api_pass === null) {
$api_pass = $config['integria_api_pass'];
}
// Integria user and password.
if ($user === null || $user_level_conf === true) {
$user = $config['integria_user'];
if ($user_level_conf === true) {
$user = $user_info['integria_user_level_user'];
}
}
if ($user_pass === null || $user_level_conf === true) {
$user_pass = $config['integria_pass'];
if ($user_level_conf === true) {
$user_pass = $user_info['integria_user_level_pass'];
}
}
}
if (is_array($params)) {
$params = implode($token, $params);
}
$url_data = [
'user' => $user,
'user_pass' => $user_pass,
'pass' => $api_pass,
'op' => $operation,
'params' => io_safe_output($params),
];
if ($return_type !== '') {
$url_data['return_type'] = $return_type;
}
if ($token !== '') {
$url_data['token'] = $token;
}
// Build URL for API request.
$url = $api_hostname.'/include/api.php';
// ob_start();
// $out = fopen('php://output', 'w');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $url_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_STDERR, $out);
$result = curl_exec($ch);
// fclose($out);
// $debug = ob_get_clean();
$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = false;
if ($result === false) {
$error = curl_error($ch);
}
curl_close($ch);
if ($error === true || $http_status !== 200) {
if ($show_credentials_error_msg === true) {
ui_print_error_message(__('API request failed. Please check Integria IMS\' access credentials in Pandora setup.'));
}
return false;
} else {
return $result;
}
}

View File

@ -33,20 +33,20 @@ class ITSM
/**
* ITSM.
*
* @param string|null $host Host url.
* @param string|null $pass Token.
* @param string|null $host Host url.
* @param string|null $token Token.
*/
public function __construct(?string $host=null, ?string $pass=null)
public function __construct(?string $host=null, ?string $token=null)
{
global $config;
$user_info = \users_get_user_by_id($config['id_user']);
$this->userLevelConf = (bool) $config['integria_user_level_conf'];
$this->url = ($host ?? $config['integria_hostname']);
$this->userLevelConf = (bool) $config['ITSM_user_level_conf'];
$this->url = ($host ?? $config['ITSM_hostname']);
$this->userBearer = ($pass ?? $config['integria_pass']);
$this->userBearer = ($token ?? $config['ITSM_token']);
if ($this->userLevelConf === true) {
$this->userBearer = $user_info['integria_user_level_pass'];
$this->userBearer = ($token ?? $user_info['integria_user_level_pass']);
}
}

View File

@ -109,7 +109,7 @@ class Manager
*/
public function run()
{
\ui_require_css_file('integriaims');
\ui_require_css_file('pandoraitsm');
\ui_require_javascript_file('ITSM');
switch ($this->operation) {
case 'list':

View File

@ -8511,7 +8511,7 @@ div.graph div.legend table {
padding: 5px;
}
.integria_title .ehorus_title {
.ITSM_title .ehorus_title {
color: #515151;
}

View File

@ -1006,7 +1006,7 @@ div#dashboard-controls {
color: #fff;
}
.integria_details_shadow {
.ITSM_details_shadow {
background-color: #222;
border-bottom: 1px solid #e2e2e2;
border-left: 1px solid #e2e2e2;
@ -1015,7 +1015,7 @@ div#dashboard-controls {
border-top-right-radius: 5px;
}
div.integria_details_description textarea {
div.ITSM_details_description textarea {
width: 100%;
background-color: #111;
color: #fff;

View File

@ -1,4 +1,3 @@
/* --- Integria IMS --- */
div.priority {
width: 80px;
color: #fff;
@ -10,22 +9,22 @@ div.priority {
}
/* Details view */
div.integria_details {
div.ITSM_details {
display: grid;
grid-column-gap: 10px;
grid-template-columns: repeat(3, minmax(min-content, auto));
grid-auto-rows: 1fr;
}
div.integria_details div.box-shadow.white_table_graph {
div.ITSM_details div.box-shadow.white_table_graph {
box-shadow: none;
}
div.integria_details div.priority {
div.ITSM_details div.priority {
display: inline-block;
}
div.integriaims_details_row {
div.pandoraitsm_details_row {
display: grid;
grid-gap: 10px;
text-align: center;
@ -33,25 +32,25 @@ div.integriaims_details_row {
margin-bottom: 8px;
}
div.integriaims_details_titles {
div.pandoraitsm_details_titles {
font-weight: bold;
}
div.integria_details_row_five {
div.ITSM_details_row_five {
grid-template-columns: repeat(5, 1fr);
}
div.integria_details_row_three {
div.ITSM_details_row_three {
grid-template-columns: repeat(3, 1fr);
}
div.integria_details_description {
div.ITSM_details_description {
width: 100%;
overflow: auto;
padding: 0px 10px;
}
.integriaims_details_box {
.pandoraitsm_details_box {
display: grid;
grid-column-gap: 10px;
grid-row-gap: 5px;
@ -60,18 +59,18 @@ div.integria_details_description {
text-align: center;
}
.integriaims_details_box_five {
.pandoraitsm_details_box_five {
grid-template-rows: repeat(3, 1fr);
grid-template-columns: repeat(5, 1fr);
}
.integriaims_details_box_three {
.pandoraitsm_details_box_three {
grid-template-rows: repeat(3, 1fr);
grid-template-columns: repeat(3, 1fr);
}
/* ui_toggles */
.integria_details_shadow {
.ITSM_details_shadow {
background-color: #fff;
border-bottom: 1px solid #e2e2e2;
border-left: 1px solid #e2e2e2;
@ -80,35 +79,17 @@ div.integria_details_description {
border-top-right-radius: 5px;
}
.integria_details_shadow .white_table_graph_header {
.ITSM_details_shadow .white_table_graph_header {
border-left: none;
border-right: none;
}
.integria_details_content {
.ITSM_details_content {
border-bottom: none;
border-left: none;
border-right: none;
}
/* Inputs type text shown as a black line */
.integria_incidents_options input[type="text"] {
background-color: transparent;
border: none;
border-radius: 0;
border-bottom: 1px solid #ccc;
font-size: 10pt;
padding: 2px 5px;
box-sizing: border-box;
background-repeat: no-repeat;
background-position: left bottom 2px;
margin-bottom: 4px;
}
.integria_incident_options input[readonly] {
color: #848484;
}
.comment_title {
padding: 5px 10px 5px 20px;
background-color: rgba(130, 185, 46, 0.16);

View File

@ -1556,7 +1556,7 @@ if ((bool) $config['activate_gis'] === true) {
}
// Incident tab.
if ((bool) $config['integria_enabled'] === true) {
if ((bool) $config['ITSM_enabled'] === true) {
$incidenttab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=gagente&amp;sec2=operation/agentes/ver_agente&tab=incident&id_agente='.$id_agente,

View File

@ -706,7 +706,7 @@ if ($access_console_node === true) {
$menu_operation['workspace']['sub'] = $sub;
if ($access_console_node === true) {
if ((bool) $config['integria_enabled'] === true) {
if ((bool) $config['ITSM_enabled'] === true) {
// ITSM.
$menu_operation['ITSM']['text'] = __('ITSM');
$menu_operation['ITSM']['sec2'] = 'operation/ITSM/itsm';

View File

@ -133,9 +133,6 @@ if (isset($_GET['modified']) && !$view_mode) {
$upd_info['ehorus_user_level_pass'] = get_parameter('ehorus_user_level_pass');
$upd_info['ehorus_user_level_enabled'] = get_parameter('ehorus_user_level_enabled', 0);
$upd_info['integria_user_level_user'] = get_parameter('integria_user_level_user');
$upd_info['integria_user_level_pass'] = get_parameter('integria_user_level_pass');
$is_admin = db_get_value('is_admin', 'tusuario', 'id_user', $id);
$section = io_safe_output($upd_info['section']);
@ -886,60 +883,6 @@ $skin = '';
echo '</div>';
}
if ($config['integria_enabled'] && $config['integria_user_level_conf']) {
// Integria IMS user remote login.
$table_remote = new StdClass();
$table_remote->data = [];
$table_remote->width = '100%';
$table_remote->id = 'integria-remote-setup';
$table_remote->class = 'white_box';
$table_remote->size['name'] = '30%';
$table_remote->style['name'] = 'font-weight: bold';
// Integria IMS user level authentication.
// Title.
$row = [];
$row['control'] = '<p class="edit_user_labels">'.__('Integria user configuration').': </p>';
$table_remote->data['integria_user_level_conf'] = $row;
// Integria IMS user.
$row = [];
$row['name'] = __('User');
$row['control'] = html_print_input_text('integria_user_level_user', $user_info['integria_user_level_user'], '', 30, 100, true);
$table_remote->data['integria_user_level_user'] = $row;
// Integria IMS pass.
$row = [];
$row['name'] = __('Password');
$row['control'] = html_print_input_password('integria_user_level_pass', io_output_password($user_info['integria_user_level_pass']), '', 30, 100, true);
$table_remote->data['integria_user_level_pass'] = $row;
// Test.
$integria_host = db_get_value('value', 'tconfig', 'token', 'integria_hostname');
$integria_api_pass = db_get_value('value', 'tconfig', 'token', 'integria_api_pass');
$row = [];
$row['name'] = __('Test');
$row['control'] = html_print_button(
__('Start'),
'test-integria',
false,
'integria_connection_test(&quot;'.$integria_host.'&quot;,'.$integria_api_pass.')',
[ 'icon' => 'next' ],
true
);
$row['control'] .= '&nbsp;<span id="test-integria-spinner" class="invisible">&nbsp;'.html_print_image('images/spinner.gif', true).'</span>';
$row['control'] .= '&nbsp;<span id="test-integria-success" class="invisible">&nbsp;'.html_print_image('images/status_sets/default/severity_normal.png', true).'</span>';
$row['control'] .= '&nbsp;<span id="test-integria-failure" class="invisible">&nbsp;'.html_print_image('images/status_sets/default/severity_critical.png', true).'</span>';
$row['control'] .= '<span id="test-integria-message" class="invisible"></span>';
$table_remote->data['integria_test'] = $row;
echo '<div class="integria_user_conf">';
html_print_table($table_remote);
echo '</div>';
}
if ($is_management_allowed === true) {
if ((bool) $config['user_can_update_info'] === false) {
$outputButton = '<i>'.__('You can not change your user info under the current authentication scheme').'</i>';
@ -1071,7 +1014,6 @@ $skin = '';
<script language="javascript" type="text/javascript">
$(document).ready (function () {
$("#right_autorefreshlist").click (function () {
jQuery.each($("select[name='autorefresh_list_out[]'] option:selected"), function (key, value) {
imodule_name = $(value).html();
@ -1487,75 +1429,4 @@ function ehorus_connection_test(host, port) {
hideLoadingImage();
});
}
function integria_connection_test(api_hostname, api_pass) {
var user = $('input#text-integria_user_level_user').val();
var pass = $('input#password-integria_user_level_pass').val();
var badRequestMessage = '<?php echo __('Empty user or password'); ?>';
var notFoundMessage = '<?php echo __('User not found'); ?>';
var invalidPassMessage = '<?php echo __('Invalid password'); ?>';
var hideLoadingImage = function () {
$('#test-integria-spinner').hide();
}
var showLoadingImage = function () {
$('#test-integria-spinner').show();
}
var hideSuccessImage = function () {
$('#test-integria-success').hide();
}
var showSuccessImage = function () {
$('#test-integria-success').show();
}
var hideFailureImage = function () {
$('#test-integria-failure').hide();
}
var showFailureImage = function () {
$('#test-integria-failure').show();
}
var hideMessage = function () {
$('#test-integria-message').hide();
}
var showMessage = function () {
$('#test-integria-message').show();
}
var changeTestMessage = function (message) {
$('#test-integria-message').text(message);
}
hideSuccessImage();
hideFailureImage();
hideMessage();
showLoadingImage();
$.ajax({
url: "ajax.php",
type: 'POST',
dataType: 'json',
data: {
page: 'godmode/setup/setup_integria',
operation: 'check_api_access',
integria_user: user,
integria_pass: pass,
api_hostname: api_hostname,
api_pass: api_pass,
}
})
.done(function(data, textStatus, xhr) {
if (data.login == '1') {
showSuccessImage();
} else {
showFailureImage();
showMessage();
}
})
.fail(function(xhr, textStatus, errorThrown) {
showFailureImage();
showMessage();
})
.always(function(xhr, textStatus) {
hideLoadingImage();
});
}
</script>

View File

@ -1322,7 +1322,7 @@ CREATE TABLE IF NOT EXISTS `tusuario` (
`ehorus_user_level_pass` VARCHAR(45),
`ehorus_user_level_enabled` TINYINT,
`integria_user_level_user` VARCHAR(60),
`integria_user_level_pass` VARCHAR(45),
`integria_user_level_pass` TEXT,
`api_token` VARCHAR(255) NOT NULL DEFAULT '',
`allowed_ip_active` TINYINT UNSIGNED DEFAULT 0,
`allowed_ip_list` TEXT,

View File

@ -126,12 +126,9 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('custom_docs_logo', 'default_docs.png'),
('custom_support_logo', 'default_support.png'),
('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png'),
('integria_enabled', 0),
('integria_user', ''),
('ITSM_enabled', 0),
('integria_pass', ''),
('integria_hostname', ''),
('integria_api_pass', ''),
('integria_req_timeout', 5),
('ITSM_hostname', ''),
('default_group', ''),
('default_criticity', ''),
('default_creator', ''),

View File

@ -1018,7 +1018,7 @@ class Client
);
if ($sth === false) {
// IntegriaIMS.
// Pandora ITSM.
$sth = $dbh->query(
'SELECT `value`
FROM `tconfig`

View File

@ -31,8 +31,6 @@ require_once $config['homedir'].'/include/class/HTML.class.php';
global $config;
ui_require_css_file('integriaims');
/**
* Draw chart.
@ -83,7 +81,7 @@ ui_print_standard_header(
__('ITSM Dashboard'),
'',
false,
'integria_tab',
'ITSM_tab',
false,
[],
[

View File

@ -28,14 +28,12 @@
global $config;
ui_require_css_file('integriaims');
// Header tabs.
ui_print_standard_header(
__('ITSM Detailed'),
'',
false,
'integria_tab',
'ITSM_tab',
false,
[],
[
@ -71,12 +69,12 @@ if (empty($incidence) === true) {
}
// Details box.
$details_box = '<div class="integriaims_details_box integriaims_details_box_five">';
$details_box .= '<div class="integriaims_details_titles">'.__('Status').'</div>';
$details_box .= '<div class="integriaims_details_titles">'.__('Resolution').'</div>';
$details_box .= '<div class="integriaims_details_titles">'.__('Group').'</div>';
$details_box .= '<div class="integriaims_details_titles">'.__('Priority').'</div>';
$details_box .= '<div class="integriaims_details_titles">'.__('Type').'</div>';
$details_box = '<div class="pandoraitsm_details_box pandoraitsm_details_box_five">';
$details_box .= '<div class="pandoraitsm_details_titles">'.__('Status').'</div>';
$details_box .= '<div class="pandoraitsm_details_titles">'.__('Resolution').'</div>';
$details_box .= '<div class="pandoraitsm_details_titles">'.__('Group').'</div>';
$details_box .= '<div class="pandoraitsm_details_titles">'.__('Priority').'</div>';
$details_box .= '<div class="pandoraitsm_details_titles">'.__('Type').'</div>';
$details_box .= '<div>';
$details_box .= html_print_image('images/heart.png', true, ['class' => 'invert_filter']);
$details_box .= '</div>';
@ -104,7 +102,7 @@ if (empty($incidence) === true) {
$details_box .= '</div>';
// People box.
$people_box = '<div class="integriaims_details_box integriaims_details_box_three">';
$people_box = '<div class="pandoraitsm_details_box pandoraitsm_details_box_three">';
$people_box .= '<div>';
$people_box .= html_print_image('images/header_user_green.png', true, ['width' => '21']);
$people_box .= '</div>';
@ -115,9 +113,9 @@ if (empty($incidence) === true) {
$people_box .= html_print_image('images/header_user_green.png', true, ['width' => '21']);
$people_box .= '</div>';
$people_box .= '<div class="integriaims_details_titles">'.__('Created by').':</div>';
$people_box .= '<div class="integriaims_details_titles">'.__('Owned by').':</div>';
$people_box .= '<div class="integriaims_details_titles">'.__('Closed by').':</div>';
$people_box .= '<div class="pandoraitsm_details_titles">'.__('Created by').':</div>';
$people_box .= '<div class="pandoraitsm_details_titles">'.__('Owned by').':</div>';
$people_box .= '<div class="pandoraitsm_details_titles">'.__('Closed by').':</div>';
$people_box .= '<div>';
$people_box .= (empty($incidence['idCreator']) === false) ? $users[$incidence['idCreator']]['fullName'] : '--';
@ -131,7 +129,7 @@ if (empty($incidence) === true) {
$people_box .= '</div>';
// Dates box.
$dates_box = '<div class="integriaims_details_box integriaims_details_box_three">';
$dates_box = '<div class="pandoraitsm_details_box pandoraitsm_details_box_three">';
$dates_box .= '<div>';
$dates_box .= html_print_image('images/tick.png', true, ['class' => 'invert_filter']);
$dates_box .= '</div>';
@ -142,9 +140,9 @@ if (empty($incidence) === true) {
$dates_box .= html_print_image('images/mul.png', true, ['class' => 'invert_filter']);
$dates_box .= '</div>';
$dates_box .= '<div class="integriaims_details_titles">'.__('Created at').':</div>';
$dates_box .= '<div class="integriaims_details_titles">'.__('Updated at').':</div>';
$dates_box .= '<div class="integriaims_details_titles">'.__('Closed at').':</div>';
$dates_box .= '<div class="pandoraitsm_details_titles">'.__('Created at').':</div>';
$dates_box .= '<div class="pandoraitsm_details_titles">'.__('Updated at').':</div>';
$dates_box .= '<div class="pandoraitsm_details_titles">'.__('Closed at').':</div>';
$dates_box .= '<div>'.$incidence['startDate'].'</div>';
$dates_box .= '<div>'.$incidence['updateDate'].'</div>';
@ -154,7 +152,7 @@ if (empty($incidence) === true) {
$dates_box .= '</div>';
// Show details, people and dates.
echo '<div class="integria_details">';
echo '<div class="ITSM_details">';
ui_toggle(
$details_box,
__('Details'),
@ -163,8 +161,8 @@ if (empty($incidence) === true) {
false,
false,
'',
'integria_details_content white-box-content',
'integria_details_shadow box-flat white_table_graph'
'ITSM_details_content white-box-content',
'ITSM_details_shadow box-flat white_table_graph'
);
ui_toggle(
$people_box,
@ -174,8 +172,8 @@ if (empty($incidence) === true) {
false,
false,
'',
'integria_details_content white-box-content',
'integria_details_shadow box-flat white_table_graph'
'ITSM_details_content white-box-content',
'ITSM_details_shadow box-flat white_table_graph'
);
ui_toggle(
$dates_box,
@ -185,13 +183,13 @@ if (empty($incidence) === true) {
false,
false,
'',
'integria_details_content white-box-content',
'integria_details_shadow box-flat white_table_graph'
'ITSM_details_content white-box-content',
'ITSM_details_shadow box-flat white_table_graph'
);
echo '</div>';
// Show description.
$description_box = '<div class="integria_details_description">';
$description_box = '<div class="ITSM_details_description">';
$description_box .= $incidence['description'];
$description_box .= '</div>';
ui_toggle($description_box, __('Description'), '', '', false);

View File

@ -36,7 +36,7 @@ ui_print_standard_header(
__('ITSM Edit'),
'',
false,
'integria_tab',
'ITSM_tab',
false,
[],
[
@ -90,13 +90,13 @@ $table->data[0][0] = html_print_label_input_block(
)
);
$integria_logo = 'images/integria_logo_gray.png';
$ITSM_logo = 'images/integria_logo_gray.png';
if ($config['style'] === 'pandora_black' && is_metaconsole() === false) {
$integria_logo = 'images/integria_logo.svg';
$ITSM_logo = 'images/integria_logo.svg';
}
$table->data[0][2] = '<div style="max-width: 150px; float:right;">'.html_print_image(
$integria_logo,
$ITSM_logo,
true,
['style' => 'width: -webkit-fill-available;'],
false
@ -182,7 +182,7 @@ $table->data[3][1] = html_print_label_input_block(
),
html_print_input_text(
'idCreator',
$config['integria_user'],
'',
'',
0,
100,
@ -196,7 +196,7 @@ $table->data[3][1] = html_print_label_input_block(
$table->data[3][2] = html_print_label_input_block(
__('Owner').ui_print_help_tip(__('Type at least two characters to search the user.'), true),
html_print_autocomplete_users_from_integria(
html_print_autocomplete_users_from_pandora_itsm(
'owner',
($incidence['owner'] ?? ''),
true,
@ -237,7 +237,7 @@ $table->data[5][0] = html_print_label_input_block(
)
);
$formName = 'create_integria_incident_form';
$formName = 'create_itsm_incident_form';
$classForm = 'max_floating_element_size';
$enctype = 'multipart/form-data';
echo '<form class="'.$classForm.'" id="'.$formName.'" name="'.$formName.'" method="POST" enctype="'.$enctype.'">';

View File

@ -31,14 +31,12 @@ require_once $config['homedir'].'/include/class/HTML.class.php';
global $config;
ui_require_css_file('integriaims');
// Header tabs.
ui_print_standard_header(
__('ITSM Tickets'),
'',
false,
'integria_tab',
'ITSM_tab',
false,
[],
[