Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 0a6c5eb

Browse files
authored
Merge pull request #14 from itk-dev/feature/handle-address-side
Handle address side
2 parents 5d7ffd4 + 0af1250 commit 0a6c5eb

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/Plugin/WebformHandler/DigitalPostWebformHandler.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,12 +331,19 @@ public function postSave(WebformSubmissionInterface $webform_submission, $update
331331
/** @var \Drupal\os2forms_cpr_lookup\CPR\CprServiceResult $cprSearchResult */
332332
$cprSearchResult = $this->cprService->search($submissionData[$this->configuration['cpr_element']]);
333333

334+
// We cannot use “side” (from address lookup via cpr) as “suiteIdentifier”
335+
// when sending digital port. Therefore we append it to “floor” instead.
336+
$floor = $cprSearchResult->getFloor();
337+
if (!empty($cprSearchResult->getSide())) {
338+
$floor .= ' '.$cprSearchResult->getSide();
339+
}
340+
334341
$recipient = [
335342
'name' => $cprSearchResult->getName(),
336343
'streetName' => $cprSearchResult->getStreetName(),
337344
'streetNumber' => $cprSearchResult->getHouseNumber(),
338-
'floor' => $cprSearchResult->getFloor(),
339-
'side' => $cprSearchResult->getSide(),
345+
'floor' => $floor,
346+
'side' => null,
340347
'postalCode' => $cprSearchResult->getPostalCode(),
341348
'city' => $cprSearchResult->getCity(),
342349
];
@@ -363,8 +370,8 @@ public function postSave(WebformSubmissionInterface $webform_submission, $update
363370
null,
364371
$cprSearchResult->getStreetName(),
365372
$cprSearchResult->getHouseNumber(),
366-
$cprSearchResult->getFloor(),
367-
$cprSearchResult->getSide(),
373+
$floor,
374+
null,
368375
null,
369376
$cprSearchResult->getPostalCode(),
370377
null,

0 commit comments

Comments
 (0)