Skip to content

Commit

Permalink
Added Digital post module
Browse files Browse the repository at this point in the history
  • Loading branch information
rimi-itk committed Oct 2, 2023
1 parent 4b8202c commit 1b9fc14
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 33 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 0 additions & 10 deletions modules/os2forms_forloeb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)).
3 changes: 1 addition & 2 deletions modules/os2forms_forloeb/os2forms_forloeb.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 15 additions & 0 deletions modules/os2forms_forloeb/os2forms_forloeb.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

/**
* @file
* Install, update and uninstall functions for the os2forms_forloeb.
*/

/**
* Install os2forms_digital_post module.
*/
function os2forms_forloeb_update_9001(&$sandbox) {
\Drupal::service('module_installer')->install([
'os2forms_digital_post',
]);
}
18 changes: 1 addition & 17 deletions modules/os2forms_forloeb/src/MaestroHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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;
}

/**
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 1b9fc14

Please sign in to comment.