From c45661a2b5f3e386864394b83e9d5e6324d74522 Mon Sep 17 00:00:00 2001 From: jekuaitk Date: Mon, 28 Oct 2024 14:36:42 +0100 Subject: [PATCH 1/5] Update methods to align with os2web_datalookup --- .../src/Plugin/os2web/DataLookup/DatafordelerDataLookup.php | 2 +- .../src/Plugin/os2web/DataLookup/DawaDataLookup.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/os2forms_dawa/src/Plugin/os2web/DataLookup/DatafordelerDataLookup.php b/modules/os2forms_dawa/src/Plugin/os2web/DataLookup/DatafordelerDataLookup.php index 2083fb1a..ae5ba41d 100644 --- a/modules/os2forms_dawa/src/Plugin/os2web/DataLookup/DatafordelerDataLookup.php +++ b/modules/os2forms_dawa/src/Plugin/os2web/DataLookup/DatafordelerDataLookup.php @@ -102,7 +102,7 @@ public function getMatrikulaEntries(string $matrikulaId) : array { /** * {@inheritdoc} */ - public function defaultConfiguration() { + public function defaultConfiguration(): array { return [ 'username' => '', 'password' => '', diff --git a/modules/os2forms_dawa/src/Plugin/os2web/DataLookup/DawaDataLookup.php b/modules/os2forms_dawa/src/Plugin/os2web/DataLookup/DawaDataLookup.php index 871ed6a3..7e90eb79 100644 --- a/modules/os2forms_dawa/src/Plugin/os2web/DataLookup/DawaDataLookup.php +++ b/modules/os2forms_dawa/src/Plugin/os2web/DataLookup/DawaDataLookup.php @@ -46,7 +46,7 @@ public function getMatrikulaAutocompletePath() { /** * {@inheritdoc} */ - public function defaultConfiguration() { + public function defaultConfiguration(): array { return [ 'address_autocomplete_path' => 'https://dawa.aws.dk/adresser/autocomplete', 'address_api_path' => 'https://dawa.aws.dk/adresser', From f0f876463bb28627a928e82a2b3158425077f3b0 Mon Sep 17 00:00:00 2001 From: jekuaitk Date: Mon, 28 Oct 2024 14:49:44 +0100 Subject: [PATCH 2/5] Add missing logger --- .../os2web/DataLookup/DatafordelerDataLookup.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/os2forms_dawa/src/Plugin/os2web/DataLookup/DatafordelerDataLookup.php b/modules/os2forms_dawa/src/Plugin/os2web/DataLookup/DatafordelerDataLookup.php index ae5ba41d..0112ef96 100644 --- a/modules/os2forms_dawa/src/Plugin/os2web/DataLookup/DatafordelerDataLookup.php +++ b/modules/os2forms_dawa/src/Plugin/os2web/DataLookup/DatafordelerDataLookup.php @@ -6,6 +6,7 @@ use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\os2forms_dawa\Entity\DatafordelerMatrikula; +use Drupal\os2web_audit\Service\Logger; use Drupal\os2web_datalookup\Plugin\os2web\DataLookup\DataLookupBase; use GuzzleHttp\ClientInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -30,9 +31,15 @@ class DatafordelerDataLookup extends DataLookupBase implements DatafordelerDataL /** * {@inheritdoc} */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, ClientInterface $httpClient) { + public function __construct( + array $configuration, + $plugin_id, + $plugin_definition, + ClientInterface $httpClient, + Logger $auditLogger, + ) { $this->httpClient = $httpClient; - parent::__construct($configuration, $plugin_id, $plugin_definition); + parent::__construct($configuration, $plugin_id, $plugin_definition, $auditLogger); } /** @@ -44,6 +51,7 @@ public static function create(ContainerInterface $container, array $configuratio $plugin_id, $plugin_definition, $container->get('http_client'), + $container->get('os2web_audit.logger'), ); } From 2329488114ff6111d88a9165a5c4b9cb237b825a Mon Sep 17 00:00:00 2001 From: jekuaitk Date: Thu, 31 Oct 2024 11:26:30 +0100 Subject: [PATCH 3/5] Applied coding standards --- .../os2web/DataLookup/DatafordelerDataLookup.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/os2forms_dawa/src/Plugin/os2web/DataLookup/DatafordelerDataLookup.php b/modules/os2forms_dawa/src/Plugin/os2web/DataLookup/DatafordelerDataLookup.php index 0112ef96..ba699519 100644 --- a/modules/os2forms_dawa/src/Plugin/os2web/DataLookup/DatafordelerDataLookup.php +++ b/modules/os2forms_dawa/src/Plugin/os2web/DataLookup/DatafordelerDataLookup.php @@ -32,11 +32,11 @@ class DatafordelerDataLookup extends DataLookupBase implements DatafordelerDataL * {@inheritdoc} */ public function __construct( - array $configuration, - $plugin_id, - $plugin_definition, - ClientInterface $httpClient, - Logger $auditLogger, + array $configuration, + $plugin_id, + $plugin_definition, + ClientInterface $httpClient, + Logger $auditLogger, ) { $this->httpClient = $httpClient; parent::__construct($configuration, $plugin_id, $plugin_definition, $auditLogger); From d747c8f5d0ae89cb305429760fb75abc364e7359 Mon Sep 17 00:00:00 2001 From: jekuaitk Date: Thu, 21 Nov 2024 10:21:02 +0100 Subject: [PATCH 4/5] Updated os2web_audit and os2web_datalookup versions --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 660852dc..ed6ac49f 100644 --- a/composer.json +++ b/composer.json @@ -68,8 +68,8 @@ "http-interop/http-factory-guzzle": "^1.0.0", "itk-dev/beskedfordeler-drupal": "^1.0", "itk-dev/serviceplatformen": "^1.5", - "os2web/os2web_audit": "^0.1", - "os2web/os2web_datalookup": "^1.5", + "os2web/os2web_audit": "^0.1.1", + "os2web/os2web_datalookup": "^2.0", "os2web/os2web_nemlogin": "^1.0", "php-http/guzzle7-adapter": "^1.0", "phpoffice/phpword": "^0.18.2", From 26650f77c21a6ae3b5cbbd7ecc46799910e99154 Mon Sep 17 00:00:00 2001 From: jekuaitk Date: Thu, 21 Nov 2024 10:45:34 +0100 Subject: [PATCH 5/5] Cleanup --- CHANGELOG.md | 3 +++ .../src/Helper/DigitalPostHelper.php | 8 ++++---- .../src/Helper/WebformHelperSF1601.php | 8 ++++---- .../src/Element/MitidChildrenSelectAjaxBehaviour.php | 2 +- modules/os2forms_nemid/src/Service/FormsHelper.php | 6 +++--- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26daa499..5be351cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ before starting to add changes. Use example [placed in the end of the page](#exa ## [Unreleased] +- Updated `os2web/os2web_audit` version +- Updated `os2web/os2web_datalookup` version + ## [3.16.2] 2024-10-31 - Applied coding standards diff --git a/modules/os2forms_digital_post/src/Helper/DigitalPostHelper.php b/modules/os2forms_digital_post/src/Helper/DigitalPostHelper.php index 9d3d3a87..07b81ab1 100644 --- a/modules/os2forms_digital_post/src/Helper/DigitalPostHelper.php +++ b/modules/os2forms_digital_post/src/Helper/DigitalPostHelper.php @@ -8,8 +8,8 @@ use Drupal\os2web_datalookup\LookupResult\CompanyLookupResult; use Drupal\os2web_datalookup\LookupResult\CprLookupResult; use Drupal\os2web_datalookup\Plugin\DataLookupManager; -use Drupal\os2web_datalookup\Plugin\os2web\DataLookup\DataLookupInterfaceCompany; -use Drupal\os2web_datalookup\Plugin\os2web\DataLookup\DataLookupInterfaceCpr; +use Drupal\os2web_datalookup\Plugin\os2web\DataLookup\DataLookupCompanyInterface; +use Drupal\os2web_datalookup\Plugin\os2web\DataLookup\DataLookupCprInterface; use Drupal\webform\WebformSubmissionInterface; use ItkDev\Serviceplatformen\Service\SF1601\SF1601; use ItkDev\Serviceplatformen\Service\SF1601\Serializer; @@ -99,7 +99,7 @@ public function log($level, $message, array $context = []): void { */ public function lookupCpr(string $cpr): CprLookupResult { $instance = $this->dataLookupManager->createDefaultInstanceByGroup('cpr_lookup'); - if (!($instance instanceof DataLookupInterfaceCpr)) { + if (!($instance instanceof DataLookupCprInterface)) { throw new RuntimeException('Cannot get CPR data lookup instance'); } $lookupResult = $instance->lookup($cpr); @@ -115,7 +115,7 @@ public function lookupCpr(string $cpr): CprLookupResult { */ public function lookupCvr(string $cvr): CompanyLookupResult { $instance = $this->dataLookupManager->createDefaultInstanceByGroup('cvr_lookup'); - if (!($instance instanceof DataLookupInterfaceCompany)) { + if (!($instance instanceof DataLookupCompanyInterface)) { throw new RuntimeException('Cannot get CVR data lookup instance'); } $lookupResult = $instance->lookup($cvr); diff --git a/modules/os2forms_digital_post/src/Helper/WebformHelperSF1601.php b/modules/os2forms_digital_post/src/Helper/WebformHelperSF1601.php index fa0a0584..3c2c724e 100644 --- a/modules/os2forms_digital_post/src/Helper/WebformHelperSF1601.php +++ b/modules/os2forms_digital_post/src/Helper/WebformHelperSF1601.php @@ -14,8 +14,8 @@ use Drupal\os2forms_digital_post\Plugin\AdvancedQueue\JobType\SendDigitalPostSF1601; use Drupal\os2forms_digital_post\Plugin\WebformHandler\WebformHandlerSF1601; use Drupal\os2web_datalookup\Plugin\DataLookupManager; -use Drupal\os2web_datalookup\Plugin\os2web\DataLookup\DataLookupInterfaceCompany; -use Drupal\os2web_datalookup\Plugin\os2web\DataLookup\DataLookupInterfaceCpr; +use Drupal\os2web_datalookup\Plugin\os2web\DataLookup\DataLookupCompanyInterface; +use Drupal\os2web_datalookup\Plugin\os2web\DataLookup\DataLookupCprInterface; use Drupal\webform\WebformSubmissionInterface; use Drupal\webform\WebformSubmissionStorageInterface; use ItkDev\Serviceplatformen\Service\SF1601\SF1601; @@ -127,7 +127,7 @@ public function sendDigitalPost(WebformSubmissionInterface $submission, array $h if (preg_match('/^\d{8}$/', $recipientIdentifier)) { $instance = $this->dataLookupManager->createDefaultInstanceByGroup('cvr_lookup'); - if (!($instance instanceof DataLookupInterfaceCompany)) { + if (!($instance instanceof DataLookupCompanyInterface)) { throw new RuntimeException('Cannot get CVR data lookup instance'); } $lookupResult = $instance->lookup($recipientIdentifier); @@ -138,7 +138,7 @@ public function sendDigitalPost(WebformSubmissionInterface $submission, array $h } else { $instance = $this->dataLookupManager->createDefaultInstanceByGroup('cpr_lookup'); - if (!($instance instanceof DataLookupInterfaceCpr)) { + if (!($instance instanceof DataLookupCprInterface)) { throw new RuntimeException('Cannot get CPR data lookup instance'); } $lookupResult = $instance->lookup($recipientIdentifier); diff --git a/modules/os2forms_nemid/src/Element/MitidChildrenSelectAjaxBehaviour.php b/modules/os2forms_nemid/src/Element/MitidChildrenSelectAjaxBehaviour.php index d57e973d..e88c2185 100644 --- a/modules/os2forms_nemid/src/Element/MitidChildrenSelectAjaxBehaviour.php +++ b/modules/os2forms_nemid/src/Element/MitidChildrenSelectAjaxBehaviour.php @@ -39,7 +39,7 @@ public static function mitidChildrenSelectAjax(array &$form, FormStateInterface /** @var \Drupal\os2web_datalookup\Plugin\DataLookupManager $os2web_datalookup_plugins */ $os2web_datalookup_plugins = \Drupal::service('plugin.manager.os2web_datalookup'); - /** @var \Drupal\os2web_datalookup\Plugin\os2web\DataLookup\DataLookupInterfaceCpr $cprPlugin */ + /** @var \Drupal\os2web_datalookup\Plugin\os2web\DataLookup\DataLookupCprInterface $cprPlugin */ $cprPlugin = $os2web_datalookup_plugins->createDefaultInstanceByGroup('cpr_lookup'); if ($cprPlugin->isReady()) { diff --git a/modules/os2forms_nemid/src/Service/FormsHelper.php b/modules/os2forms_nemid/src/Service/FormsHelper.php index 0fd62550..a2c435c2 100644 --- a/modules/os2forms_nemid/src/Service/FormsHelper.php +++ b/modules/os2forms_nemid/src/Service/FormsHelper.php @@ -182,7 +182,7 @@ public function lookupPersonData(FormStateInterface $form_state) { } if ($cpr) { - /** @var \Drupal\os2web_datalookup\Plugin\os2web\DataLookup\DataLookupInterfaceCpr $cprPlugin */ + /** @var \Drupal\os2web_datalookup\Plugin\os2web\DataLookup\DataLookupCprInterface $cprPlugin */ $cprPlugin = $this->dataLookManager->createDefaultInstanceByGroup('cpr_lookup'); if ($cprPlugin->isReady()) { @@ -284,7 +284,7 @@ private function lookupCompanyData(FormStateInterface $form_state) { // Performing the lookup. if ($cvr) { - /** @var \Drupal\os2web_datalookup\Plugin\os2web\DataLookup\DataLookupInterfaceCompany $cvrPlugin */ + /** @var \Drupal\os2web_datalookup\Plugin\os2web\DataLookup\DataLookupCompanyInterface $cvrPlugin */ $cvrPlugin = $this->dataLookManager->createDefaultInstanceByGroup('cvr_lookup'); if ($cvrPlugin->isReady()) { @@ -292,7 +292,7 @@ private function lookupCompanyData(FormStateInterface $form_state) { } } elseif ($pNumber) { - /** @var \Drupal\os2web_datalookup\Plugin\os2web\DataLookup\DataLookupInterfaceCompany $pNumberPlugin */ + /** @var \Drupal\os2web_datalookup\Plugin\os2web\DataLookup\DataLookupCompanyInterface $pNumberPlugin */ $pNumberPlugin = $this->dataLookManager->createDefaultInstanceByGroup('pnumber_lookup'); if ($pNumberPlugin->isReady()) {