From e09db6a398d03bcb0d763b7989a6ffcb3f9bb391 Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Mon, 2 Oct 2023 12:25:37 +0200 Subject: [PATCH] Added Digital post module --- CHANGELOG.md | 4 +++- composer.json | 3 --- modules/os2forms_forloeb/README.md | 10 ---------- .../os2forms_forloeb/os2forms_forloeb.info.yml | 3 +-- .../os2forms_forloeb/os2forms_forloeb.install | 15 +++++++++++++++ modules/os2forms_forloeb/src/MaestroHelper.php | 18 +----------------- 6 files changed, 20 insertions(+), 33 deletions(-) create mode 100644 modules/os2forms_forloeb/os2forms_forloeb.install diff --git a/CHANGELOG.md b/CHANGELOG.md index 824f81d3..55ac2229 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,12 +11,14 @@ before starting to add changes. Use example [placed in the end of the page](#exa ## [Unreleased] +- [#62](https://github.com/OS2Forms/os2forms/pull/62) + Added digital post module + ## [3.12.0] 2023-10-02 - Removing webform_embed - os2forms_permissions_by_term: removing node access control - ## [3.11.0] 2023-09-25 - [OS-58] New company address fields diff --git a/composer.json b/composer.json index 7a679404..50d3d8f6 100644 --- a/composer.json +++ b/composer.json @@ -84,9 +84,6 @@ "wsdltophp/packagebase": "^5.0", "zaporylie/composer-drupal-optimizations": "^1.2" }, - "suggest": { - "os2forms/os2forms_digital_post": "Send Maestro notifications via digital post (see https://github.com/itk-dev/os2forms_digital_post/blob/main/README.md)" - }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1", "drupal/coder": "^8.3", diff --git a/modules/os2forms_forloeb/README.md b/modules/os2forms_forloeb/README.md index e1e0ec3c..5d00e940 100644 --- a/modules/os2forms_forloeb/README.md +++ b/modules/os2forms_forloeb/README.md @@ -44,13 +44,3 @@ must be processed asynchronously. Specify the queue handling notification jobs. #### Templates Define templates for emails and digital post (PDF). - -### Note on digital post - -Digital post is sent using the API provided by the [OS2Forms Digital Post -module](https://github.com/itk-dev/os2forms_digital_post) -(`os2forms_digital_post`) which in turn uses [SF1600: Print på -serviceplatformen](https://digitaliseringskataloget.dk/integration/sf1600). Not -all OS2Forms projects use `os2forms_digital_post` and in the future we should -generalize the API for sending digital post to allow other implementations (not -based on [SF1600](https://digitaliseringskataloget.dk/integration/sf1600)). diff --git a/modules/os2forms_forloeb/os2forms_forloeb.info.yml b/modules/os2forms_forloeb/os2forms_forloeb.info.yml index 96f211d7..72d453da 100644 --- a/modules/os2forms_forloeb/os2forms_forloeb.info.yml +++ b/modules/os2forms_forloeb/os2forms_forloeb.info.yml @@ -49,8 +49,7 @@ dependencies: - 'drupal:webform_templates' - 'drupal:webform_ui' - 'drupal:workflow_participants' - # os2forms_digital_post may be used for sending Meastro notifications via digital post - # - 'os2forms_digital_post:os2forms_digital_post' + - 'os2forms_digital_post:os2forms_digital_post' 'interface translation project': os2forms_forloeb 'interface translation server pattern': modules/contrib/os2forms_forloeb/translations/os2forms_forloeb.da.po diff --git a/modules/os2forms_forloeb/os2forms_forloeb.install b/modules/os2forms_forloeb/os2forms_forloeb.install new file mode 100644 index 00000000..afa21c63 --- /dev/null +++ b/modules/os2forms_forloeb/os2forms_forloeb.install @@ -0,0 +1,15 @@ +install([ + 'os2forms_digital_post', + ]); +} diff --git a/modules/os2forms_forloeb/src/MaestroHelper.php b/modules/os2forms_forloeb/src/MaestroHelper.php index 82c3912f..05032c71 100644 --- a/modules/os2forms_forloeb/src/MaestroHelper.php +++ b/modules/os2forms_forloeb/src/MaestroHelper.php @@ -67,13 +67,6 @@ class MaestroHelper implements LoggerInterface { */ private readonly EntityStorageInterface $queueStorage; - /** - * The Digital post helper. - * - * @var \Drupal\os2forms_digital_post\Helper\DigitalPostHelper|null - */ - private readonly ?DigitalPostHelper $digitalPostHelper; - /** * Constructor. */ @@ -88,16 +81,11 @@ public function __construct( private readonly LoggerChannelInterface $submissionLogger, private readonly ModuleHandlerInterface $moduleHandler, private readonly EntityPrintPluginManagerInterface $entityPrintPluginManager, + private readonly DigitalPostHelper $digitalPostHelper ) { $this->config = $configFactory->get(SettingsForm::SETTINGS); $this->webformSubmissionStorage = $entityTypeManager->getStorage('webform_submission'); $this->queueStorage = $entityTypeManager->getStorage('advancedqueue_queue'); - - // The OS2Forms Digital Post (os2forms_digital_post) module may not be - // installed. - $this->digitalPostHelper = \Drupal::hasService(DigitalPostHelper::class) - ? \Drupal::service(DigitalPostHelper::class) - : NULL; } /** @@ -391,10 +379,6 @@ private function sendNotificationDigitalPost( WebformSubmissionInterface $submission, string $notificationType ): void { - if (NULL === $this->digitalPostHelper) { - throw new RuntimeException('Cannot send digital post. Module OS2Forms Digital Post (os2forms_digital_post) not installed.'); - } - try { $document = new Document( $content,