Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- Added the `CPR / Navn validering` element to allowed recipient element names
[PR-43](https://github.com/itk-dev/os2forms_digital_post/pull/43)

## [2.0.1]

## Changed
Expand Down
11 changes: 11 additions & 0 deletions src/Helper/WebformHelperSF1601.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,17 @@ public function sendDigitalPost(WebformSubmissionInterface $submission, array $h
}

$recipientIdentifier = $submissionData[$recipientIdentifierKey] ?? NULL;

// Fix if os2forms_person_lookup (cpr & name validation) element is used.
if (is_array($recipientIdentifier)) {
// Example:
// [
// 'cpr_number' => 1234567890,
// 'name' => Eksempel Eksempelsen,
// ].
$recipientIdentifier = $recipientIdentifier['cpr_number'] ?? NULL;
}

if (NULL === $recipientIdentifier) {
$message = 'Recipient identifier element (key: @element_key) not found in submission';
$context = [
Expand Down
1 change: 1 addition & 0 deletions src/Plugin/WebformHandler/WebformHandlerSF1601.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ private function getRecipientElements(): array {
'os2forms_nemid_company_cvr',
'os2forms_nemid_company_cvr_fetch_data',
'os2forms_nemid_cpr',
'os2forms_person_lookup',
// @todo Remove these when we remove the elements.
'cpr_element',
'cpr_value_element',
Expand Down