From 608d133f888d1e1b3b36914e47f2276e3c68ee02 Mon Sep 17 00:00:00 2001 From: Kevin Carnes Date: Wed, 27 Apr 2022 15:12:15 +0200 Subject: [PATCH] Add platform parameter to SUSHI Services in Usage Module --- auth/install/auth.php | 11 ++++++++ install/index.php | 4 +-- licensing/install/licensing.php | 11 ++++++++ management/install/management.php | 11 ++++++++ organizations/install/organizations.php | 11 ++++++++ reports/install/reports.php | 11 ++++++++ resources/install/resources.php | 11 ++++++++ usage/admin/classes/domain/SushiService.php | 4 +++ usage/ajax_forms.php | 5 ++++ usage/ajax_htmldata.php | 1 + usage/ajax_processing.php | 1 + usage/install/protected/2022.04/001-01.sql | 1 + usage/install/usage.php | 30 +++++++++++++++++++++ usage/js/forms/sushiSubmitForm.js | 2 +- 14 files changed, 111 insertions(+), 3 deletions(-) create mode 100644 usage/install/protected/2022.04/001-01.sql diff --git a/auth/install/auth.php b/auth/install/auth.php index 7fb32cf06..bc05ab2f8 100644 --- a/auth/install/auth.php +++ b/auth/install/auth.php @@ -362,6 +362,17 @@ function register_auth_provider() ]; case "2020.09": + return [ + "function" => function($shared_module_info) { + $return = new stdClass(); + $return->yield = new stdClass(); + $return->success = true; + $return->yield->title = _("Auth Module"); + return $return; + } + ]; + + case "2022.04": return [ "function" => function($shared_module_info) { $return = new stdClass(); diff --git a/install/index.php b/install/index.php index 9cf81f528..df6ba4e68 100644 --- a/install/index.php +++ b/install/index.php @@ -57,8 +57,8 @@ * * NOTE: It is assumed that version strings can be understood by php's version_compare function */ -$INSTALLATION_VERSION = "2020.09"; -$INSTALLATION_VERSIONS = ["1.9.0", "2.0.0", "3.0.0", "3.0.1", "2020.02", "2020.09"]; +$INSTALLATION_VERSION = "2022.04"; +$INSTALLATION_VERSIONS = ["1.9.0", "2.0.0", "3.0.0", "3.0.1", "2020.02", "2020.09", "2022.04"]; function make_sure_template_is_drawn() { diff --git a/licensing/install/licensing.php b/licensing/install/licensing.php index 246d5e0b5..ff9adff56 100644 --- a/licensing/install/licensing.php +++ b/licensing/install/licensing.php @@ -210,6 +210,17 @@ function register_licensing_provider() ]; case "2020.09": + return [ + "function" => function($shared_module_info) { + $return = new stdClass(); + $return->yield = new stdClass(); + $return->success = true; + $return->yield->title = _("Licensing Module"); + return $return; + } + ]; + + case "2022.04": return [ "function" => function($shared_module_info) { $return = new stdClass(); diff --git a/management/install/management.php b/management/install/management.php index 0551e4744..6dc42d6f5 100644 --- a/management/install/management.php +++ b/management/install/management.php @@ -132,6 +132,17 @@ function register_management_provider() ]; case "2020.09": + return [ + "function" => function($shared_module_info) { + $return = new stdClass(); + $return->yield = new stdClass(); + $return->success = true; + $return->yield->title = _("Management Module"); + return $return; + } + ]; + + case "2022.04": return [ "function" => function($shared_module_info) { $return = new stdClass(); diff --git a/organizations/install/organizations.php b/organizations/install/organizations.php index 41ff1c1e9..2efd32331 100644 --- a/organizations/install/organizations.php +++ b/organizations/install/organizations.php @@ -181,6 +181,17 @@ function register_organizations_provider() ]; case "2020.09": + return [ + "function" => function($shared_module_info) { + $return = new stdClass(); + $return->yield = new stdClass(); + $return->success = true; + $return->yield->title = _("Organizations Module"); + return $return; + } + ]; + + case "2022.04": return [ "function" => function($shared_module_info) { $return = new stdClass(); diff --git a/reports/install/reports.php b/reports/install/reports.php index 865ea21b3..cbcc46b4f 100644 --- a/reports/install/reports.php +++ b/reports/install/reports.php @@ -129,6 +129,17 @@ function register_reports_provider() ]; case "2020.09": + return [ + "function" => function($shared_module_info) { + $return = new stdClass(); + $return->yield = new stdClass(); + $return->success = true; + $return->yield->title = _("Reports Module"); + return $return; + } + ]; + + case "2022.04": return [ "function" => function($shared_module_info) { $return = new stdClass(); diff --git a/resources/install/resources.php b/resources/install/resources.php index 3a41fb1a1..a48a87585 100644 --- a/resources/install/resources.php +++ b/resources/install/resources.php @@ -283,6 +283,17 @@ function register_resources_provider() ]; case "2020.09": + return [ + "function" => function($shared_module_info) { + $return = new stdClass(); + $return->yield = new stdClass(); + $return->success = true; + $return->yield->title = _("Resources Module"); + return $return; + } + ]; + + case "2022.04": return [ "function" => function($shared_module_info) { $return = new stdClass(); diff --git a/usage/admin/classes/domain/SushiService.php b/usage/admin/classes/domain/SushiService.php index a4c7992d2..b409b7431 100644 --- a/usage/admin/classes/domain/SushiService.php +++ b/usage/admin/classes/domain/SushiService.php @@ -373,6 +373,10 @@ private function jsonTransfer($reportLayout, $serviceProvider) $params['include_parent_details'] = 'true'; } + if ($this->platform) { + $params['platform'] = $this->platform; + } + // setup curl client $trailingSlash = substr($this->serviceURL, -1) == '/' ? '' : '/'; $endpoint = $this->serviceURL . $trailingSlash . 'reports/' . strtolower($reportLayout) . '?' . http_build_query($params); diff --git a/usage/ajax_forms.php b/usage/ajax_forms.php index 9fdd5f73e..c1c24ed1b 100644 --- a/usage/ajax_forms.php +++ b/usage/ajax_forms.php @@ -538,6 +538,11 @@ + + + + + diff --git a/usage/ajax_htmldata.php b/usage/ajax_htmldata.php index 2ac7b01b0..0bacbeb02 100644 --- a/usage/ajax_htmldata.php +++ b/usage/ajax_htmldata.php @@ -466,6 +466,7 @@ echo "" . _("Requestor ID") . "" . $sushiService->requestorID . ""; echo "" . _("API Key") . "" . $sushiService->apiKey . ""; echo "" . _("Customer ID") . "" . $sushiService->customerID . ""; + echo "" . _("Platform") . "" . $sushiService->platform . ""; echo "" . _("Security") . "" . $sushiService->security . ""; echo "" . _("Login") . "" . $sushiService->login . ""; echo "" . _("Password") . "" . $sushiService->password . ""; diff --git a/usage/ajax_processing.php b/usage/ajax_processing.php index 8fddd07a3..8a8adda01 100755 --- a/usage/ajax_processing.php +++ b/usage/ajax_processing.php @@ -227,6 +227,7 @@ $sushiService->requestorID = $_POST['requestorID']; $sushiService->apiKey = $_POST['apiKey']; $sushiService->customerID = $_POST['customerID']; + $sushiService->platform = $_POST['platform']; $sushiService->security = $_POST['security']; $sushiService->reportLayouts = $_POST['reportLayouts']; $sushiService->releaseNumber = $_POST['releaseNumber']; diff --git a/usage/install/protected/2022.04/001-01.sql b/usage/install/protected/2022.04/001-01.sql new file mode 100644 index 000000000..15115247b --- /dev/null +++ b/usage/install/protected/2022.04/001-01.sql @@ -0,0 +1 @@ +ALTER TABLE SushiService ADD COLUMN platform VARCHAR(300) NULL; diff --git a/usage/install/usage.php b/usage/install/usage.php index 2ec4302bc..7644594d0 100644 --- a/usage/install/usage.php +++ b/usage/install/usage.php @@ -178,6 +178,36 @@ function register_usage_provider() } ]; + case "2022.04": + $conf_data = parse_ini_file($protected_module_data["config_file_path"], true); + return [ + "dependencies_array" => [ "db_tools", "have_read_write_access_to_config" ], + "sharedInfo" => [ + "config_file" => [ + "path" => $protected_module_data["config_file_path"], + ], + "database_name" => $conf_data["database"]["name"] + ], + "function" => function($shared_module_info) use ($MODULE_VARS, $protected_module_data, $version) { + $return = new stdClass(); + $return->success = true; + $return->yield = new stdClass(); + $return->yield->title = _("Usage Module"); + $return->yield->messages = []; + $conf_data = parse_ini_file($protected_module_data["config_file_path"], true); + // Process SQL files. + $db_name = $conf_data["database"]["name"]; + $dbconnection = $shared_module_info["provided"]["get_db_connection"]( $db_name ); + $ret = $shared_module_info["provided"]["process_sql_files"]( $dbconnection, $version, $MODULE_VARS["uid"] ); + if (!$ret["success"]) { + $return->success = false; + $return->yield->messages = array_merge($return->yield->messages, $ret["messages"]); + return $return; + } + return $return; + } + ]; + default: return null; } diff --git a/usage/js/forms/sushiSubmitForm.js b/usage/js/forms/sushiSubmitForm.js index 629c66d28..db7d63fd3 100755 --- a/usage/js/forms/sushiSubmitForm.js +++ b/usage/js/forms/sushiSubmitForm.js @@ -45,7 +45,7 @@ function submitSushiService(){ type: "POST", url: "ajax_processing.php?action=submitSushiService", cache: false, - data: { sushiServiceID: $("#editSushiServiceID").val(), platformID: $("#platformID").val(), serviceURL: $("#serviceURL").val(), wsdlURL: $("#wsdlURL").val(), requestorID: $("#requestorID").val(), customerID: $("#customerID").val(), security: $("#security").val(), reportLayouts: $("#reportLayouts").val(), releaseNumber: $("#releaseNumber").val(), login: $("#login").val(), password: $("#password").val(), serviceDayOfMonth: $("#serviceDayOfMonth").val(), noteText: $("#noteText").val(), apiKey: $("#apiKey").val() }, + data: { sushiServiceID: $("#editSushiServiceID").val(), platformID: $("#platformID").val(), serviceURL: $("#serviceURL").val(), wsdlURL: $("#wsdlURL").val(), requestorID: $("#requestorID").val(), customerID: $("#customerID").val(), platform: $("#platform").val(), security: $("#security").val(), reportLayouts: $("#reportLayouts").val(), releaseNumber: $("#releaseNumber").val(), login: $("#login").val(), password: $("#password").val(), serviceDayOfMonth: $("#serviceDayOfMonth").val(), noteText: $("#noteText").val(), apiKey: $("#apiKey").val() }, success: function(html) { window.parent.tb_remove(); window.parent.updateSushiDetails();