Skip to content

Commit

Permalink
Merge pull request #18 from itk-dev/fix/nemid-company-city-adjustment
Browse files Browse the repository at this point in the history
Avoid CVR city containing postal code if city is found
  • Loading branch information
jekuaitk authored Jan 29, 2025
2 parents dcfabd8 + 28e5a6c commit 0bec3b0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

* Ensure postal code is only added to city if `CVRAdresse_postdistrikt` is not set.
* Added missing use statement to fix issue on datafordeler settings pages
`pnumber_lookup`, `cvr_lookup` and `cpr_lookup`.

Expand Down
5 changes: 1 addition & 4 deletions src/Plugin/os2web/DataLookup/DatafordelerCVR.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,7 @@ public function lookup(string $param): CompanyLookupResult {
$cvrResult->setFloor($address->CVRAdresse_etagebetegnelse ?? '');
$cvrResult->setApartmentNr($address->CVRAdresse_doerbetegnelse ?? '');
$cvrResult->setPostalCode($address->CVRAdresse_postnummer ?? '');
$city = implode(' ', array_filter([
$address->CVRAdresse_postdistrikt ?? NULL,
$cvrResult->getPostalCode() ?? NULL,
]));
$city = $address->CVRAdresse_postdistrikt ?? $cvrResult->getPostalCode();
$cvrResult->setCity($city);
$cvrResult->setMunicipalityCode($address->CVRAdresse_kommunekode ?? '');

Expand Down

0 comments on commit 0bec3b0

Please sign in to comment.