From 1bf7f1e36e2f4e89e5dc2a3c479ffb11f0741caf Mon Sep 17 00:00:00 2001 From: daniel Date: Fri, 21 Jul 2023 14:23:42 +0200 Subject: [PATCH] ITSM pandora_enterprise#11471 --- pandora_console/extras/mr/65.sql | 2 + .../godmode/agentes/agent_incidents.php | 5 +- .../godmode/agentes/configurar_agente.php | 2 +- .../godmode/alerts/alert_commands.php | 94 ++++++- .../godmode/alerts/alert_list.builder.php | 2 +- .../godmode/alerts/configure_alert_action.php | 90 +++++- pandora_console/godmode/menu.php | 4 +- pandora_console/godmode/setup/setup.php | 16 +- .../{setup_integria.php => setup_ITSM.php} | 259 ++++-------------- pandora_console/godmode/setup/setup_auth.php | 2 +- .../godmode/users/configure_user.php | 2 + .../godmode/users/user_management.php | 89 +++--- pandora_console/include/auth/mysql.php | 8 - pandora_console/include/functions.php | 4 +- pandora_console/include/functions_config.php | 146 +++------- pandora_console/include/functions_graph.php | 1 - pandora_console/include/functions_html.php | 4 +- .../include/functions_integriaims.php | 172 ------------ pandora_console/include/lib/ITSM/ITSM.php | 14 +- pandora_console/include/lib/ITSM/Manager.php | 2 +- pandora_console/include/styles/pandora.css | 2 +- .../include/styles/pandora_black.css | 4 +- .../{integriaims.css => pandoraitsm.css} | 47 +--- .../operation/agentes/ver_agente.php | 2 +- pandora_console/operation/menu.php | 2 +- pandora_console/operation/users/user_edit.php | 129 --------- pandora_console/pandoradb.sql | 2 +- pandora_console/pandoradb_data.sql | 7 +- .../lib/UpdateManager/Client.php | 2 +- .../views/ITSM/ITSMDashboardView.php | 4 +- .../views/ITSM/ITSMTicketDetailView.php | 48 ++-- .../views/ITSM/ITSMTicketEditView.php | 14 +- .../views/ITSM/ITSMTicketListView.php | 4 +- 33 files changed, 408 insertions(+), 777 deletions(-) rename pandora_console/godmode/setup/{setup_integria.php => setup_ITSM.php} (66%) rename pandora_console/include/styles/{integriaims.css => pandoraitsm.css} (68%) diff --git a/pandora_console/extras/mr/65.sql b/pandora_console/extras/mr/65.sql index 623c0a36f0..763ec200d1 100644 --- a/pandora_console/extras/mr/65.sql +++ b/pandora_console/extras/mr/65.sql @@ -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; diff --git a/pandora_console/godmode/agentes/agent_incidents.php b/pandora_console/godmode/agentes/agent_incidents.php index 5e7331744b..b4b7a81e74 100644 --- a/pandora_console/godmode/agentes/agent_incidents.php +++ b/pandora_console/godmode/agentes/agent_incidents.php @@ -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) { diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index a6f47d6535..73391d7ece 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -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, diff --git a/pandora_console/godmode/alerts/alert_commands.php b/pandora_console/godmode/alerts/alert_commands.php index b44a6f8521..36f43a67f8 100644 --- a/pandora_console/godmode/alerts/alert_commands.php +++ b/pandora_console/godmode/alerts/alert_commands.php @@ -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 .= ''; $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; diff --git a/pandora_console/godmode/alerts/alert_list.builder.php b/pandora_console/godmode/alerts/alert_list.builder.php index de07bce961..db53e202ad 100644 --- a/pandora_console/godmode/alerts/alert_list.builder.php +++ b/pandora_console/godmode/alerts/alert_list.builder.php @@ -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 IMS 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 { diff --git a/pandora_console/godmode/alerts/configure_alert_action.php b/pandora_console/godmode/alerts/configure_alert_action.php index f72b17bcf3..94beff6a83 100644 --- a/pandora_console/godmode/alerts/configure_alert_action.php +++ b/pandora_console/godmode/alerts/configure_alert_action.php @@ -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: "" + }); jQuery.post (, 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,12 +728,64 @@ $(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 = ''; + } + + if(!old_recovery_value) { + old_recovery_value = ''; + } + } else if (i === 3) { + if(!old_value) { + old_value = ''; + } + + if(!old_recovery_value) { + old_recovery_value = ''; + } + } else if (i === 4) { + if(!old_value) { + old_value = ''; + } + + if(!old_recovery_value) { + old_recovery_value = ''; + } + } else if (i === 5) { + if(!old_value) { + old_value = ''; + } + + if(!old_recovery_value) { + old_recovery_value = ''; + } + } else if (i === 6) { + if(!old_value) { + old_value = ''; + } + + if(!old_recovery_value) { + old_recovery_value = ''; + } + } else if (i === 7) { + if(!old_value) { + old_value = ''; + } + + if(!old_recovery_value) { + old_recovery_value = ''; + } + } + } + + if (($("[name=field" + i + "_recovery_value]").attr('id')) == ("hidden-field" + i + "_recovery_value")) { diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index 4ffdfc88f4..6e812b72e0 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -392,8 +392,8 @@ if ($access_console_node === true) { $sub2['godmode/setup/setup§ion=ehorus']['text'] = __('eHorus'); $sub2['godmode/setup/setup§ion=ehorus']['refr'] = 0; - $sub2['godmode/setup/setup§ion=integria']['text'] = __('ITSM'); - $sub2['godmode/setup/setup§ion=integria']['refr'] = 0; + $sub2['godmode/setup/setup§ion=ITSM']['text'] = __('ITSM'); + $sub2['godmode/setup/setup§ion=ITSM']['refr'] = 0; enterprise_hook('module_library_submenu'); diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index 65e0f1bb1c..ee1600a0e2 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -170,9 +170,9 @@ if (check_acl($config['id_user'], 0, 'AW')) { } } -$buttons['integria'] = [ +$buttons['ITSM'] = [ 'active' => false, - 'text' => ''.html_print_image( + 'text' => ''.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': diff --git a/pandora_console/godmode/setup/setup_integria.php b/pandora_console/godmode/setup/setup_ITSM.php similarity index 66% rename from pandora_console/godmode/setup/setup_integria.php rename to pandora_console/godmode/setup/setup_ITSM.php index 8aee891452..d9f33b7699 100644 --- a/pandora_console/godmode/setup/setup_integria.php +++ b/pandora_console/godmode/setup/setup_ITSM.php @@ -1,6 +1,6 @@ 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 IMS 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 IMS 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'] .= ''; $row['control'] .= ''; $row['control'] .= ''; -$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'] .= '
'; -echo ''; +echo ''; html_print_image( 'images/integria_logo.svg', false, @@ -649,11 +517,11 @@ html_print_image( ); echo ''; echo '
'; -echo '
'; -echo __('Integria IMS'); +echo '
'; +echo __('Pandora ITSM'); echo '
'; -echo ''; -echo 'https://integriaims.com'; +echo ''; +echo 'https://pandorafms.com/es/itsm/'; echo ''; echo '
'; @@ -668,7 +536,7 @@ echo '
'; // Form remote. echo '
'; echo '
'; -echo ''.__('Integria API settings').''; +echo ''.__('Pandora ITSM API settings').''; html_print_table($table_remote); @@ -723,30 +591,29 @@ ui_require_javascript_file('ITSM'); \ No newline at end of file diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php index a24769e528..76a6458f32 100644 --- a/pandora_console/include/auth/mysql.php +++ b/pandora_console/include/auth/mysql.php @@ -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'; diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index ee4ee7d1ab..c481d0c1a8 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -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 { diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index d1de857ae9..045cdaafca 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -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. diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 61f0d472be..c00a9827fe 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -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'; /** diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 3a7a30b09e..dd66bc93d7 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -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, diff --git a/pandora_console/include/functions_integriaims.php b/pandora_console/include/functions_integriaims.php index 817667272f..df5b85a709 100644 --- a/pandora_console/include/functions_integriaims.php +++ b/pandora_console/include/functions_integriaims.php @@ -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; - } -} diff --git a/pandora_console/include/lib/ITSM/ITSM.php b/pandora_console/include/lib/ITSM/ITSM.php index bca6e13469..03f2f0b047 100644 --- a/pandora_console/include/lib/ITSM/ITSM.php +++ b/pandora_console/include/lib/ITSM/ITSM.php @@ -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']); } } diff --git a/pandora_console/include/lib/ITSM/Manager.php b/pandora_console/include/lib/ITSM/Manager.php index c5b199e174..8d7e8b414b 100644 --- a/pandora_console/include/lib/ITSM/Manager.php +++ b/pandora_console/include/lib/ITSM/Manager.php @@ -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': diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index e0ca7fc68f..8527da8525 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -8511,7 +8511,7 @@ div.graph div.legend table { padding: 5px; } -.integria_title .ehorus_title { +.ITSM_title .ehorus_title { color: #515151; } diff --git a/pandora_console/include/styles/pandora_black.css b/pandora_console/include/styles/pandora_black.css index 652d777f72..ef56daab1d 100644 --- a/pandora_console/include/styles/pandora_black.css +++ b/pandora_console/include/styles/pandora_black.css @@ -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; diff --git a/pandora_console/include/styles/integriaims.css b/pandora_console/include/styles/pandoraitsm.css similarity index 68% rename from pandora_console/include/styles/integriaims.css rename to pandora_console/include/styles/pandoraitsm.css index 95ae267aa2..d6375c1459 100644 --- a/pandora_console/include/styles/integriaims.css +++ b/pandora_console/include/styles/pandoraitsm.css @@ -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); diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index bf110bd24f..546c3f3675 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -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&sec2=operation/agentes/ver_agente&tab=incident&id_agente='.$id_agente, diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index d507a0b3cc..b3b9643e99 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -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'; diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index 900a63ebb3..49e3c31537 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -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 '
'; } - 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'] = '

'.__('Integria user configuration').':

'; - $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("'.$integria_host.'",'.$integria_api_pass.')', - [ 'icon' => 'next' ], - true - ); - $row['control'] .= ' '; - $row['control'] .= ' '; - $row['control'] .= ' '; - $row['control'] .= ''; - $table_remote->data['integria_test'] = $row; - - echo '
'; - html_print_table($table_remote); - echo '
'; - } - - if ($is_management_allowed === true) { if ((bool) $config['user_can_update_info'] === false) { $outputButton = ''.__('You can not change your user info under the current authentication scheme').''; @@ -1071,7 +1014,6 @@ $skin = ''; diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 87f6283152..c54d3ddb7b 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -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, diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index ebf38a35f7..114a13898d 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -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', ''), diff --git a/pandora_console/update_manager_client/lib/UpdateManager/Client.php b/pandora_console/update_manager_client/lib/UpdateManager/Client.php index ba1574d8f9..cf948f0701 100644 --- a/pandora_console/update_manager_client/lib/UpdateManager/Client.php +++ b/pandora_console/update_manager_client/lib/UpdateManager/Client.php @@ -1018,7 +1018,7 @@ class Client ); if ($sth === false) { - // IntegriaIMS. + // Pandora ITSM. $sth = $dbh->query( 'SELECT `value` FROM `tconfig` diff --git a/pandora_console/views/ITSM/ITSMDashboardView.php b/pandora_console/views/ITSM/ITSMDashboardView.php index c6949c64cf..a0d162f45d 100644 --- a/pandora_console/views/ITSM/ITSMDashboardView.php +++ b/pandora_console/views/ITSM/ITSMDashboardView.php @@ -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, [], [ diff --git a/pandora_console/views/ITSM/ITSMTicketDetailView.php b/pandora_console/views/ITSM/ITSMTicketDetailView.php index 7a1a15c25e..24c61ef792 100644 --- a/pandora_console/views/ITSM/ITSMTicketDetailView.php +++ b/pandora_console/views/ITSM/ITSMTicketDetailView.php @@ -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 = '
'; - $details_box .= '
'.__('Status').'
'; - $details_box .= '
'.__('Resolution').'
'; - $details_box .= '
'.__('Group').'
'; - $details_box .= '
'.__('Priority').'
'; - $details_box .= '
'.__('Type').'
'; + $details_box = '
'; + $details_box .= '
'.__('Status').'
'; + $details_box .= '
'.__('Resolution').'
'; + $details_box .= '
'.__('Group').'
'; + $details_box .= '
'.__('Priority').'
'; + $details_box .= '
'.__('Type').'
'; $details_box .= '
'; $details_box .= html_print_image('images/heart.png', true, ['class' => 'invert_filter']); $details_box .= '
'; @@ -104,7 +102,7 @@ if (empty($incidence) === true) { $details_box .= '
'; // People box. - $people_box = '
'; + $people_box = '
'; $people_box .= '
'; $people_box .= html_print_image('images/header_user_green.png', true, ['width' => '21']); $people_box .= '
'; @@ -115,9 +113,9 @@ if (empty($incidence) === true) { $people_box .= html_print_image('images/header_user_green.png', true, ['width' => '21']); $people_box .= '
'; - $people_box .= '
'.__('Created by').':
'; - $people_box .= '
'.__('Owned by').':
'; - $people_box .= '
'.__('Closed by').':
'; + $people_box .= '
'.__('Created by').':
'; + $people_box .= '
'.__('Owned by').':
'; + $people_box .= '
'.__('Closed by').':
'; $people_box .= '
'; $people_box .= (empty($incidence['idCreator']) === false) ? $users[$incidence['idCreator']]['fullName'] : '--'; @@ -131,7 +129,7 @@ if (empty($incidence) === true) { $people_box .= '
'; // Dates box. - $dates_box = '
'; + $dates_box = '
'; $dates_box .= '
'; $dates_box .= html_print_image('images/tick.png', true, ['class' => 'invert_filter']); $dates_box .= '
'; @@ -142,9 +140,9 @@ if (empty($incidence) === true) { $dates_box .= html_print_image('images/mul.png', true, ['class' => 'invert_filter']); $dates_box .= '
'; - $dates_box .= '
'.__('Created at').':
'; - $dates_box .= '
'.__('Updated at').':
'; - $dates_box .= '
'.__('Closed at').':
'; + $dates_box .= '
'.__('Created at').':
'; + $dates_box .= '
'.__('Updated at').':
'; + $dates_box .= '
'.__('Closed at').':
'; $dates_box .= '
'.$incidence['startDate'].'
'; $dates_box .= '
'.$incidence['updateDate'].'
'; @@ -154,7 +152,7 @@ if (empty($incidence) === true) { $dates_box .= '
'; // Show details, people and dates. - echo '
'; + echo '
'; 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 '
'; // Show description. - $description_box = '
'; + $description_box = '
'; $description_box .= $incidence['description']; $description_box .= '
'; ui_toggle($description_box, __('Description'), '', '', false); diff --git a/pandora_console/views/ITSM/ITSMTicketEditView.php b/pandora_console/views/ITSM/ITSMTicketEditView.php index d51a1aa45a..3e438c0eb2 100644 --- a/pandora_console/views/ITSM/ITSMTicketEditView.php +++ b/pandora_console/views/ITSM/ITSMTicketEditView.php @@ -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] = '
'.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 '
'; diff --git a/pandora_console/views/ITSM/ITSMTicketListView.php b/pandora_console/views/ITSM/ITSMTicketListView.php index ea3ca378ec..b2e8d8eb8d 100644 --- a/pandora_console/views/ITSM/ITSMTicketListView.php +++ b/pandora_console/views/ITSM/ITSMTicketListView.php @@ -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, [], [