Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Digital post #62

Merged
merged 5 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ jobs:
strategy:
matrix:
php-versions: [ '8.1' ]
dependency-version: [ prefer-lowest, prefer-stable ]
steps:
- uses: actions/checkout@master
- name: Setup PHP, with composer and extensions
Expand All @@ -83,6 +82,35 @@ jobs:
run: |
composer coding-standards-check/phpcs

php-code-analysis:
name: PHP code analysis
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [ '8.1' ]
steps:
- uses: actions/checkout@master
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: json
coverage: none
tools: composer:v2
# https://github.com/shivammathur/setup-php#cache-composer-dependencies
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Code analysis
run: |
./scripts/code-analysis

markdownlint:
runs-on: ubuntu-latest
name: markdownlint
Expand All @@ -103,7 +131,7 @@ jobs:
- name: Yarn install
uses: actions/setup-node@v2
with:
node-version: '18'
node-version: '20'
- run: yarn install
- name: markdownlint
run: yarn coding-standards-check/markdownlint
8 changes: 7 additions & 1 deletion .markdownlintrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{
// @see https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.jsonc
// MD013/line-length - Line length
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md013.md
"MD013": {
// Exclude code blocks
"code_blocks": false
},

// Prevent complaining on duplicated headings in CHANGELOG.md
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md024.md
"MD024": {
"siblings_only": true
}
}

Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ 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.2] 2023-10-03

- Removing webform_embed - fix
Expand Down
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,20 @@ docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.1-fpm composer c
### Markdown

```sh
docker run --rm --volume ${PWD}:/app --workdir /app node:18 yarn install
docker run --rm --volume ${PWD}:/app --workdir /app node:18 yarn coding-standards-check/markdownlint
docker run --rm --volume ${PWD}:/app --workdir /app node:20 yarn install
docker run --rm --volume ${PWD}:/app --workdir /app node:20 yarn coding-standards-check/markdownlint

# Fix (some) coding standards issues.
docker run --rm --volume ${PWD}:/app --workdir /app node:18 yarn coding-standards-apply/markdownlint
docker run --rm --volume ${PWD}:/app --workdir /app node:20 yarn coding-standards-apply/markdownlint
```

## Code analysis

We use [PHPStan](https://phpstan.org/) for static code analysis.

Running statis code analysis on a standalone Drupal module is a bit tricky, so
we use a helper script to run the analysis:

```sh
./scripts/code-analysis
```
33 changes: 26 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
}
},
"require": {
"php": "^8.1",
"ext-dom": "*",
"ext-soap": "*",
"cweagans/composer-patches": "^1.6.5",
"dompdf/dompdf": "^2.0",
"drupal/admin_toolbar": "^3.0",
Expand Down Expand Up @@ -68,20 +71,28 @@
"drupal/webform_validation": "^2.0",
"drupal/webform_views": "^5.0@alpha",
"drupal/workflow_participants": "^2.4",
"os2web/os2web_datalookup": "^1.0",
"http-interop/http-factory-guzzle": "^1.0.0",
"itk-dev/beskedfordeler-drupal": "^1.0",
"itk-dev/serviceplatformen": "dev-feature/guzzle6-adapter as 1.5",
"os2web/os2web_datalookup": "^1.5",
"os2web/os2web_nemlogin": "^1.0",
"php-http/guzzle6-adapter": "^2.0",
"phpoffice/phpword": "^0.18.2",
"symfony/options-resolver": "^5.4 || ^6.0",
"tecnickcom/tcpdf": "~6",
"webmozart/path-util": "^2.3",
"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",
"drupal/maillog": "^1.0"
"drupal/maillog": "^1.0",
"mglaman/phpstan-drupal": "^1.1",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan-deprecation-rules": "^1.1",
"phpunit/phpunit": "^9.5",
"wsdltophp/packagegenerator": "^4.0"
},
"extra" : {
"composer-exit-on-patch-failure": false,
Expand All @@ -105,6 +116,12 @@
}
},
"scripts": {
"code-analysis/phpstan": [
"phpstan analyse"
],
"code-analysis": [
"@code-analysis/phpstan"
],
"coding-standards-check/phpcs": [
"phpcs --standard=phpcs.xml.dist"
],
Expand All @@ -121,9 +138,11 @@
"config": {
"sort-packages": true,
"allow-plugins": {
"simplesamlphp/composer-module-installer": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"cweagans/composer-patches": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true,
"simplesamlphp/composer-module-installer": true,
"vaimo/composer-patches": true,
"zaporylie/composer-drupal-optimizations": true
}
}
Expand Down
6 changes: 6 additions & 0 deletions modules/os2forms_digital_post/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
vendor
composer.lock
node_modules
yarn.lock

src/Controller/SF1601Controller.php.log
68 changes: 68 additions & 0 deletions modules/os2forms_digital_post/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# OS2Forms Digital Post

Send Digital Post to danish citizens from a webform.

This module uses the
[SF1601](https://digitaliseringskataloget.dk/integration/sf1601) service from
Serviceplatformen. Information and documentation can be obtained by following
that link.

## Usage

This module provides functionality for sending digital post to danish citizens.
A WebformHandler is provided that you can add to your webform, and if configured
it will send the submitted data as digital post.

## Installation

Enable the module with [`drush`](https://drush.org/)

```shell
drush pm:enable os2forms_digital_post
```

### Example forms

See [OS2Forms Digital Post
examples](modules/os2forms_digital_post_examples/README.md).

## Configuration

Go to `/admin/os2forms_digital_post/settings` to set up global settings for
digital post.

### Queue

The actual sending of digital post is handled by jobs in an [Advanced
Queue](https://www.drupal.org/project/advancedqueue) queue.

The default queue, OSForms digital post (`os2forms_digital_post`), must be
processed by a server `cron` job (cf.
`/admin/config/system/queues/manage/os2forms_digital_post?destination=/en/admin/config/system/queues`),
but this can be changed or a completely diffent queue can be used if nedd be.

If using the default queue, it can be processed by running the command

```sh
drush advancedqueue:queue:process os2forms_digital_post
```

List the queue (and all other queues) with

```sh
drush advancedqueue:queue:list
```

or go to `/admin/config/system/queues/jobs/os2forms_digital_post` for a
graphical overview of jobs in the queue.

## Beskedfordeler

Thie digital post module depends on [Beskedfordeler for
Drupal](https://github.com/itk-dev/beskedfordeler-drupalon) to get get
information on how or why not a digital post has been delivered (cf.
[BeskedfordelerEventSubscriber](src/EventSubscriber/BeskedfordelerEventSubscriber.php)).

See the [documentation for Beskedfordeler for
Drupal](https://github.com/itk-dev/beskedfordeler-drupal#beskedfordeler) for
details on how to set up the Beskedfordeler module.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
langcode: en
status: true
dependencies:
module:
- os2forms_digital_post
enforced:
module:
- os2forms_digital_post
id: os2forms_digital_post
label: 'OSForms digital post'
backend: database
backend_configuration:
lease_time: 300
processor: cron
processing_time: 90
locked: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# OS2Forms Digital Post examples

Examples for OS2Forms Digital Post.

## Installation

```sh
drush pm:enable os2forms_digital_post_examples
```

Go to `/admin/structure/webform?category=Example` to see the example forms.
Loading
Loading