Skip to content

Commit d02a0ef

Browse files
authored
Merge pull request #117 from JerrySmidt/master
3.6.3
2 parents e4c3147 + 422bf24 commit d02a0ef

File tree

5 files changed

+15
-17
lines changed

5 files changed

+15
-17
lines changed

Helper/ApiClientHelper.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -339,20 +339,6 @@ public function getNlAddress(string $zipCode, string $houseNumber): array
339339
];
340340
}
341341

342-
$streetParts = [
343-
$address['street'],
344-
$address['houseNumber'],
345-
$address['houseNumberAddition'] ?? '',
346-
];
347-
348-
if ($this->_storeConfigHelper->isSetFlag('split_street_values')) {
349-
$lastLineIndex = $this->_addressHelper->getStreetLines() - 1;
350-
$address['streetLines'] = array_slice($streetParts, 0, $lastLineIndex);
351-
$address['streetLines'][] = implode(' ', array_slice($streetParts, $lastLineIndex));
352-
} else {
353-
$address['streetLines'] = [rtrim(implode(' ', $streetParts))];
354-
}
355-
356342
$result = ['address' => $address, 'status' => $status];
357343

358344
return $this->_prepareResponse($result, $client);

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "postcode-nl/api-magento2-module",
3-
"version": "3.6.2",
3+
"version": "3.6.3",
44
"description": "Postcode.eu International Address API module for Magento 2. Adds autocompletion for addresses in multiple countries using official postal data.",
55
"require": {
66
"php": "^7.4 || ^8.0 || ^8.1 || ^8.2 || ^8.3 || ^8.4",

etc/config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<default>
44
<postcodenl_api>
55
<status>
6-
<module_version>3.6.2</module_version>
6+
<module_version>3.6.3</module_version>
77
<account_status>new</account_status>
88
</status>
99
<general>

view/frontend/web/js/form/components/address-autofill-nl.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,17 @@ define([
182182
},
183183

184184
getAddressParts: function (address) {
185+
const streetParts = [address.street, address.houseNumber, address.houseNumberAddition ?? ''];
186+
187+
if (this.settings.split_street_values) {
188+
const lastChildIndex = this.initChildCount - 1;
189+
190+
address.streetLines = streetParts.slice(0, lastChildIndex);
191+
address.streetLines.push(streetParts.slice(lastChildIndex).join(' ').trim());
192+
} else {
193+
address.streetLines = [streetParts.join(' ').trim()];
194+
}
195+
185196
return {
186197
...address,
187198
houseNumberAddition: address.houseNumberAddition ?? '',

view/frontend/web/js/form/components/street/group.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ define([
3434
// Join remaining args for last or single child.
3535
values.push(args.slice(lastChildIndex).join(' ').trim());
3636

37-
values.forEach((v, i) => { Registry.async(`${this.name}.${i}`)('value', v); });
37+
// NB. value is cast to string for correct length validation of house numbers.
38+
values.forEach((v, i) => { Registry.async(`${this.name}.${i}`)('value', String(v)); });
3839
},
3940
});
4041
});

0 commit comments

Comments
 (0)