Skip to content

Commit bcd6e0f

Browse files
authored
Merge pull request #22 from itk-dev/hotfix/lookup-identifier
Set actual identifier from lookup on lookup result
2 parents 8089b22 + d9685de commit bcd6e0f

File tree

5 files changed

+7
-3
lines changed

5 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
* [PR-22](https://github.com/OS2web/os2web_datalookup/pull/22)
11+
Set actual identifier from lookup on lookup result
12+
1013
## [2.0.4] 2025-01-29
1114

1215
* Ensure postal code is only added to city if `CVRAdresse_postdistrikt` is not set.

src/Plugin/os2web/DataLookup/DatafordelerCVR.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function lookup(string $param): CompanyLookupResult {
8080
$cvrResult = new CompanyLookupResult();
8181
if ($result && isset($result->virksomhed) && !empty((array) $result->virksomhed)) {
8282
$cvrResult->setSuccessful();
83-
$cvrResult->setCvr($param);
83+
$cvrResult->setCvr($result->virksomhed->CVRNummer);
8484

8585
if ($result->virksomhedsnavn) {
8686
$cvrResult->setName($result->virksomhedsnavn->vaerdi);

src/Plugin/os2web/DataLookup/ServiceplatformenCPR.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ public function lookup(string $cpr): CprLookupResult {
164164
// If all goes well, we return an address array.
165165
if ($result['status']) {
166166
$cprResult->setSuccessful();
167+
// @todo Use a value from from $result to set CPR. But which key?
167168
$cprResult->setCpr($cpr);
168169
$cprResult->setName($result['adresseringsnavn'] ?? '');
169170
$cprResult->setStreet($result['vejadresseringsnavn'] ?? '');

src/Plugin/os2web/DataLookup/ServiceplatformenCPRExtended.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ public function lookup(string $cpr, $fetchChildren = TRUE, $allowCprTestModeRepl
125125
// If all goes well, we return an address array.
126126
if ($result['status']) {
127127
$cprResult->setSuccessful();
128-
$cprResult->setCpr($cpr);
129128

130129
$persondata = $result['persondata'];
130+
$cprResult->setCpr($persondata->personnummer);
131131

132132
if ($persondata->status) {
133133
if ($persondata->status->status == self::CPR_STATUS_DEAD) {

src/Plugin/os2web/DataLookup/ServiceplatformenCVR.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function lookup(string $param): CompanyLookupResult {
120120
$cvrResult = new CompanyLookupResult();
121121
if ($result['status']) {
122122
$cvrResult->setSuccessful();
123-
$cvrResult->setCvr($param);
123+
$cvrResult->setCvr($result['cvr']);
124124

125125
$cvrResult->setName($result['company_name']);
126126
$cvrResult->setStreet($result['company_street']);

0 commit comments

Comments
 (0)